diff options
author | Thomas Preud'homme <thomasp@graphcore.ai> | 2019-10-12 22:53:51 +0000 |
---|---|---|
committer | Thomas Preud'homme <thomasp@graphcore.ai> | 2019-10-12 22:53:51 +0000 |
commit | 446f9a3b651086e87684d643705273ef78045279 (patch) | |
tree | 8d4bba06c790d285f438d91cd62652b3ee12e6f9 | |
parent | 386ea9712d8067f8c974048355c05fda0c29ad80 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/lnt/trunk@374687 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lnt/server/db/migrate.py | 3 | ||||
-rw-r--r-- | lnt/server/db/rules_manager.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lnt/server/db/migrate.py b/lnt/server/db/migrate.py index e8c886c..b10b84e 100644 --- a/lnt/server/db/migrate.py +++ b/lnt/server/db/migrate.py @@ -162,7 +162,8 @@ def update_schema(engine, versions, available_migrations, schema_name): 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. diff --git a/lnt/server/db/rules_manager.py b/lnt/server/db/rules_manager.py index dfee2e7..1f254e2 100644 --- a/lnt/server/db/rules_manager.py +++ b/lnt/server/db/rules_manager.py @@ -66,7 +66,7 @@ def register_hooks(): global HOOKS_LOADED for name, path in load_rules().items(): globals = {} - execfile(path, globals) + exec(compile(open(path).read(), path, 'exec'), globals) DESCRIPTIONS[name] = globals['__doc__'] for hook_name in HOOKS.keys(): if hook_name in globals: |