diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2011-02-18 12:39:15 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2011-02-18 12:39:15 +0300 |
commit | 708df39935adfcfc35c6996133f8e5ea1912f4df (patch) | |
tree | d5ca60dc1e3e9fcbc3c93b5d60e20f3272c2aa06 /build_files | |
parent | 063a7f217be43718a69f6cbcfcf322ca71bdeeb0 (diff) |
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.
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/scons/tools/btools.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 1d716f9a093..6eb987db37b 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -568,3 +568,24 @@ def NSIS_Installer(target=None, source=None, env=None): 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 |