From b171ab603547453954364b1310baf48fd7f61f6f Mon Sep 17 00:00:00 2001 From: Corentin Cadiou Date: Wed, 23 Sep 2020 12:11:35 +0100 Subject: [PATCH 1/2] Fix 2892 --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 70336c96e43..43850bb27d6 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from distutils.version import LooseVersion import pkg_resources -from setuptools import find_packages, setup +from setuptools import Distribution, find_packages, setup from setupext import ( check_for_openmp, @@ -84,6 +84,16 @@ # This overrides using lib_exts, so it has to happen after lib_exts is fully defined build_ext, sdist = create_build_ext(lib_exts, cythonize_aliases) +# Force setuptools to consider that there are ext modules, even if empty. +# See https://github.com/yt-project/yt/issues/2922 and +# https://stackoverflow.com/a/62668026/2601223 for the fix. +class BinaryDistribution(Distribution): + """Distribution which always forces a binary package with platform name.""" + + def has_ext_modules(foo): + return True + + if __name__ == "__main__": setup( name="yt", @@ -141,6 +151,7 @@ license="BSD 3-Clause", zip_safe=False, scripts=["scripts/iyt"], + distclass=BinaryDistribution, ext_modules=[], # !!! We override this inside build_ext above python_requires=">=3.6", ) From 8df2044e7a4a018303d7054dc3f48be640de04f0 Mon Sep 17 00:00:00 2001 From: Corentin Cadiou Date: Wed, 23 Sep 2020 16:23:50 +0200 Subject: [PATCH 2/2] Pass right argument to `has_ext_modules` --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 43850bb27d6..ee25ce845c9 100644 --- a/setup.py +++ b/setup.py @@ -90,7 +90,7 @@ class BinaryDistribution(Distribution): """Distribution which always forces a binary package with platform name.""" - def has_ext_modules(foo): + def has_ext_modules(self): return True