summaryrefslogtreecommitdiff
path: root/scripts/content_tools/arche_tool.py
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/content_tools/arche_tool.py
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/content_tools/arche_tool.py')
-rw-r--r--scripts/content_tools/arche_tool.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/content_tools/arche_tool.py b/scripts/content_tools/arche_tool.py
index f99d7be39a..677af62d2f 100644
--- a/scripts/content_tools/arche_tool.py
+++ b/scripts/content_tools/arche_tool.py
@@ -1,4 +1,4 @@
-#!runpy.sh
+#!/usr/bin/env python3
"""\
@@ -42,23 +42,23 @@ def node_key(e):
def compare_matched_nodes(key,items,summary):
tags = list(set([e.tag for e in items]))
if len(tags) != 1:
- print "different tag types for key",key
+ print("different tag types for key",key)
summary.setdefault("tag_mismatch",0)
summary["tag_mismatch"] += 1
return
- all_attrib = list(set(chain.from_iterable([e.attrib.keys() for e in items])))
+ all_attrib = list(set(chain.from_iterable([list(e.attrib.keys()) for e in items])))
#print key,"all_attrib",all_attrib
for attr in all_attrib:
vals = [e.get(attr) for e in items]
#print "key",key,"attr",attr,"vals",vals
if len(set(vals)) != 1:
- print key,"- attr",attr,"multiple values",vals
+ print(key,"- attr",attr,"multiple values",vals)
summary.setdefault("attr",{})
summary["attr"].setdefault(attr,0)
summary["attr"][attr] += 1
def compare_trees(file_trees):
- print "compare_trees"
+ print("compare_trees")
summary = {}
all_keys = list(set([node_key(e) for tree in file_trees for e in tree.getroot().iter() if node_key(e)]))
#print "keys",all_keys
@@ -70,14 +70,14 @@ def compare_trees(file_trees):
items = []
for nodes in tree_nodes:
if not key in nodes:
- print "file",i,"missing item for key",key
+ print("file",i,"missing item for key",key)
summary.setdefault("missing",0)
summary["missing"] += 1
else:
items.append(nodes[key])
compare_matched_nodes(key,items,summary)
- print "Summary:"
- print summary
+ print("Summary:")
+ print(summary)
def dump_appearance_params(tree):
vals = []
@@ -88,7 +88,7 @@ def dump_appearance_params(tree):
vals.append("{" + e.get("id") + "," +e.get("u8") + "}")
#print e.get("id"), e.get("name"), e.get("group"), e.get("u8")
if len(vals)==253:
- print ", ".join(vals)
+ print(", ".join(vals))
if __name__ == "__main__":
@@ -101,9 +101,9 @@ if __name__ == "__main__":
args = parser.parse_args()
- print "files",args.files
+ print("files",args.files)
file_trees = [etree.parse(filename) for filename in args.files]
- print args
+ print(args)
if args.compare:
compare_trees(file_trees)
if args.appearance_params: