[LNT] r371896 - [LNT] Python 3 support: Minor automatic 2to3 fixups

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 13:53:20 PDT 2019


Author: hubert.reinterpretcast
Date: Fri Sep 13 13:53:20 2019
New Revision: 371896

URL: http://llvm.org/viewvc/llvm-project?rev=371896&view=rev
Log:
[LNT] Python 3 support: Minor automatic 2to3 fixups

Summary:
Automatic fixups done using `2to3`:

  - `2to3 -f numliterals`
  - `2to3 -f dict`
  - `2to3 -f map`
  - `2to3 -f exec`

The `exec` call is additionally updated to have a string argument as
noted by @thopre.

The changes cover the files found to be affected when running tests
(without result submission).

Reviewers: cmatthews, thopre, kristof.beyls

Reviewed By: cmatthews

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D67534

Modified:
    lnt/trunk/lnt/formats/__init__.py
    lnt/trunk/lnt/lnttool/create.py
    lnt/trunk/lnt/server/instance.py
    lnt/trunk/lnt/testing/__init__.py

Modified: lnt/trunk/lnt/formats/__init__.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/formats/__init__.py?rev=371896&r1=371895&r2=371896&view=diff
==============================================================================
--- lnt/trunk/lnt/formats/__init__.py (original)
+++ lnt/trunk/lnt/formats/__init__.py Fri Sep 13 13:53:20 2019
@@ -12,7 +12,7 @@ from JSONFormat import format as json
 
 formats = [plist, json]
 formats_by_name = dict((f['name'], f) for f in formats)
-format_names = formats_by_name.keys()
+format_names = list(formats_by_name.keys())
 
 
 def get_format(name):

Modified: lnt/trunk/lnt/lnttool/create.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/create.py?rev=371896&r1=371895&r2=371896&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/create.py (original)
+++ lnt/trunk/lnt/lnttool/create.py Fri Sep 13 13:53:20 2019
@@ -160,7 +160,7 @@ LNT configuration.
     wsgi_file = open(wsgi_path, 'w')
     wsgi_file.write(kWSGITemplate % locals())
     wsgi_file.close()
-    os.chmod(wsgi_path, 0755)
+    os.chmod(wsgi_path, 0o755)
 
     # Execute an upgrade on the database to initialize the schema.
     lnt.server.db.migrate.update_path(db_path)

Modified: lnt/trunk/lnt/server/instance.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/instance.py?rev=371896&r1=371895&r2=371896&view=diff
==============================================================================
--- lnt/trunk/lnt/server/instance.py (original)
+++ lnt/trunk/lnt/server/instance.py Fri Sep 13 13:53:20 2019
@@ -54,7 +54,7 @@ class Instance(object):
             raise Exception("Invalid config: %r" % config_path)
 
         config_data = {}
-        exec open(config_path) in config_data
+        exec(open(config_path).read(), config_data)
         config = lnt.server.config.Config.from_data(config_path, config_data)
 
         return Instance(config_path, config, tmpdir)

Modified: lnt/trunk/lnt/testing/__init__.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/__init__.py?rev=371896&r1=371895&r2=371896&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/__init__.py (original)
+++ lnt/trunk/lnt/testing/__init__.py Fri Sep 13 13:53:20 2019
@@ -182,7 +182,7 @@ class TestSamples:
         self.name = str(name)
         self.info = dict((str(key), str(value))
                          for key, value in info.items())
-        self.data = map(conv_f, data)
+        self.data = list(map(conv_f, data))
 
     def render(self):
         """Return info from this instance in a dictionary that respects




More information about the llvm-commits mailing list