This is an automated email from the ASF dual-hosted git repository.
kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 9d1956a Change the exec call used by paster script cmd, to preserve
the filename (helps when running coverage.py on a paster script cmd)
9d1956a is described below
commit 9d1956a10b6fc0617e594d003961a89e4d97c556
Author: Dave Brondsema <[email protected]>
AuthorDate: Mon May 17 11:18:25 2021 -0400
Change the exec call used by paster script cmd, to preserve the filename
(helps when running coverage.py on a paster script cmd)
---
Allura/allura/command/script.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
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 @@ class ScriptCommand(base.Command):
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):