Skip to content

Commit

Permalink
Merge pull request #242 from eikesr/master
Browse files Browse the repository at this point in the history
Update generator to work with python 3.12
  • Loading branch information
eikesr authored Jun 14, 2024
2 parents 494f773 + 7d80162 commit ce73c93
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
export FLATDATA_GENERATOR_PATH=${PWD}/flatdata-generator
cd flatdata-rs
cargo test --all-targets
cargo test --all-targets --all-features
cargo test --all-targets --all-features
4 changes: 2 additions & 2 deletions flatdata-generator/flatdata/generator/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See the LICENSE file in the root of this project for license details.
'''

import imp
import types

from flatdata.generator.tree.builder import build_ast
from flatdata.generator.tree.nodes.trivial.namespace import Namespace
Expand Down Expand Up @@ -70,7 +70,7 @@ def render_python_module(self, module_name=None, archive_name=None):
"""
root_namespace = self._find_root_namespace(self.tree)
module_code = self.render("py")
module = imp.new_module(module_name if module_name is not None else root_namespace.name)
module = types.ModuleType(module_name if module_name is not None else root_namespace.name)
#pylint: disable=exec-used
exec(module_code, module.__dict__)
if archive_name is None:
Expand Down
38 changes: 34 additions & 4 deletions flatdata-generator/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "flatdata-generator"
version = "0.4.6"
description = "Generate source code for C++, Rust, Go or Python from a Flatdata schema file"
readme = "README.md"
license = ""
authors = [
{ name = "Flatdata Developers" },
]
build-backend = "setuptools.build_meta"
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
]
dependencies = [
"jinja2>=2.2",
"pyparsing>=2.0",
]

[project.scripts]
flatdata-generator = "flatdata.generator.app:main"

[project.urls]
Homepage = "https://github.com/heremaps/flatdata"

[tool.hatch.build.targets.sdist]
include = [
"/flatdata",
]

[tool.hatch.build.targets.wheel]
packages = ["flatdata"]
33 changes: 0 additions & 33 deletions flatdata-generator/setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions flatdata-rs/lib/src/arrayview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ mod test {

let x = {
// test clone and lifetime of returned reference
let view_copy = view.clone();
let view_copy = view;
&view_copy[0]
};
assert_eq!(65535, x.x());
assert_eq!(65535, x.y());

let x = {
// test clone and lifetime of returned reference
let view_copy = view.clone();
let view_copy = view;
view_copy.iter().next().unwrap()
};
assert_eq!(65535, x.x());
Expand Down

0 comments on commit ce73c93

Please sign in to comment.