aboutsummaryrefslogtreecommitdiff
path: root/emlink.py
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-11-15 13:33:35 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-11-15 13:33:35 +0200
commita30bd539fef6ced02bfa83f87b9a8e3f36a7fa97 (patch)
tree6aa93a67f36b4fed8ddfbe203b8799c2a4417461 /emlink.py
parent149b9ea5747d610d2ebfb41bc87e8bb96f498359 (diff)
Make emlink.py import-safe. Fixes an issue where python multiprocessing.py enters an infinite loop throwing errors 'Attempt to start a new process before the current process has finished its bootstrapping phase.' when running other.test_static_link. See http://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing .
Diffstat (limited to 'emlink.py')
-rw-r--r--emlink.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/emlink.py b/emlink.py
index 7311f84a..f767ce58 100644
--- a/emlink.py
+++ b/emlink.py
@@ -10,21 +10,24 @@ import sys
from tools import shared
from tools.asm_module import AsmModule
-try:
- me, main, side, out = sys.argv[:4]
-except:
- print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
- sys.exit(1)
+def run():
+ try:
+ me, main, side, out = sys.argv[:4]
+ except:
+ print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
+ sys.exit(1)
-print 'Main module:', main
-print 'Side module:', side
-print 'Output:', out
+ print 'Main module:', main
+ print 'Side module:', side
+ print 'Output:', out
-shared.try_delete(out)
+ shared.try_delete(out)
-main = AsmModule(main)
-side = AsmModule(side)
+ main = AsmModule(main)
+ side = AsmModule(side)
-side.relocate_into(main)
-main.write(out)
+ side.relocate_into(main)
+ main.write(out)
+if __name__ == '__main__':
+ run()