deploy-ng: Correctly add deploy_libs to sys.path

Now modulefinder will pick up on the Python stdlib C extension modules
in the panda3d whl, and no special path hacks are required.
This commit is contained in:
Mitchell Stokes 2017-01-07 10:19:04 -08:00
parent 40c23e5cf1
commit fff8c82d7c

View File

@ -44,12 +44,6 @@ def find_packages(whlfile):
return [i for i in filelist if '.so.' in i or i.endswith('.dll') or i.endswith('.dylib') or 'libpandagl' in i]
def get_python_ext_module_dir():
import cmath
import inspect
return os.path.dirname(inspect.getfile(cmath))
class build(distutils.command.build.build):
def run(self):
distutils.command.build.build.run(self)
@ -95,6 +89,10 @@ class build(distutils.command.build.build):
for whl in wheelpaths:
sys.path.insert(0, whl)
# Add deploy_libs from panda3d whl to the path
sys.path.insert(0, os.path.join(p3dwhlfn, 'deploy_libs'))
# Create runtime
freezer_extras = set()
freezer_modules = set()
@ -141,10 +139,6 @@ class build(distutils.command.build.build):
parts = parts[:-2] + parts[-1:]
basename = '.'.join(parts)
if use_wheels and source_path.startswith(get_python_ext_module_dir()):
# Look in panda3d whl instead
source_path = source_path.replace(get_python_ext_module_dir(), '{}/deploy_libs'.format(p3dwhlfn))
target_path = os.path.join(builddir, basename)
if '.whl/' in source_path:
# This was found in a wheel, extract it