Change the exec call used by paster script cmd, to preserve the filename (helps when running coverage.py on a paster script cmd)
diff --git a/Allura/allura/command/script.py b/Allura/allura/command/script.py
index fd59d82..488ac79 100644
--- a/Allura/allura/command/script.py
+++ b/Allura/allura/command/script.py
@@ -60,14 +60,15 @@
if self.options.pdb:
base.log.info('Installing exception hook')
sys.excepthook = utils.postmortem_hook
- with open(self.args[1]) as fp:
+ filename = self.args[1]
+ with open(filename) as fp:
ns = dict(__name__='__main__')
sys.argv = self.args[1:]
if self.options.profile:
- cProfile.run(fp, '%s.profile' %
- os.path.basename(self.args[1]))
+ cProfile.run(fp.read(), '%s.profile' %
+ os.path.basename(filename))
else:
- exec(fp.read(), ns)
+ exec(compile(fp.read(), filename, 'exec'), ns)
class SetToolAccessCommand(base.Command):