2626import sys
2727from setuptools import setup , Extension , Distribution
2828from setuptools .command .build_ext import build_ext
29+ from wheel .bdist_wheel import bdist_wheel
2930import shutil
3031import sysconfig
3132
@@ -236,6 +237,18 @@ def get_outputs(self):
236237 return self ._found_paths
237238
238239
240+ class libusb_bdist_wheel (bdist_wheel ):
241+ def finalize_options (self ):
242+ bdist_wheel .finalize_options (self )
243+ # This is not a Pure python wheel, so it still needs to be platform specific.
244+ self .root_is_pure = False
245+
246+ def get_tag (self ):
247+ python , abi , plat = bdist_wheel .get_tag (self )
248+ # We can replace the python version and abi, and tag it compatible with all Python 3 versions.
249+ return "py3" , "none" , plat
250+
251+
239252class BinaryDistribution (Distribution ):
240253 def has_ext_modules (self ):
241254 return True
@@ -246,6 +259,7 @@ def has_ext_modules(self):
246259 # Dummy extension to trigger build_ext
247260 ext_modules = [Extension ('' , sources = [])],
248261 cmdclass = {
249- 'build_ext' : libusb_build_ext
262+ 'build_ext' : libusb_build_ext ,
263+ 'bdist_wheel' : libusb_bdist_wheel ,
250264 },
251265)
0 commit comments