aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-01-28 18:21:43 -0800
committerChad Austin <chad@imvu.com>2013-03-04 19:01:45 -0800
commitb32d0644551903091ad873b52fe9de920ea07020 (patch)
tree19cadd8c77c81fc1f54a1e731dd01e21f71a9d0c
parent531931628897969a228c83f136d231599f486a70 (diff)
Add command line option to emscripten.py to suppress usage warning
-rwxr-xr-xemscripten.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/emscripten.py b/emscripten.py
index 1fc0eed2..a817ade3 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -11,13 +11,6 @@ headers, for the libc implementation in JS).
import os, sys, json, optparse, subprocess, re, time, multiprocessing
-if not os.environ.get('EMSCRIPTEN_SUPPRESS_USAGE_WARNING'):
- print >> sys.stderr, '''
-==============================================================
-WARNING: You should normally never use this! Use emcc instead.
-==============================================================
- '''
-
from tools import shared
DEBUG = os.environ.get('EMCC_DEBUG')
@@ -575,7 +568,7 @@ def main(args):
emscript(args.infile, settings, args.outfile, libraries)
-def _main():
+def _main(environ):
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. '
@@ -606,9 +599,21 @@ def _main():
action='store_true',
default=False,
help=('Enable jcache (ccache-like caching of compilation results, for faster incremental builds).'))
+ parser.add_option('--suppressUsageWarning',
+ action='store_true',
+ default=environ.get('EMSCRIPTEN_SUPPRESS_USAGE_WARNING'),
+ help=('Suppress usage warning'))
# Convert to the same format that argparse would have produced.
keywords, positional = parser.parse_args()
+
+ if not keywords.suppressUsageWarning:
+ print >> sys.stderr, '''
+==============================================================
+WARNING: You should normally never use this! Use emcc instead.
+==============================================================
+ '''
+
if len(positional) != 1:
raise RuntimeError('Must provide exactly one positional argument.')
keywords.infile = os.path.abspath(positional[0])
@@ -620,4 +625,4 @@ def _main():
temp_files.run_and_clean(lambda: main(keywords))
if __name__ == '__main__':
- _main()
+ _main(environ=os.environ)