Commit 9d37edfb authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Some python3 adaptions

parent 7ea14447
......@@ -163,11 +163,14 @@ class Importer:
BAD = None
try:
code = compile(src, "%s/%s" % (self.path, filename), 'exec')
exec code in mod.__dict__
except exceptions.SystemExit, e:
if sys.version_info < (3,):
exec("exec code in mod.__dict__")
else:
exec(code, mod.__dict__)
except SystemExit as e:
# Silently propagate exit
raise e
except Exception, e:
except Exception as e:
# Silently propagate other exceptions as well
BAD = sys.exc_info()
raise e
......@@ -204,18 +207,17 @@ def extract(dest='.'):
f = file(filepath, 'w')
f.write(c)
f.close()
os.chmod(filepath, 0755)
os.chmod(filepath, 0o755)
if __name__ == '__main__':
import sys
importer = Importer(code)
sys.path_hooks.append(importer)
import exceptions
import imp
try:
# This will start actual execution
importer.load_module("__main__")
except exceptions.SystemExit, e:
except SystemExit as e:
raise e
except:
if BAD:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment