Răsfoiți Sursa

cleanup temp files

David Rose 16 ani în urmă
părinte
comite
d16605943f

+ 3 - 0
direct/src/showutil/Packager.py

@@ -436,6 +436,7 @@ class Packager:
 
                 if tempFile.exists():
                     filenames = self.__parseDependenciesWindows(tempFile)
+                    tempFile.unlink()
                 if filenames is None:
                     print "Unable to determine dependencies from %s" % (file.filename)
                     continue
@@ -518,6 +519,7 @@ class Packager:
 
                 if tempFile.exists():
                     filenames = self.__parseDependenciesOSX(tempFile)
+                    tempFile.unlink()
                 if filenames is None:
                     print "Unable to determine dependencies from %s" % (file.filename)
                     continue
@@ -589,6 +591,7 @@ class Packager:
 
                 if tempFile.exists():
                     filenames = self.__parseDependenciesPosix(tempFile)
+                    tempFile.unlink()
                 if filenames is None:
                     print "Unable to determine dependencies from %s" % (file.filename)
                     continue

+ 5 - 13
direct/src/showutil/packp3d.py

@@ -37,15 +37,8 @@ Options:
 
   -s search_dir
      Additional directories to search for previously-built packages.
-     This option may be repeated as necessary.
-
-  -x
-     If this is specified, a version-independent application is built.
-     This stores source py files instead of compiled pyc files, and
-     egg files instead of bam files.  This application can then be run
-     with any version of Panda (provided you are careful not to make
-     any Python or Panda calls that are version-specific).  This is
-     not recommended except for very small, simple applications.
+     This option may be repeated as necessary.  These directories may
+     also be specified with the pdef-path Config.prc variable.
 
 """
 
@@ -61,14 +54,13 @@ class ArgumentError(StandardError):
     pass
 
 def makePackedApp(args):
-    opts, args = getopt.getopt(args, 'd:m:r:s:xh')
+    opts, args = getopt.getopt(args, 'd:m:r:s:h')
 
     packager = Packager.Packager()
 
     root = Filename('.')
     main = None
     requires = []
-    versionIndependent = False
     
     for option, value in opts:
         if option == '-d':
@@ -79,8 +71,6 @@ def makePackedApp(args):
             requires.append(value)
         elif option == '-s':
             packager.installSearch.appendDirectory(Filename.fromOsSpecific(value))
-        elif option == '-x':
-            versionIndependent = True
         elif option == '-h':
             print __doc__ % (os.path.split(sys.argv[0])[1])
             sys.exit(1)
@@ -96,6 +86,8 @@ def makePackedApp(args):
         raise ArgumentError, 'Application filename must end in ".p3d".'
 
     appDir = Filename(appFilename.getDirname())
+    if not appDir:
+      appDir = Filename('.')
     appBase = appFilename.getBasenameWoExtension()
 
     if not main:

+ 8 - 6
direct/src/showutil/runp3d.py

@@ -72,13 +72,14 @@ class AppRunner(DirectObject):
         # may have to be different for each instance.
         self.multifileRoot = '/mf'
 
-        # The attributes of this object will be exposed as attributes
-        # of the plugin instance in the DOM.
-        self.attributes = ScriptAttributes()
+        # The "main" object will be exposed to the DOM as a property
+        # of the plugin object; that is, document.pluginobject.main in
+        # JavaScript will be appRunner.main here.
+        self.main = ScriptAttributes()
 
         # By default, we publish a stop() method so the browser can
         # easy stop the plugin.
-        self.attributes.stop = self.stop
+        self.main.stop = self.stop
 
         # This will be the browser's toplevel window DOM object;
         # e.g. self.dom.document will be the document.
@@ -233,8 +234,9 @@ class AppRunner(DirectObject):
         """ Called by the browser to query the Panda instance's
         toplevel scripting object, for querying properties in the
         Panda instance.  The attributes on this object are mapped to
-        the plugin instance within the DOM. """
-        return self.attributes
+        document.pluginobject.main within the DOM. """
+
+        return self.main
 
     def setBrowserScriptObject(self, dom):
         """ Called by the browser to supply the browser's toplevel DOM