[LNT] r374687 - [LNT] Python 3 support: adapt to removal of execfile

Thomas Preud'homme via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 12 15:53:51 PDT 2019


Author: thopre
Date: Sat Oct 12 15:53:51 2019
New Revision: 374687

URL: http://llvm.org/viewvc/llvm-project?rev=374687&view=rev
Log:
[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

Modified:
    lnt/trunk/lnt/server/db/migrate.py
    lnt/trunk/lnt/server/db/rules_manager.py

Modified: lnt/trunk/lnt/server/db/migrate.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrate.py?rev=374687&r1=374686&r2=374687&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/migrate.py (original)
+++ lnt/trunk/lnt/server/db/migrate.py Sat Oct 12 15:53:51 2019
@@ -162,7 +162,8 @@ def update_schema(engine, versions, avai
         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.

Modified: lnt/trunk/lnt/server/db/rules_manager.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/rules_manager.py?rev=374687&r1=374686&r2=374687&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/rules_manager.py (original)
+++ lnt/trunk/lnt/server/db/rules_manager.py Sat Oct 12 15:53:51 2019
@@ -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:




More information about the llvm-commits mailing list