]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Tell Wheel to generate platform and interpreter specific wheels
authorDonald Stufft <donald@stufft.io>
Thu, 13 Aug 2015 18:57:53 +0000 (14:57 -0400)
committerDonald Stufft <donald@stufft.io>
Thu, 13 Aug 2015 18:57:53 +0000 (14:57 -0400)
By telling wheel that we have extension modules, even though we
have none, wheel will create a Wheel which is platform and
interpreter specific. This will ensure that the pure Python wheels
on PyPy do not trigger installs on CPython without the C speedups.

setup.py

index 8f9ba4dd8549cd7cd0e6851a2d831211a029e8c4..5b97cb9fe818ac75d0e48433b5337381c25dd80a 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ from distutils.command.build_ext import build_ext
 from distutils.errors import CCompilerError
 from distutils.errors import DistutilsExecError
 from distutils.errors import DistutilsPlatformError
-from setuptools import Extension
+from setuptools import Distribution as _Distribution, Extension
 from setuptools import setup
 from setuptools import find_packages
 from setuptools.command.test import test as TestCommand
@@ -62,6 +62,18 @@ class ve_build_ext(build_ext):
 cmdclass['build_ext'] = ve_build_ext
 
 
+class Distribution(_Distribution):
+
+    def has_ext_modules(self):
+        # We want to always claim that we have ext_modules. This will be fine
+        # if we don't actually have them (such as on PyPy) because nothing
+        # will get built, however we don't want to provide an overally broad
+        # Wheel package when building a wheel without C support. This will
+        # ensure that Wheel knows to treat us as if the build output is
+        # platform specific.
+        return True
+
+
 class PyTest(TestCommand):
     # from https://pytest.org/latest/goodpractises.html\
     # #integration-with-setuptools-test-commands
@@ -111,6 +123,8 @@ def run_setup(with_cext):
     kwargs = {}
     if with_cext:
         kwargs['ext_modules'] = ext_modules
+    else:
+        kwargs['ext_modules'] = []
 
     setup(
         name="SQLAlchemy",
@@ -137,6 +151,7 @@ def run_setup(with_cext):
             "Topic :: Database :: Front-Ends",
             "Operating System :: OS Independent",
         ],
+        distclass=Distribution,
         **kwargs
     )