From 0410b57482e7a71c54863fbb91431059b7dd61d5 Mon Sep 17 00:00:00 2001 From: ZeroIntensity Date: Mon, 1 Apr 2024 17:47:55 -0400 Subject: [PATCH] fix #33 --- a.py | 13 +++++++++++++ compile_flags.txt | 2 ++ pyproject.toml | 4 ++-- setup.py | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 a.py create mode 100644 compile_flags.txt diff --git a/a.py b/a.py new file mode 100644 index 0000000..e40c547 --- /dev/null +++ b/a.py @@ -0,0 +1,13 @@ +from pointers import Reference, MutReference, ref + +my_value = ref(0) + +def test(my_ref: MutReference[int]) -> None: + print(f"now borrowing mutable {my_ref}") + my_ref <<= 1 + +with my_value.mut(): + my_value <<= 2 + +test(my_value.mut()) +print(~my_value) # 1 \ No newline at end of file diff --git a/compile_flags.txt b/compile_flags.txt new file mode 100644 index 0000000..00c4209 --- /dev/null +++ b/compile_flags.txt @@ -0,0 +1,2 @@ +-I +/usr/include/python3.8 diff --git a/pyproject.toml b/pyproject.toml index 04d1cc8..43bdc2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools", "toml"] build-backend = "setuptools.build_meta" [project] @@ -21,7 +21,7 @@ classifiers = [ dependencies = [ "typing_extensions", ] -version = "2.6.0" +version = "3.0.1" [project.urls] Documentation = "https://pointers.zintensity.dev" diff --git a/setup.py b/setup.py index 2cc449d..1e90519 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,23 @@ +import toml from setuptools import Extension, setup +with open("./README.md") as f: + long_desc: str = f.read() + if __name__ == "__main__": + with open("./pyproject.toml", "r") as f: + data = toml.load(f) setup( + name="pointers.py", + version="3.0.1", packages=["pointers"], + project_urls=data["project"]["urls"], package_dir={"": "src"}, - ext_modules=[Extension("_pointers", ["./src/mod.c"])], + license="MIT", + ext_modules=[ + Extension( + "_pointers", + ["./src/mod.c"] + ) + ], )