Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generator to work with python 3.12 #242

Merged
merged 5 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
VeaaC marked this conversation as resolved.
Show resolved Hide resolved
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
Loading