Skip to content

Commit 4f27141

Browse files
author
Thomas Preud'homme
committed
[LNT] Python 3 support: adapt to removal of execfile
Replace calls to execfile by calling exec on the result of calling compile on the result of calling open().read(). Reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls Reviewed By: hubert.reinterpretcast Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D67822 llvm-svn: 374687
1 parent f805c3e commit 4f27141

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lnt/server/db/migrate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def update_schema(engine, versions, available_migrations, schema_name):
162162
upgrade_script = schema_migrations[db_version]
163163

164164
globals = {}
165-
execfile(upgrade_script, globals)
165+
exec(compile(open(upgrade_script).read(), upgrade_script, 'exec'),
166+
globals)
166167
upgrade_method = globals['upgrade']
167168

168169
# Execute the upgrade.

lnt/server/db/rules_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def register_hooks():
6666
global HOOKS_LOADED
6767
for name, path in load_rules().items():
6868
globals = {}
69-
execfile(path, globals)
69+
exec(compile(open(path).read(), path, 'exec'), globals)
7070
DESCRIPTIONS[name] = globals['__doc__']
7171
for hook_name in HOOKS.keys():
7272
if hook_name in globals:

0 commit comments

Comments
 (0)