瀏覽代碼

cleanup temp files

David Rose 16 年之前
父節點
當前提交
d16605943f
共有 3 個文件被更改,包括 16 次插入19 次删除
  1. 3 0
      direct/src/showutil/Packager.py
  2. 5 13
      direct/src/showutil/packp3d.py
  3. 8 6
      direct/src/showutil/runp3d.py

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

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

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

@@ -37,15 +37,8 @@ Options:
 
 
   -s search_dir
   -s search_dir
      Additional directories to search for previously-built packages.
      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
     pass
 
 
 def makePackedApp(args):
 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()
     packager = Packager.Packager()
 
 
     root = Filename('.')
     root = Filename('.')
     main = None
     main = None
     requires = []
     requires = []
-    versionIndependent = False
     
     
     for option, value in opts:
     for option, value in opts:
         if option == '-d':
         if option == '-d':
@@ -79,8 +71,6 @@ def makePackedApp(args):
             requires.append(value)
             requires.append(value)
         elif option == '-s':
         elif option == '-s':
             packager.installSearch.appendDirectory(Filename.fromOsSpecific(value))
             packager.installSearch.appendDirectory(Filename.fromOsSpecific(value))
-        elif option == '-x':
-            versionIndependent = True
         elif option == '-h':
         elif option == '-h':
             print __doc__ % (os.path.split(sys.argv[0])[1])
             print __doc__ % (os.path.split(sys.argv[0])[1])
             sys.exit(1)
             sys.exit(1)
@@ -96,6 +86,8 @@ def makePackedApp(args):
         raise ArgumentError, 'Application filename must end in ".p3d".'
         raise ArgumentError, 'Application filename must end in ".p3d".'
 
 
     appDir = Filename(appFilename.getDirname())
     appDir = Filename(appFilename.getDirname())
+    if not appDir:
+      appDir = Filename('.')
     appBase = appFilename.getBasenameWoExtension()
     appBase = appFilename.getBasenameWoExtension()
 
 
     if not main:
     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.
         # may have to be different for each instance.
         self.multifileRoot = '/mf'
         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
         # By default, we publish a stop() method so the browser can
         # easy stop the plugin.
         # easy stop the plugin.
-        self.attributes.stop = self.stop
+        self.main.stop = self.stop
 
 
         # This will be the browser's toplevel window DOM object;
         # This will be the browser's toplevel window DOM object;
         # e.g. self.dom.document will be the document.
         # 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
         """ Called by the browser to query the Panda instance's
         toplevel scripting object, for querying properties in the
         toplevel scripting object, for querying properties in the
         Panda instance.  The attributes on this object are mapped to
         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):
     def setBrowserScriptObject(self, dom):
         """ Called by the browser to supply the browser's toplevel DOM
         """ Called by the browser to supply the browser's toplevel DOM