deploy-ng: Add wheel files to sys.path so modulefinder can pick up the files

This commit is contained in:
Mitchell Stokes 2017-01-03 20:17:12 -08:00
parent 5af7136aa2
commit 6b92d349c9
1 changed files with 12 additions and 0 deletions

View File

@ -57,12 +57,20 @@ class build(distutils.command.build.build):
distutils.dir_util.remove_tree(builddir)
distutils.dir_util.mkpath(builddir)
whldir = os.path.join(self.build_base, '__whl_cache__')
if os.path.exists(whldir):
distutils.dir_util.remove_tree(whldir)
if whl is not None:
whlfile = zipfile.ZipFile(whl)
stub_path = 'panda3d_tools/deploy-stub'
if platform.startswith('win'):
stub_path += '.exe'
stub_file = whlfile.open(stub_path)
# Add whl files to the path so they are picked up by modulefinder
whlfile.extractall(whldir)
sys.path.insert(0, whldir)
else:
dtool_path = p3d.Filename(p3d.ExecutionEnvironment.get_dtool_name()).to_os_specific()
stub_path = os.path.join(os.path.dirname(dtool_path), '..', 'bin', 'deploy-stub')
@ -158,6 +166,10 @@ class build(distutils.command.build.build):
dst = builddir
distutils.file_util.copy_file(src, dst)
# Cleanup whl directory
if os.path.exists(whldir):
distutils.dir_util.remove_tree(whldir)
class bdist_panda3d(distutils.core.Command):
user_options = []