[PATCH] D67822: [LNT] Python 3 support: adapt to removal of execfile
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 20 01:42:37 PDT 2019
thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D67821: [LNT] Python 3 support: use Python 2's division behavior.
Replace calls to execfile by calling exec on the result of calling
compile on the result of calling open().read().
https://reviews.llvm.org/D67822
Files:
lnt/server/db/migrate.py
lnt/server/db/rules_manager.py
Index: lnt/server/db/rules_manager.py
===================================================================
--- lnt/server/db/rules_manager.py
+++ lnt/server/db/rules_manager.py
@@ -66,7 +66,7 @@
global HOOKS_LOADED
for name, path in list(load_rules().items()):
globals = {}
- execfile(path, globals)
+ exec(compile(open(path).read(), path, 'exec'), globals)
DESCRIPTIONS[name] = globals['__doc__']
for hook_name in list(HOOKS.keys()):
if hook_name in globals:
Index: lnt/server/db/migrate.py
===================================================================
--- lnt/server/db/migrate.py
+++ lnt/server/db/migrate.py
@@ -162,7 +162,8 @@
upgrade_script = schema_migrations[db_version]
globals = {}
- execfile(upgrade_script, globals)
+ exec(compile(open(upgrade_script).read(), upgrade_script, 'exec'),
+ globals)
upgrade_method = globals['upgrade']
# Execute the upgrade.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67822.220981.patch
Type: text/x-patch
Size: 1002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/43ad1e38/attachment.bin>
More information about the llvm-commits
mailing list