diff options
author | Bennett Goble <signal@lindenlab.com> | 2021-06-05 22:02:54 -0700 |
---|---|---|
committer | Signal Linden <signal@lindenlab.com> | 2021-12-10 14:42:49 -0800 |
commit | f729cfc33f258781c5fd85a3d8773bf6149d12db (patch) | |
tree | b4d9e9657f64b1ba46d8522f5c2196acefa3ae77 /indra/cmake/run_build_test.py | |
parent | cbaba2df56c66926e051d50b6cb02955c81c2a6c (diff) |
SL-15742: Convert build scripts to Python 3
This changeset makes it possible to build the Second Life viewer using
Python 3. It is designed to be used with an equivalent Autobuild branch
so that a developer can compile without needing Python 2 on their
machine.
Breaking change: Python 2 support ending
Rather than supporting two versions of Python, including one that was
discontinued at the beginning of the year, this branch focuses on
pouring future effort into Python 3 only. As a result, scripts do not
need to be backwards compatible. This means that build environments,
be they on personal computers and on build agents, need to have a
compatible interpreter.
Notes
- SLVersionChecker will still use Python 2 on macOS
- Fixed the message template url used by template_verifier.py
Diffstat (limited to 'indra/cmake/run_build_test.py')
-rwxr-xr-x | indra/cmake/run_build_test.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py index ec5d33f902..1e92868ae7 100755 --- a/indra/cmake/run_build_test.py +++ b/indra/cmake/run_build_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """\ @file run_build_test.py @author Nat Goodspeed @@ -17,7 +17,7 @@ line. Example: -python run_build_test.py -DFOO=bar myprog somearg otherarg +python3 run_build_test.py -DFOO=bar myprog somearg otherarg sets environment variable FOO=bar, then runs: myprog somearg otherarg @@ -47,7 +47,7 @@ $/LicenseInfo$ import os import sys import errno -import HTMLParser +import html.parser import re import signal import subprocess @@ -111,10 +111,10 @@ def main(command, arguments=[], libpath=[], vars={}): # Now handle arbitrary environment variables. The tricky part is ensuring # that all the keys and values we try to pass are actually strings. if vars: - for key, value in vars.items(): + for key, value in list(vars.items()): # As noted a few lines above, facilitate copy-paste rerunning. log.info("%s='%s' \\" % (key, value)) - os.environ.update(dict([(str(key), str(value)) for key, value in vars.iteritems()])) + os.environ.update(dict([(str(key), str(value)) for key, value in vars.items()])) # Run the child process. command_list = [command] command_list.extend(arguments) @@ -177,7 +177,7 @@ def translate_rc(rc): try: table = get_windows_table() symbol, desc = table[hexrc] - except Exception, err: + except Exception as err: log.error("(%s -- carrying on)" % err) log.error("terminated with rc %s (%s)" % (rc, hexrc)) else: @@ -194,7 +194,7 @@ def translate_rc(rc): strc = str(rc) return "terminated by signal %s" % strc -class TableParser(HTMLParser.HTMLParser): +class TableParser(html.parser.HTMLParser): """ This HTMLParser subclass is designed to parse the table we know exists in windows-rcs.html, hopefully without building in too much knowledge of @@ -204,9 +204,7 @@ class TableParser(HTMLParser.HTMLParser): whitespace = re.compile(r'\s*$') def __init__(self): - # Because Python 2.x's HTMLParser is an old-style class, we must use - # old-style syntax to forward the __init__() call -- not super(). - HTMLParser.HTMLParser.__init__(self) + super().__init__() # this will collect all the data, eventually self.table = [] # Stack whose top (last item) indicates where to append current |