From 23e3f1c03107ba00b2de929e6b21d60706df7a50 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 11 Dec 2023 08:04:26 -0800 Subject: [PATCH] Inform `setuptools` that `Extensions` are included (#643) Fixes https://github.com/rapidsai/cucim/issues/641 As `setuptools`/`pip`/`wheel` will mark our package as pure (even though we put an extension module into it), make sure it doesn't by informing `setuptools` that `Extensions` are contained within. This should ensure that are wheels include the Python minor version they were built for. Authors: - https://github.com/jakirkham Approvers: - Ray Douglass (https://github.com/raydouglass) - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) - Gregory Lee (https://github.com/grlee77) --- ci/build_wheel.sh | 8 -------- python/cucim/LICENSE | 1 + python/cucim/LICENSE-3rdparty.md | 1 + python/cucim/pyproject.toml | 5 ++++- python/cucim/setup.py | 16 ++++++++++++++++ 5 files changed, 22 insertions(+), 9 deletions(-) create mode 120000 python/cucim/LICENSE create mode 120000 python/cucim/LICENSE-3rdparty.md create mode 100644 python/cucim/setup.py diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 60355e050..a39ebf502 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -45,14 +45,6 @@ cd "${package_dir}" python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check -# Because we built the library with the run script and manually copied the shared pybind11 -# library, the subsequent py_project.toml wheel build was as a pure Python package and results in -# tags that incorrectly indicate it is a universal wheel. To fix this, we need to modify the wheel -# to have CPython ABI and Python tags matching the version of Python that the Python bindings were -# built with. -WHEEL_PYTHON_TAG=cp$(echo ${RAPIDS_PY_VERSION} | sed 's/\.//g') -python -m wheel tags --remove --python-tag="${WHEEL_PYTHON_TAG}" --abi-tag="${WHEEL_PYTHON_TAG}" dist/* - mkdir -p final_dist python -m auditwheel repair -w final_dist dist/* diff --git a/python/cucim/LICENSE b/python/cucim/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/python/cucim/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/python/cucim/LICENSE-3rdparty.md b/python/cucim/LICENSE-3rdparty.md new file mode 120000 index 000000000..f07a448f7 --- /dev/null +++ b/python/cucim/LICENSE-3rdparty.md @@ -0,0 +1 @@ +../../LICENSE-3rdparty.md \ No newline at end of file diff --git a/python/cucim/pyproject.toml b/python/cucim/pyproject.toml index 1136ee877..ce9dc87e5 100644 --- a/python/cucim/pyproject.toml +++ b/python/cucim/pyproject.toml @@ -91,7 +91,10 @@ docs = [ cucim = "cucim.clara.cli:main" [tool.setuptools] -license-files = ["LICENSE"] +license-files = [ + "LICENSE", + "LICENSE-3rdparty.md", +] include-package-data = true [tool.setuptools.dynamic] diff --git a/python/cucim/setup.py b/python/cucim/setup.py new file mode 100644 index 000000000..23534bec7 --- /dev/null +++ b/python/cucim/setup.py @@ -0,0 +1,16 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. + +from setuptools import setup +from setuptools.dist import Distribution as _Distribution + + +# As we vendored a shared object that links to a specific Python version, +# make sure it is treated as impure so the wheel is named properly. +class Distribution(_Distribution): + def has_ext_modules(self): + return True + + +setup( + distclass=Distribution, +)