|
| 1 | +--- a/python/mozbuild/mozbuild/frontend/reader.py |
| 2 | ++++ b/python/mozbuild/mozbuild/frontend/reader.py |
| 3 | +@@ -470,7 +470,7 @@ class TemplateFunction(object): |
| 4 | + return c( |
| 5 | + ast.Subscript( |
| 6 | + value=c(ast.Name(id=self._global_name, ctx=ast.Load())), |
| 7 | +- slice=c(ast.Index(value=c(ast.Str(s=node.id)))), |
| 8 | ++ slice=c(ast.Index(value=c(ast.Constant(value=node.id)))), |
| 9 | + ctx=node.ctx, |
| 10 | + ) |
| 11 | + ) |
| 12 | +@@ -1035,7 +1035,7 @@ class BuildReader(object): |
| 13 | + else: |
| 14 | + # Others |
| 15 | + assert isinstance(target.slice, ast.Index) |
| 16 | +- assert isinstance(target.slice.value, ast.Str) |
| 17 | ++ assert isinstance(target.slice.value, ast.Constant) |
| 18 | + key = target.slice.value.s |
| 19 | + |
| 20 | + return name, key |
| 21 | +@@ -1044,10 +1044,10 @@ class BuildReader(object): |
| 22 | + value = node.value |
| 23 | + if isinstance(value, ast.List): |
| 24 | + for v in value.elts: |
| 25 | +- assert isinstance(v, ast.Str) |
| 26 | ++ assert isinstance(v, ast.Constant) |
| 27 | + yield v.s |
| 28 | + else: |
| 29 | +- assert isinstance(value, ast.Str) |
| 30 | ++ assert isinstance(value, ast.Constant) |
| 31 | + yield value.s |
| 32 | + |
| 33 | + assignments = [] |
| 34 | +--- a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py |
| 35 | ++++ b/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py |
| 36 | +@@ -327,15 +327,13 @@ def assignment_node_to_source_filename_l |
| 37 | + """ |
| 38 | + if isinstance(node.value, ast.List) and "elts" in node.value._fields: |
| 39 | + for f in node.value.elts: |
| 40 | +- if not isinstance(f, ast.Constant) and not isinstance(f, ast.Str): |
| 41 | ++ if not isinstance(f, ast.Constant): |
| 42 | + log( |
| 43 | + "Found non-constant source file name in list: ", |
| 44 | + ast_get_source_segment(code, f), |
| 45 | + ) |
| 46 | + return [] |
| 47 | +- return [ |
| 48 | +- f.value if isinstance(f, ast.Constant) else f.s for f in node.value.elts |
| 49 | +- ] |
| 50 | ++ return [f.value for f in node.value.elts] |
| 51 | + elif isinstance(node.value, ast.ListComp): |
| 52 | + # SOURCES += [f for f in foo if blah] |
| 53 | + log("Could not find the files for " + ast_get_source_segment(code, node.value)) |
0 commit comments