diff --git a/pyproject.toml b/pyproject.toml index 8bb946933..11076ff06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,10 @@ classifiers = [ ] dependencies = [] +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + [project.optional-dependencies] dev = [ "setuptools", # for distutils diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..e96a85971 --- /dev/null +++ b/setup.py @@ -0,0 +1,11 @@ +from setuptools import Distribution, setup + + +class BinaryDistribution(Distribution): + """Mark wheels containing the pre-built Cython modules as platform-specific.""" + + def has_ext_modules(self) -> bool: + return True + + +setup(distclass=BinaryDistribution) diff --git a/test.sh b/test.sh index d91afb035..6a040c7ae 100755 --- a/test.sh +++ b/test.sh @@ -9,6 +9,17 @@ source ./setup.sh # *** build *** scons -j8 +# Verify the package is installable and is not mislabeled as platform-independent. +rm -rf dist +uv build --wheel +wheel="$(realpath "$(find dist -maxdepth 1 -name '*.whl' -print -quit)")" +if [[ "$wheel" == *-none-any.whl ]]; then + echo "native extension wheel is incorrectly tagged as platform-independent: $wheel" >&2 + exit 1 +fi +uv run --isolated --no-project --with "$wheel" --directory / python -c \ + "import msgq, msgq.visionipc" + # *** lint + test *** lefthook run test