allow receiving a list of arguments in emscripten.py's external interface

This commit is contained in:
Alon Zakai 2015-08-19 19:17:41 -07:00
Родитель 77562dfc99
Коммит 68b3d37153
1 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -982,17 +982,20 @@ def main(args, compiler_engine, cache, temp_files, DEBUG, DEBUG_CACHE):
emscript(args.infile, settings, args.outfile, libraries, compiler_engine=compiler_engine, emscript(args.infile, settings, args.outfile, libraries, compiler_engine=compiler_engine,
temp_files=temp_files, DEBUG=DEBUG, DEBUG_CACHE=DEBUG_CACHE) temp_files=temp_files, DEBUG=DEBUG, DEBUG_CACHE=DEBUG_CACHE)
def _main(environ): def _main(environ, args=None):
if args is None:
args = sys.argv[1:]
response_file = True response_file = True
while response_file: while response_file:
response_file = None response_file = None
for index in range(1, len(sys.argv)): for index in range(len(args)):
if sys.argv[index][0] == '@': if args[index][0] == '@':
# found one, loop again next time # found one, loop again next time
response_file = True response_file = True
response_file_args = read_response_file(sys.argv[index]) response_file_args = read_response_file(args[index])
# slice in extra_args in place of the response file arg # slice in extra_args in place of the response file arg
sys.argv[index:index+1] = response_file_args args[index:index+1] = response_file_args
break break
parser = optparse.OptionParser( parser = optparse.OptionParser(
@ -1038,7 +1041,7 @@ def _main(environ):
help=('Suppress usage warning')) help=('Suppress usage warning'))
# Convert to the same format that argparse would have produced. # Convert to the same format that argparse would have produced.
keywords, positional = parser.parse_args() keywords, positional = parser.parse_args(args)
if not keywords.suppressUsageWarning: if not keywords.suppressUsageWarning:
logging.warning(''' logging.warning('''