Selaa lähdekoodia

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

Mitchell Stokes 9 vuotta sitten
vanhempi
sitoutus
6b92d349c9
1 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 12 0
      direct/src/showutil/dist.py

+ 12 - 0
direct/src/showutil/dist.py

@@ -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 = []