mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
deploy-ng: Add options for using optimized wheels for panda3d
This works by adding extra index urls. Optimized wheels have local version tags that should take precedence over non-optimized wheels. If no optimized wheel if found for a platform, a warning is issued and a non-optimized wheel is used instead.
This commit is contained in:
parent
90b0f501dc
commit
665bdb16ea
@ -7,6 +7,7 @@ import plistlib
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import zipfile
|
import zipfile
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
import struct
|
import struct
|
||||||
@ -207,6 +208,8 @@ class build_apps(setuptools.Command):
|
|||||||
self.log_filename = None
|
self.log_filename = None
|
||||||
self.log_append = False
|
self.log_append = False
|
||||||
self.requirements_path = './requirements.txt'
|
self.requirements_path = './requirements.txt'
|
||||||
|
self.use_optimized_wheels = True
|
||||||
|
self.optimized_wheel_index = ''
|
||||||
self.pypi_extra_indexes = []
|
self.pypi_extra_indexes = []
|
||||||
self.file_handlers = {}
|
self.file_handlers = {}
|
||||||
self.exclude_dependencies = [
|
self.exclude_dependencies = [
|
||||||
@ -288,6 +291,17 @@ class build_apps(setuptools.Command):
|
|||||||
subprocess.check_call(['pipenv', 'lock', '--requirements'], stdout=reqsfile)
|
subprocess.check_call(['pipenv', 'lock', '--requirements'], stdout=reqsfile)
|
||||||
self.requirements_path = reqspath
|
self.requirements_path = reqspath
|
||||||
|
|
||||||
|
if self.use_optimized_wheels:
|
||||||
|
if not self.optimized_wheel_index:
|
||||||
|
# Try to find an appropriate wheel index
|
||||||
|
with open(self.requirements_path) as reqsfile:
|
||||||
|
reqsdata = reqsfile.read()
|
||||||
|
matches = re.search(r'--extra-index-url (https*://archive.panda3d.org/.*\b)', reqsdata)
|
||||||
|
if matches and matches.group(1):
|
||||||
|
self.optimized_wheel_index = matches.group(1) + '/opt'
|
||||||
|
|
||||||
|
assert self.optimized_wheel_index, 'An index for optimized wheels must be defined if use_optimized_wheels is set'
|
||||||
|
|
||||||
assert os.path.exists(self.requirements_path), 'Requirements.txt path does not exist: {}'.format(self.requirements_path)
|
assert os.path.exists(self.requirements_path), 'Requirements.txt path does not exist: {}'.format(self.requirements_path)
|
||||||
assert num_gui_apps + num_console_apps != 0, 'Must specify at least one app in either gui_apps or console_apps'
|
assert num_gui_apps + num_console_apps != 0, 'Must specify at least one app in either gui_apps or console_apps'
|
||||||
|
|
||||||
@ -362,6 +376,11 @@ class build_apps(setuptools.Command):
|
|||||||
'--abi', abi_tag
|
'--abi', abi_tag
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if self.use_optimized_wheels:
|
||||||
|
pip_args += [
|
||||||
|
'--extra-index-url', self.optimized_wheel_index
|
||||||
|
]
|
||||||
|
|
||||||
for index in self.pypi_extra_indexes:
|
for index in self.pypi_extra_indexes:
|
||||||
pip_args += ['--extra-index-url', index]
|
pip_args += ['--extra-index-url', index]
|
||||||
|
|
||||||
@ -452,6 +471,15 @@ class build_apps(setuptools.Command):
|
|||||||
else:
|
else:
|
||||||
raise RuntimeError("Missing panda3d wheel for platform: {}".format(platform))
|
raise RuntimeError("Missing panda3d wheel for platform: {}".format(platform))
|
||||||
|
|
||||||
|
if self.use_optimized_wheels:
|
||||||
|
# Check to see if we have an optimized wheel
|
||||||
|
localtag = p3dwhlfn.split('+')[1].split('-')[0]
|
||||||
|
if not localtag.endswith('opt'):
|
||||||
|
self.announce(
|
||||||
|
'Could not find an optimized wheel (using index {}) for platform: {}'.format(self.optimized_wheel_index, platform),
|
||||||
|
distutils.log.WARN
|
||||||
|
)
|
||||||
|
|
||||||
#whlfiles = {whl: self._get_zip_file(whl) for whl in wheelpaths}
|
#whlfiles = {whl: self._get_zip_file(whl) for whl in wheelpaths}
|
||||||
|
|
||||||
# Add whl files to the path so they are picked up by modulefinder
|
# Add whl files to the path so they are picked up by modulefinder
|
||||||
|
Loading…
x
Reference in New Issue
Block a user