Quellcode durchsuchen

minor fixes to reduce startup noise

David Rose vor 16 Jahren
Ursprung
Commit
c4e79695e9
2 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen
  1. 10 0
      direct/src/plugin/p3dPythonRun.cxx
  2. 3 1
      direct/src/showutil/runp3d.py

+ 10 - 0
direct/src/plugin/p3dPythonRun.cxx

@@ -42,6 +42,16 @@ P3DPythonRun(int argc, char *argv[]) {
   _py_argv[0] = argv[0];
   _py_argv[1] = NULL;
 
+#ifdef NDEBUG
+  // In OPTIMIZE 4 compilation mode, run Python in optimized mode too.
+  extern int Py_OptimizeFlag;
+  Py_OptimizeFlag = 2;
+#endif
+
+  // Turn off the automatic load of site.py at startup.
+  extern int Py_NoSiteFlag;
+  Py_NoSiteFlag = 1;
+
   // Initialize Python.  It appears to be important to do this before
   // we open the pipe streams and spawn the thread, below.
   Py_SetProgramName((char *)_program_name.c_str());

+ 3 - 1
direct/src/showutil/runp3d.py

@@ -158,7 +158,9 @@ class AppRunner(DirectObject):
             # vfs right now; careless application code can still write
             # to these directories inadvertently.
             for dirname in sys.path:
-                vfs.mount(dirname, dirname, vfs.MFReadOnly)
+                dirname = Filename.fromOsSpecific(dirname)
+                if dirname.isDirectory():
+                    vfs.mount(dirname, dirname, vfs.MFReadOnly)
 
             # Also mount some standard directories read-write
             # (temporary and app-data directories).