From eb0f4c41bf79ccaf2236b5aa37bb019c2af7a6b5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 26 Mar 2012 10:21:25 -0700 Subject: [PATCH] use shlex --- emcc | 6 +++--- tools/shared.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/emcc b/emcc index 8d966eb51..7e81f8309 100755 --- a/emcc +++ b/emcc @@ -74,7 +74,7 @@ emcc can be influenced by a few environment variables: EMMAKEN_COMPILER - The compiler to be used, if you don't want the default clang. ''' -import os, sys, shutil, tempfile, subprocess +import os, sys, shutil, tempfile, subprocess, shlex from subprocess import PIPE, STDOUT from tools import shared @@ -313,7 +313,7 @@ if os.environ.get('EMMAKEN_CXX'): CC_ADDITIONAL_ARGS = shared.COMPILER_OPTS # + ['-g']? EMMAKEN_CFLAGS = os.environ.get('EMMAKEN_CFLAGS') -if EMMAKEN_CFLAGS: CC_ADDITIONAL_ARGS += EMMAKEN_CFLAGS.split(' ') +if EMMAKEN_CFLAGS: CC_ADDITIONAL_ARGS += shlex.split(EMMAKEN_CFLAGS) # ---------------- Utilities --------------- @@ -945,7 +945,7 @@ try: shutil.copyfile(final, final + '.tr.js') final += '.tr.js' if DEBUG: print >> sys.stderr, 'emcc: applying transform: %s' % js_transform - execute(js_transform.split(' ') + [os.path.abspath(final)]) + execute(shlex.split(js_transform) + [os.path.abspath(final)]) if DEBUG: save_intermediate('transformed') # It is useful to run several js optimizer passes together, to save on unneeded unparsing/reparsing diff --git a/tools/shared.py b/tools/shared.py index 61ec912e4..3c76d73ef 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -1,4 +1,4 @@ -import shutil, time, os, sys, json, tempfile, copy +import shutil, time, os, sys, json, tempfile, copy, shlex from subprocess import Popen, PIPE, STDOUT from tempfile import mkstemp @@ -743,7 +743,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' \ #'--variable_map_output_file', filename + '.vars', '--js', filename, '--js_output_file', filename + '.cc.js'] if os.environ.get('EMCC_CLOSURE_ARGS'): - args += os.environ.get('EMCC_CLOSURE_ARGS').split(' ') + args += shlex.split(os.environ.get('EMCC_CLOSURE_ARGS')) process = Popen(args, stdout=PIPE, stderr=STDOUT) cc_output = process.communicate()[0] if process.returncode != 0 or not os.path.exists(filename + '.cc.js'):