From 87a1389d130ad6f5774536d483943b3b12ffa251 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:30:50 +0100 Subject: [PATCH] move python source in examples under python/ subdir --- examples/hello-world-script/MANIFEST.in | 1 + .../hello-world-script/{ => python}/hello_world/__init__.py | 0 examples/hello-world-script/setup.py | 4 +++- examples/hello-world/MANIFEST.in | 1 + examples/hello-world/{ => python}/hello_world/__init__.py | 0 examples/hello-world/setup.py | 4 +++- examples/html-py-ever/MANIFEST.in | 1 + examples/html-py-ever/{ => python}/html_py_ever/__init__.py | 0 examples/html-py-ever/setup.py | 5 +++-- examples/namespace_package/MANIFEST.in | 1 + .../{ => python}/namespace_package/python/__init__.py | 0 examples/namespace_package/setup.py | 3 ++- examples/rust_with_cffi/MANIFEST.in | 1 + .../rust_with_cffi/{ => python}/rust_with_cffi/__init__.py | 0 examples/rust_with_cffi/setup.py | 5 +++-- 15 files changed, 19 insertions(+), 7 deletions(-) rename examples/hello-world-script/{ => python}/hello_world/__init__.py (100%) rename examples/hello-world/{ => python}/hello_world/__init__.py (100%) rename examples/html-py-ever/{ => python}/html_py_ever/__init__.py (100%) rename examples/namespace_package/{ => python}/namespace_package/python/__init__.py (100%) rename examples/rust_with_cffi/{ => python}/rust_with_cffi/__init__.py (100%) diff --git a/examples/hello-world-script/MANIFEST.in b/examples/hello-world-script/MANIFEST.in index 7c68298b..53741426 100644 --- a/examples/hello-world-script/MANIFEST.in +++ b/examples/hello-world-script/MANIFEST.in @@ -1,2 +1,3 @@ include Cargo.toml recursive-include src * +recursive-include python * diff --git a/examples/hello-world-script/hello_world/__init__.py b/examples/hello-world-script/python/hello_world/__init__.py similarity index 100% rename from examples/hello-world-script/hello_world/__init__.py rename to examples/hello-world-script/python/hello_world/__init__.py diff --git a/examples/hello-world-script/setup.py b/examples/hello-world-script/setup.py index 65b222cd..7ea2e072 100644 --- a/examples/hello-world-script/setup.py +++ b/examples/hello-world-script/setup.py @@ -1,10 +1,12 @@ -from setuptools import setup +from setuptools import find_packages, setup from setuptools_rust import RustExtension, Binding setup( name="hello-world-script", version="1.0", + packages=find_packages(where="python"), + package_dir={"": "python"}, rust_extensions=[ RustExtension( {"hello-world-script": "hello_world.hello-world-script"}, diff --git a/examples/hello-world/MANIFEST.in b/examples/hello-world/MANIFEST.in index 7c68298b..53741426 100644 --- a/examples/hello-world/MANIFEST.in +++ b/examples/hello-world/MANIFEST.in @@ -1,2 +1,3 @@ include Cargo.toml recursive-include src * +recursive-include python * diff --git a/examples/hello-world/hello_world/__init__.py b/examples/hello-world/python/hello_world/__init__.py similarity index 100% rename from examples/hello-world/hello_world/__init__.py rename to examples/hello-world/python/hello_world/__init__.py diff --git a/examples/hello-world/setup.py b/examples/hello-world/setup.py index 48e7839b..91361eaa 100644 --- a/examples/hello-world/setup.py +++ b/examples/hello-world/setup.py @@ -1,10 +1,12 @@ -from setuptools import setup +from setuptools import find_packages, setup from setuptools_rust import RustBin setup( name="hello-world", version="1.0", + packages=find_packages(where="python"), + package_dir={"": "python"}, rust_extensions=[ RustBin( "hello-world", diff --git a/examples/html-py-ever/MANIFEST.in b/examples/html-py-ever/MANIFEST.in index 7c68298b..53741426 100644 --- a/examples/html-py-ever/MANIFEST.in +++ b/examples/html-py-ever/MANIFEST.in @@ -1,2 +1,3 @@ include Cargo.toml recursive-include src * +recursive-include python * diff --git a/examples/html-py-ever/html_py_ever/__init__.py b/examples/html-py-ever/python/html_py_ever/__init__.py similarity index 100% rename from examples/html-py-ever/html_py_ever/__init__.py rename to examples/html-py-ever/python/html_py_ever/__init__.py diff --git a/examples/html-py-ever/setup.py b/examples/html-py-ever/setup.py index ef95fbe1..7d236d43 100755 --- a/examples/html-py-ever/setup.py +++ b/examples/html-py-ever/setup.py @@ -1,10 +1,11 @@ #!/usr/bin/env python -import sys -from setuptools import setup +from setuptools import find_packages, setup from setuptools_rust import RustExtension setup( + packages=find_packages(where="python"), + package_dir={"": "python"}, rust_extensions=[RustExtension("html_py_ever.html_py_ever")], ) diff --git a/examples/namespace_package/MANIFEST.in b/examples/namespace_package/MANIFEST.in index 7c68298b..53741426 100644 --- a/examples/namespace_package/MANIFEST.in +++ b/examples/namespace_package/MANIFEST.in @@ -1,2 +1,3 @@ include Cargo.toml recursive-include src * +recursive-include python * diff --git a/examples/namespace_package/namespace_package/python/__init__.py b/examples/namespace_package/python/namespace_package/python/__init__.py similarity index 100% rename from examples/namespace_package/namespace_package/python/__init__.py rename to examples/namespace_package/python/namespace_package/python/__init__.py diff --git a/examples/namespace_package/setup.py b/examples/namespace_package/setup.py index d2eea6ed..43003e94 100644 --- a/examples/namespace_package/setup.py +++ b/examples/namespace_package/setup.py @@ -5,7 +5,8 @@ setup( name="namespace_package", version="0.1.0", - packages=find_namespace_packages(include=["namespace_package.*"]), + packages=find_namespace_packages(include=["namespace_package.*"], where="python"), + package_dir={"": "python"}, zip_safe=False, rust_extensions=[ RustExtension( diff --git a/examples/rust_with_cffi/MANIFEST.in b/examples/rust_with_cffi/MANIFEST.in index 0e80770b..dba5df43 100644 --- a/examples/rust_with_cffi/MANIFEST.in +++ b/examples/rust_with_cffi/MANIFEST.in @@ -1,3 +1,4 @@ include Cargo.toml include cffi_module.py recursive-include src * +recursive-include python * diff --git a/examples/rust_with_cffi/rust_with_cffi/__init__.py b/examples/rust_with_cffi/python/rust_with_cffi/__init__.py similarity index 100% rename from examples/rust_with_cffi/rust_with_cffi/__init__.py rename to examples/rust_with_cffi/python/rust_with_cffi/__init__.py diff --git a/examples/rust_with_cffi/setup.py b/examples/rust_with_cffi/setup.py index 6e4b388f..3a99f443 100644 --- a/examples/rust_with_cffi/setup.py +++ b/examples/rust_with_cffi/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from setuptools import setup +from setuptools import find_packages, setup from setuptools_rust import RustExtension setup( @@ -14,7 +14,8 @@ "Operating System :: POSIX", "Operating System :: MacOS :: MacOS X", ], - packages=["rust_with_cffi"], + packages=find_packages(where="python"), + package_dir={"": "python"}, rust_extensions=[ RustExtension("rust_with_cffi.rust", py_limited_api="auto"), ],