[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34956] trunk/blender: Check the os. environ at the start of the build process.

Nathan Letwory nathan at letworyinteractive.com
Fri Feb 18 10:39:16 CET 2011


Revision: 34956
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34956
Author:   jesterking
Date:     2011-02-18 09:39:15 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
Check the os.environ at the start of the build process.
Print any variable that contains a value with non-ascii
characters, then abort build.

Modified Paths:
--------------
    trunk/blender/SConstruct
    trunk/blender/build_files/scons/tools/btools.py

Modified: trunk/blender/SConstruct
===================================================================
--- trunk/blender/SConstruct	2011-02-18 08:49:11 UTC (rev 34955)
+++ trunk/blender/SConstruct	2011-02-18 09:39:15 UTC (rev 34956)
@@ -60,6 +60,10 @@
 
 EnsureSConsVersion(1,0,0)
 
+# Before we do anything, let's check if we have a sane os.environ
+if not btools.check_environ():
+    Exit()
+
 BlenderEnvironment = Blender.BlenderEnvironment
 B = Blender
 

Modified: trunk/blender/build_files/scons/tools/btools.py
===================================================================
--- trunk/blender/build_files/scons/tools/btools.py	2011-02-18 08:49:11 UTC (rev 34955)
+++ trunk/blender/build_files/scons/tools/btools.py	2011-02-18 09:39:15 UTC (rev 34956)
@@ -568,3 +568,24 @@
         print data.strip().split("\n")[-1]
     return rv
 
+def check_environ():
+    problematic_envvars = ""
+    for i in os.environ:
+        try:
+            os.environ[i].decode('ascii')
+        except UnicodeDecodeError:
+            problematic_envvars = problematic_envvars + "%s = %s\n" % (i, os.environ[i])
+    if len(problematic_envvars)>0:
+        print("================\n\n")
+        print("@@ ABORTING BUILD @@\n")
+        print("PROBLEM DETECTED WITH ENVIRONMENT")
+        print("---------------------------------\n\n")
+        print("A problem with one or more environment variable was found")
+        print("Their value contain non-ascii characters. Check the below")
+        print("list and override them locally to be ASCII-clean by doing")
+        print("'set VARNAME=cleanvalue' on the command-line prior to")
+        print("starting the build process:\n")
+        print(problematic_envvars)
+        return False
+    else:
+        return True




More information about the Bf-blender-cvs mailing list