summaryrefslogtreecommitdiff
path: root/scripts/code_tools
diff options
context:
space:
mode:
authorBennett Goble <signal@lindenlab.com>2021-06-05 22:02:54 -0700
committerSignal Linden <signal@lindenlab.com>2021-12-10 14:42:49 -0800
commitf729cfc33f258781c5fd85a3d8773bf6149d12db (patch)
treeb4d9e9657f64b1ba46d8522f5c2196acefa3ae77 /scripts/code_tools
parentcbaba2df56c66926e051d50b6cb02955c81c2a6c (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 'scripts/code_tools')
-rw-r--r--scripts/code_tools/modified_strings.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/code_tools/modified_strings.py b/scripts/code_tools/modified_strings.py
index 6a763b6ec5..e7a9d239dc 100644
--- a/scripts/code_tools/modified_strings.py
+++ b/scripts/code_tools/modified_strings.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""\
This script scans the SL codebase for translation-related strings.
@@ -25,7 +25,7 @@ Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
$/LicenseInfo$
"""
-from __future__ import print_function
+
import xml.etree.ElementTree as ET
import argparse
@@ -75,10 +75,10 @@ translate_attribs = [
]
def codify_for_print(val):
- if isinstance(val, unicode):
+ if isinstance(val, str):
return val.encode("utf-8")
else:
- return unicode(val, 'utf-8').encode("utf-8")
+ return str(val, 'utf-8').encode("utf-8")
# Returns a dict of { name => xml_node }
def read_xml_elements(blob):
@@ -186,7 +186,7 @@ def make_translation_table(mod_tree, base_tree, lang, args):
transl_dict = read_xml_elements(transl_blob)
rows = 0
- for name in mod_dict.keys():
+ for name in list(mod_dict.keys()):
if not name in base_dict or mod_dict[name].text != base_dict[name].text or (args.missing and not name in transl_dict):
elt = mod_dict[name]
val = elt.text
@@ -307,7 +307,7 @@ def save_translation_file(per_lang_data, aux_data, outfile):
print("Added", num_translations, "rows for language", lang)
# Reference info, not for translation
- for aux, data in aux_data.items():
+ for aux, data in list(aux_data.items()):
df = pd.DataFrame(data, columns = ["Key", "Value"])
df.to_excel(writer, index=False, sheet_name=aux)
worksheet = writer.sheets[aux]