Browse Source

Don't try to load envvars / prc files in emscripten, fixes warnings in JavaScript console

rdb 10 years ago
parent
commit
7b4fdd8dbe

+ 3 - 0
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -519,6 +519,9 @@ read_environment_variables() {
       _variables[variable] = value;
       _variables[variable] = value;
     }
     }
   }
   }
+#elif defined(__EMSCRIPTEN__)
+  // Emscripten has no environment vars.  Don't even try.
+
 #elif defined(HAVE_PROC_SELF_ENVIRON)
 #elif defined(HAVE_PROC_SELF_ENVIRON)
   // In some cases, we may have a file called /proc/self/environ
   // In some cases, we may have a file called /proc/self/environ
   // that may be read to determine all of our environment variables.
   // that may be read to determine all of our environment variables.

+ 17 - 3
dtool/src/prc/configPageManager.cxx

@@ -104,6 +104,7 @@ reload_implicit_pages() {
   // spaces.  Pull them out and store them in _prc_patterns.
   // spaces.  Pull them out and store them in _prc_patterns.
   _prc_patterns.clear();
   _prc_patterns.clear();
 
 
+#ifdef PRC_PATTERNS
   string prc_patterns = PRC_PATTERNS;
   string prc_patterns = PRC_PATTERNS;
   if (!prc_patterns.empty()) {
   if (!prc_patterns.empty()) {
     vector_string pat_list;
     vector_string pat_list;
@@ -119,10 +120,12 @@ reload_implicit_pages() {
       _prc_patterns.push_back(glob);
       _prc_patterns.push_back(glob);
     }
     }
   }
   }
+#endif  // PRC_PATTERNS
 
 
   // Similarly for PRC_ENCRYPTED_PATTERNS.
   // Similarly for PRC_ENCRYPTED_PATTERNS.
   _prc_encrypted_patterns.clear();
   _prc_encrypted_patterns.clear();
 
 
+#ifdef PRC_ENCRYPTED_PATTERNS
   string prc_encrypted_patterns = PRC_ENCRYPTED_PATTERNS;
   string prc_encrypted_patterns = PRC_ENCRYPTED_PATTERNS;
   if (!prc_encrypted_patterns.empty()) {
   if (!prc_encrypted_patterns.empty()) {
     vector_string pat_list;
     vector_string pat_list;
@@ -136,10 +139,12 @@ reload_implicit_pages() {
       _prc_encrypted_patterns.push_back(glob);
       _prc_encrypted_patterns.push_back(glob);
     }
     }
   }
   }
+#endif  // PRC_ENCRYPTED_PATTERNS
 
 
   // And again for PRC_EXECUTABLE_PATTERNS.
   // And again for PRC_EXECUTABLE_PATTERNS.
   _prc_executable_patterns.clear();
   _prc_executable_patterns.clear();
 
 
+#ifdef PRC_EXECUTABLE_PATTERNS
   string prc_executable_patterns = PRC_EXECUTABLE_PATTERNS;
   string prc_executable_patterns = PRC_EXECUTABLE_PATTERNS;
   if (!prc_executable_patterns.empty()) {
   if (!prc_executable_patterns.empty()) {
     vector_string pat_list;
     vector_string pat_list;
@@ -153,6 +158,7 @@ reload_implicit_pages() {
       _prc_executable_patterns.push_back(glob);
       _prc_executable_patterns.push_back(glob);
     }
     }
   }
   }
+#endif  // PRC_EXECUTABLE_PATTERNS
 
 
   // Now build up the search path for .prc files.
   // Now build up the search path for .prc files.
   _search_path.clear();
   _search_path.clear();
@@ -160,6 +166,7 @@ reload_implicit_pages() {
   // PRC_DIR_ENVVARS lists one or more environment variables separated
   // PRC_DIR_ENVVARS lists one or more environment variables separated
   // by spaces.  Pull them out, and each of those contains the name of
   // by spaces.  Pull them out, and each of those contains the name of
   // a single directory to search.  Add it to the search path.
   // a single directory to search.  Add it to the search path.
+#ifdef PRC_DIR_ENVVARS
   string prc_dir_envvars = PRC_DIR_ENVVARS;
   string prc_dir_envvars = PRC_DIR_ENVVARS;
   if (!prc_dir_envvars.empty()) {
   if (!prc_dir_envvars.empty()) {
     vector_string prc_dir_envvar_list;
     vector_string prc_dir_envvar_list;
@@ -175,11 +182,13 @@ reload_implicit_pages() {
       }
       }
     }
     }
   }
   }
-  
+#endif  // PRC_DIR_ENVVARS
+
   // PRC_PATH_ENVVARS lists one or more environment variables separated
   // PRC_PATH_ENVVARS lists one or more environment variables separated
   // by spaces.  Pull them out, and then each one of those contains a
   // by spaces.  Pull them out, and then each one of those contains a
   // list of directories to search.  Add each of those to the search
   // list of directories to search.  Add each of those to the search
   // path.
   // path.
+#ifdef PRC_PATH_ENVVARS
   string prc_path_envvars = PRC_PATH_ENVVARS;
   string prc_path_envvars = PRC_PATH_ENVVARS;
   if (!prc_path_envvars.empty()) {
   if (!prc_path_envvars.empty()) {
     vector_string prc_path_envvar_list;
     vector_string prc_path_envvar_list;
@@ -201,7 +210,8 @@ reload_implicit_pages() {
       }
       }
     }
     }
   }
   }
-  
+#endif  // PRC_PATH_ENVVARS
+
   // PRC_PATH2_ENVVARS is a special variable that is rarely used; it
   // PRC_PATH2_ENVVARS is a special variable that is rarely used; it
   // exists primarily to support the Cygwin-based "ctattach" tools
   // exists primarily to support the Cygwin-based "ctattach" tools
   // used by the Walt Disney VR Studio.  This defines a set of
   // used by the Walt Disney VR Studio.  This defines a set of
@@ -210,6 +220,7 @@ reload_implicit_pages() {
   // Panda-style filenames, not Windows-style filenames; and the path
   // Panda-style filenames, not Windows-style filenames; and the path
   // separator is always a space character, regardless of
   // separator is always a space character, regardless of
   // DEFAULT_PATHSEP.
   // DEFAULT_PATHSEP.
+#ifdef PRC_PATH2_ENVVARS
   string prc_path2_envvars = PRC_PATH2_ENVVARS;
   string prc_path2_envvars = PRC_PATH2_ENVVARS;
   if (!prc_path2_envvars.empty()) {
   if (!prc_path2_envvars.empty()) {
     vector_string prc_path_envvar_list;
     vector_string prc_path_envvar_list;
@@ -230,7 +241,9 @@ reload_implicit_pages() {
       }
       }
     }
     }
   }
   }
-  
+#endif  // PRC_PATH2_ENVVARS
+
+#ifdef DEFAULT_PRC_DIR
   if (_search_path.is_empty()) {
   if (_search_path.is_empty()) {
     // If nothing's on the search path (PRC_DIR and PRC_PATH were not
     // If nothing's on the search path (PRC_DIR and PRC_PATH were not
     // defined), then use the DEFAULT_PRC_DIR.
     // defined), then use the DEFAULT_PRC_DIR.
@@ -243,6 +256,7 @@ reload_implicit_pages() {
       }
       }
     }
     }
   }
   }
+#endif  // DEFAULT_PRC_DIR
 
 
   // Now find all of the *.prc files (or whatever matches
   // Now find all of the *.prc files (or whatever matches
   // PRC_PATTERNS) on the path.
   // PRC_PATTERNS) on the path.

+ 10 - 2
makepanda/makepanda.py

@@ -2253,11 +2253,11 @@ PRC_PARAMETERS=[
     ("DEFAULT_PRC_DIR",                '"<auto>etc"',            '"<auto>etc"'),
     ("DEFAULT_PRC_DIR",                '"<auto>etc"',            '"<auto>etc"'),
     ("PRC_DIR_ENVVARS",                '"PANDA_PRC_DIR"',        '"PANDA_PRC_DIR"'),
     ("PRC_DIR_ENVVARS",                '"PANDA_PRC_DIR"',        '"PANDA_PRC_DIR"'),
     ("PRC_PATH_ENVVARS",               '"PANDA_PRC_PATH"',       '"PANDA_PRC_PATH"'),
     ("PRC_PATH_ENVVARS",               '"PANDA_PRC_PATH"',       '"PANDA_PRC_PATH"'),
-    ("PRC_PATH2_ENVVARS",              '""',                     '""'),
+    ("PRC_PATH2_ENVVARS",              'UNDEF',                  'UNDEF'),
     ("PRC_PATTERNS",                   '"*.prc"',                '"*.prc"'),
     ("PRC_PATTERNS",                   '"*.prc"',                '"*.prc"'),
     ("PRC_ENCRYPTED_PATTERNS",         '"*.prc.pe"',             '"*.prc.pe"'),
     ("PRC_ENCRYPTED_PATTERNS",         '"*.prc.pe"',             '"*.prc.pe"'),
     ("PRC_ENCRYPTION_KEY",             '""',                     '""'),
     ("PRC_ENCRYPTION_KEY",             '""',                     '""'),
-    ("PRC_EXECUTABLE_PATTERNS",        '""',                     '""'),
+    ("PRC_EXECUTABLE_PATTERNS",        'UNDEF',                  'UNDEF'),
     ("PRC_EXECUTABLE_ARGS_ENVVAR",     '"PANDA_PRC_XARGS"',      '"PANDA_PRC_XARGS"'),
     ("PRC_EXECUTABLE_ARGS_ENVVAR",     '"PANDA_PRC_XARGS"',      '"PANDA_PRC_XARGS"'),
     ("PRC_PUBLIC_KEYS_FILENAME",       '""',                     '""'),
     ("PRC_PUBLIC_KEYS_FILENAME",       '""',                     '""'),
     ("PRC_RESPECT_TRUST_LEVEL",        'UNDEF',                  'UNDEF'),
     ("PRC_RESPECT_TRUST_LEVEL",        'UNDEF',                  'UNDEF'),
@@ -2349,6 +2349,14 @@ def WriteConfigSettings():
         dtool_config["HAVE_NET"] = 'UNDEF'
         dtool_config["HAVE_NET"] = 'UNDEF'
         dtool_config["LINK_ALL_STATIC"] = '1'
         dtool_config["LINK_ALL_STATIC"] = '1'
 
 
+        # There are no environment vars either, or default prc files.
+        prc_parameters["DEFAULT_PRC_DIR"] = 'UNDEF'
+        prc_parameters["PRC_DIR_ENVVARS"] = 'UNDEF'
+        prc_parameters["PRC_PATH_ENVVARS"] = 'UNDEF'
+        prc_parameters["PRC_PATH2_ENVVARS"] = 'UNDEF'
+        prc_parameters["PRC_PATTERNS"] = 'UNDEF'
+        prc_parameters["PRC_ENCRYPTED_PATTERNS"] = 'UNDEF'
+
     if (GetOptimize() <= 2 and GetTarget() == "windows"):
     if (GetOptimize() <= 2 and GetTarget() == "windows"):
         dtool_config["USE_DEBUG_PYTHON"] = '1'
         dtool_config["USE_DEBUG_PYTHON"] = '1'