aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-01-28 18:08:22 -0800
committerChad Austin <chad@imvu.com>2013-03-04 19:01:45 -0800
commit531931628897969a228c83f136d231599f486a70 (patch)
treed3a0df347486be228637c7774a965bf085111916
parent8dc0e2b7deca6b366066a1b94fe31b7ba4a2b2d0 (diff)
Integrate azakai's style feedback and make sanity tests pass again.
-rwxr-xr-xemscripten.py7
-rw-r--r--tools/js_optimizer.py2
-rw-r--r--tools/shared.py15
3 files changed, 13 insertions, 11 deletions
diff --git a/emscripten.py b/emscripten.py
index 3ceb0c8e..1fc0eed2 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -32,7 +32,8 @@ def path_from_root(*pathelems):
"""
return os.path.join(__rootpath__, *pathelems)
-temp_files = shared.ConfigureTempFiles()
+configuration = shared.Configuration(environ=os.environ)
+temp_files = shared.make_temp_files()
compiler_engine = None
jcache = False
@@ -574,7 +575,7 @@ def main(args):
emscript(args.infile, settings, args.outfile, libraries)
-def main():
+def _main():
parser = optparse.OptionParser(
usage='usage: %prog [-h] [-H HEADERS] [-o OUTFILE] [-c COMPILER_ENGINE] [-s FOO=BAR]* infile',
description=('You should normally never use this! Use emcc instead. '
@@ -619,4 +620,4 @@ def main():
temp_files.run_and_clean(lambda: main(keywords))
if __name__ == '__main__':
- main()
+ _main()
diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py
index c1e800c3..533242b2 100644
--- a/tools/js_optimizer.py
+++ b/tools/js_optimizer.py
@@ -2,7 +2,7 @@
import os, sys, subprocess, multiprocessing, re
import shared
-temp_files = shared.ConfigureTempFiles()
+temp_files = shared.make_temp_files()
__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def path_from_root(*pathelems):
diff --git a/tools/shared.py b/tools/shared.py
index f46942e6..1005a48d 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -302,7 +302,7 @@ except:
CANONICAL_TEMP_DIR = os.path.join(TEMP_DIR, 'emscripten_temp')
class Configuration:
- def __init__(self, environ=os.environ):
+ def __init__(self, environ):
self.DEBUG = environ.get('EMCC_DEBUG')
self.EMSCRIPTEN_TEMP_DIR = None
@@ -314,7 +314,8 @@ class Configuration:
except Exception, e:
print >> sys.stderr, e, 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten'
-configuration = Configuration()
+configuration = Configuration(
+ environ=os.environ)
DEBUG = configuration.DEBUG
EMSCRIPTEN_TEMP_DIR = configuration.EMSCRIPTEN_TEMP_DIR
DEBUG_CACHE = DEBUG and "cache" in DEBUG
@@ -429,9 +430,9 @@ def try_delete(filename):
pass
class TempFiles:
- def __init__(self, tmp, saveDebugFiles=False):
+ def __init__(self, tmp, save_debug_files=False):
self.tmp = tmp
- self.saveDebugFiles = saveDebugFiles
+ self.save_debug_files = save_debug_files
self.to_clean = []
@@ -445,7 +446,7 @@ class TempFiles:
return named_file
def clean(self):
- if self.saveDebugFiles:
+ if self.save_debug_files:
print >> sys.stderr, 'not cleaning up temp files since in debug-save mode, see them in %s' % (self.tmp,)
return
for filename in self.to_clean:
@@ -458,10 +459,10 @@ class TempFiles:
finally:
self.clean()
-def ConfigureTempFiles(configuration=configuration):
+def make_temp_files(configuration=configuration):
return TempFiles(
tmp=TEMP_DIR if not configuration.DEBUG else configuration.EMSCRIPTEN_TEMP_DIR,
- saveDebugFiles=os.environ.get('EMCC_DEBUG_SAVE'))
+ save_debug_files=os.environ.get('EMCC_DEBUG_SAVE'))
# Utilities