aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-20 20:26:16 +0200
committerAlon Zakai <alonzakai@gmail.com>2012-05-20 20:26:16 +0200
commitc6de9619dac086caf56803141202e9ff8354b259 (patch)
tree58760fafe8edba3ebf12de07eeb119f74ad7990b /tools/shared.py
parent8b86272a3c1dea44c5fadc80965d3ecdcb239bd5 (diff)
handle absolute paths in .a files
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/shared.py b/tools/shared.py
index aa8e8992..00ed25de 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -528,13 +528,12 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
if not os.path.exists('ar_output'):
os.makedirs('ar_output')
os.chdir('ar_output')
- Popen([LLVM_AR, 'x', f], stdout=PIPE).communicate()
- added = False
- for name in os.listdir(os.getcwd()):
- actual_files.append(os.path.join(EMSCRIPTEN_TEMP_DIR, 'ar_output', name))
- added = True
- if not added:
- print >> sys.stderr, 'Warning: Archive %s appears to be empty' % f
+ contents = filter(lambda x: len(x) > 0, Popen([LLVM_AR, 't', f], stdout=PIPE).communicate()[0].split('\n'))
+ if len(contents) == 0:
+ print >> sys.stderr, 'Warning: Archive %s appears to be empty (recommendation: link an .so instead of .a)' % f
+ else:
+ Popen([LLVM_AR, 'x', f], stdout=PIPE).communicate() # if absolute paths, files will appear there. otherwise, in this directory
+ actual_files += map(os.path.abspath, contents)
finally:
os.chdir(cwd)
else: