kripken/emscripten — pull request #198 by ehsan (2012-01-30 22:33:55+00:00)
Title: Import shared.py properly

I've noticed that I get stack traces like this:

Traceback (most recent call last):
File "./tests/runner.py", line 4342, in test_openjpeg
make_args=[]) # no -j 2, since parallel builds can fail
File "./tests/runner.py", line 250, in get_library
copy_project=True)
File "", line 417, in build_library
File "", line 427, in link
AssertionError: Linking error:

The last two frames could be more descriptive. Asking around some Python hackers, apparently you're supposed to use import to include code, like exec(open(foo).read()).

This patch changes all places where we import shared.py to use the better way of doing things. With this, I get stack traces like:

Traceback (most recent call last):
File "./tests/runner.py", line 4343, in test_openjpeg
make_args=[]) # no -j 2, since parallel builds can fail
File "./tests/runner.py", line 251, in get_library
copy_project=True)
File "/Users/ehsanakhgari/moz/emscripten/tools/shared.py", line 417, in build_library
Building.link(generated_libs, bc_file)
File "/Users/ehsanakhgari/moz/emscripten/tools/shared.py", line 427, in link
assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
AssertionError: Linking error:

This is way nicer than what we have today!