diff --git a/direct/src/dist/commands.py b/direct/src/dist/commands.py index c9682bc864..78d4cde5a5 100644 --- a/direct/src/dist/commands.py +++ b/direct/src/dist/commands.py @@ -399,27 +399,22 @@ class build_apps(setuptools.Command): self.announce('Gathering wheels for platform: {}'.format(platform), distutils.log.INFO) - whldir = os.path.join(self.build_base, '__whl_cache__') + whlcache = os.path.join(self.build_base, '__whl_cache__') - #TODO find a better way to get abi tag than from internal/private pip APIs - if hasattr(pip, 'pep425tags'): - pep425tags = pip.pep425tags - wheel = pip.wheel - else: - from pip._internal import pep425tags, wheel + pip_version = int(pip.__version__.split('.')[0]) + if pip_version < 9: + raise RuntimeError("pip 9.0 or greater is required, but found {}".format(pip.__version__)) - abi_tag = pep425tags.get_abi_tag() - - if 'u' in abi_tag and (platform.startswith('win') or platform.startswith('macosx')): - abi_tag = abi_tag.replace('u', '') + abi_tag = 'cp%d%d' % (sys.version_info[:2]) + if sys.version_info < (3, 8): + abi_tag += 'm' # For these distributions, we need to append 'u' on Linux if abi_tag in ('cp26m', 'cp27m', 'cp32m') and not platform.startswith('win') and not platform.startswith('macosx'): abi_tag += 'u' - pip_version = pip.__version__.split('.') - if int(pip_version[0]) < 9: - raise RuntimeError("pip 9.0 or greater is required, but found {}".format(pip.__version__)) + whldir = os.path.join(whlcache, '_'.join((platform, abi_tag))) + os.makedirs(whldir, exist_ok=True) # Remove any .zip files. These are built from a VCS and block for an # interactive prompt on subsequent downloads. @@ -447,19 +442,12 @@ class build_apps(setuptools.Command): subprocess.check_call([sys.executable, '-m', 'pip'] + pip_args) - # Now figure out which of the downloaded wheels are relevant to us. - tags = pep425tags.get_supported(platform=platform, abi=abi_tag) - wheelpaths = [] - for filename in os.listdir(whldir): - try: - whl = wheel.Wheel(filename) - except wheel.InvalidWheelFilename: - continue - - if whl.supported(tags): - wheelpaths.append(os.path.join(whldir, filename)) - - return wheelpaths + # Return a list of paths to the downloaded whls + return [ + os.path.join(whldir, filename) + for filename in os.listdir(whldir) + if filename.endswith('.whl') + ] def update_pe_resources(self, appname, runtime): """Update resources (e.g., icons) in windows PE file"""