Ver Fonte

minor fixes

David Rose há 16 anos atrás
pai
commit
b469a507a1
3 ficheiros alterados com 13 adições e 10 exclusões
  1. 4 2
      direct/src/p3d/PackageInfo.py
  2. 2 1
      direct/src/p3d/Packager.py
  3. 7 7
      direct/src/p3d/packp3d.py

+ 4 - 2
direct/src/p3d/PackageInfo.py

@@ -820,8 +820,6 @@ class PackageInfo:
         vfs = VirtualFileSystem.getGlobalPtr()
         vfs.mount(mf, root, vfs.MFReadOnly)
 
-        appRunner.loadMultifilePrcFiles(mf, root)
-
         # Add this to the Python search path, if it's not already
         # there.  We have to take a bit of care to check if it's
         # already there, since there can be some ambiguity in
@@ -851,6 +849,10 @@ class PackageInfo:
         envvar = '%s_ROOT' % (self.packageName.upper())
         ExecutionEnvironment.setEnvironmentVariable(envvar, self.packageDir.toOsSpecific())
 
+        # Now that the environment variable is set, read all of the
+        # prc files in the package.
+        appRunner.loadMultifilePrcFiles(mf, root)
+
         # Also, find any toplevel Python packages, and add these as
         # shared packages.  This will allow different packages
         # installed in different directories to share Python files as

+ 2 - 1
direct/src/p3d/Packager.py

@@ -352,7 +352,8 @@ class Packager:
                 self.compressionLevel = 6
 
                 # Every p3dapp requires panda3d.
-                self.packager.do_require('panda3d')
+                if 'panda3d' not in map(lambda p: p.packageName, self.requires):
+                    self.packager.do_require('panda3d')
 
                 # If this flag is set, enable allow_python_dev.
                 if self.packager.allowPythonDev:

+ 7 - 7
direct/src/p3d/packp3d.py

@@ -44,7 +44,7 @@ Options:
      Sets the indicated config flag in the application.  This option
      may be repeated as necessary.
 
-  -r package
+  -r package[,version[,hostURL]]
      Names an additional package that this application requires at
      startup time.  The default package is 'panda3d'; you may repeat
      this option to indicate dependencies on additional packages.
@@ -106,7 +106,11 @@ def makePackedApp(args):
         elif option == '-c':
             configFlags.append(value.split('=', 1))
         elif option == '-r':
-            requires.append(value)
+            tokens = value.split(',')
+            while len(tokens) < 3:
+                tokens.append('')
+            name, version, host = tokens[:3]
+            requires.append((name, version, host))
         elif option == '-s':
             packager.installSearch.appendDirectory(Filename.fromOsSpecific(value))
         elif option == '-D':
@@ -159,11 +163,7 @@ def makePackedApp(args):
     try:
         packager.setup()
         packager.beginPackage(appBase, p3dApplication = True)
-        for requireName in requires:
-            tokens = requireName.split(',')
-            while len(tokens) < 3:
-                tokens.append(None)
-            name, version, host = tokens
+        for name, version, host in requires:
             packager.do_require(name, version = version, host = host)
 
         if configFlags: