diff --git a/setup.py b/setup.py index 70336c96e43..ee25ce845c9 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(self): + 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", )