diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-02-26 19:13:09 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-02-26 19:13:09 -0500 |
commit | df7d3ce735c3c1f62e95454c6e3b9d4026c3c02e (patch) | |
tree | 74350f12d6da1d71f4dc0867cf3069c83b0712a7 /tools/shared.py | |
parent | 58af9770c7e38daedfd8f088995a4657f835fd68 (diff) |
clean up response file code
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tools/shared.py b/tools/shared.py index 6cd28401..1d189cc6 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -814,22 +814,23 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e if DEBUG: print >>sys.stderr, 'emcc: llvm-linking:', actual_files # check for too-long command line - linkcmd = [LLVM_LINK] + actual_files + ['-o', target] + link_cmd = [LLVM_LINK] + actual_files + ['-o', target] # 8k is a bit of an arbitrary limit, but a reasonable one # for max command line size before we use a respose file - responseFile = None - if len(" ".join(linkcmd)) > 8192: - [responseFD, responseFile] = mkstemp(suffix='.response', dir=TEMP_DIR) - responseFH = os.fdopen(responseFD, 'w') + response_file = None + if len(' '.join(link_cmd)) > 8192: + if DEBUG: print >>sys.stderr, 'using response file for llvm-link' + [response_fd, response_file] = mkstemp(suffix='.response', dir=TEMP_DIR) + response_fh = os.fdopen(response_fd, 'w') for arg in actual_files: - responseFH.write(arg + "\n") - responseFH.close() - linkcmd = [LLVM_LINK, "@" + responseFile, '-o', target] + response_fh.write(arg + "\n") + response_fh.close() + link_cmd = [LLVM_LINK, "@" + response_file, '-o', target] - output = Popen(linkcmd, stdout=PIPE).communicate()[0] + output = Popen(link_cmd, stdout=PIPE).communicate()[0] - if responseFile: - os.unlink(responseFile) + if response_file: + os.unlink(response_file) assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output for temp_dir in temp_dirs: |