diff --git a/mozjs-sys/Cargo.toml b/mozjs-sys/Cargo.toml index 050f6957135..654ae45f1ef 100644 --- a/mozjs-sys/Cargo.toml +++ b/mozjs-sys/Cargo.toml @@ -2,7 +2,7 @@ name = "mozjs_sys" description = "System crate for the Mozilla SpiderMonkey JavaScript engine." repository.workspace = true -version = "0.140.5-5" +version = "0.140.5-6" authors = ["Mozilla", "The Servo Project Developers"] links = "mozjs" license.workspace = true diff --git a/mozjs-sys/etc/patches/0045-python-deprecated.patch b/mozjs-sys/etc/patches/0045-python-deprecated.patch new file mode 100644 index 00000000000..abc70e1d0fe --- /dev/null +++ b/mozjs-sys/etc/patches/0045-python-deprecated.patch @@ -0,0 +1,62 @@ +diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py +index 9f6292cb909de..89bf9995c1768 100644 +--- a/python/mozbuild/mozbuild/frontend/reader.py ++++ b/python/mozbuild/mozbuild/frontend/reader.py +@@ -470,7 +470,7 @@ def c(new_node): + return c( + ast.Subscript( + value=c(ast.Name(id=self._global_name, ctx=ast.Load())), +- slice=c(ast.Index(value=c(ast.Str(s=node.id)))), ++ slice=c(ast.Index(value=c(ast.Constant(value=node.id)))), + ctx=node.ctx, + ) + ) +@@ -1039,8 +1039,8 @@ def assigned_variable(node): + else: + # Others + assert isinstance(target.slice, ast.Index) +- assert isinstance(target.slice.value, ast.Str) +- key = target.slice.value.s ++ assert isinstance(target.slice.value, ast.Constant) ++ key = target.slice.value.value + elif isinstance(target, ast.Attribute): + assert isinstance(target.attr, str) + key = target.attr +@@ -1051,11 +1051,11 @@ def assigned_values(node): + value = node.value + if isinstance(value, ast.List): + for v in value.elts: +- assert isinstance(v, ast.Str) +- yield v.s ++ assert isinstance(v, ast.Constant) ++ yield v.value + else: +- assert isinstance(value, ast.Str) +- yield value.s ++ assert isinstance(value, ast.Constant) ++ yield value.value + + assignments = [] + +diff --git a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py b/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py +index cfcc0f18b9a9a..de06b58819b6a 100644 +--- a/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py ++++ b/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py +@@ -327,15 +327,13 @@ def assignment_node_to_source_filename_list(code, node): + """ + if isinstance(node.value, ast.List) and "elts" in node.value._fields: + for f in node.value.elts: +- if not isinstance(f, ast.Constant) and not isinstance(f, ast.Str): ++ if not isinstance(f, ast.Constant): + log( + "Found non-constant source file name in list: ", + ast_get_source_segment(code, f), + ) + return [] +- return [ +- f.value if isinstance(f, ast.Constant) else f.s for f in node.value.elts +- ] ++ return [f.value for f in node.value.elts] + elif isinstance(node.value, ast.ListComp): + # SOURCES += [f for f in foo if blah] + log("Could not find the files for " + ast_get_source_segment(code, node.value)) diff --git a/mozjs-sys/mozjs/python/mozbuild/mozbuild/frontend/reader.py b/mozjs-sys/mozjs/python/mozbuild/mozbuild/frontend/reader.py index 9f6292cb909..89bf9995c17 100644 --- a/mozjs-sys/mozjs/python/mozbuild/mozbuild/frontend/reader.py +++ b/mozjs-sys/mozjs/python/mozbuild/mozbuild/frontend/reader.py @@ -470,7 +470,7 @@ def c(new_node): return c( ast.Subscript( value=c(ast.Name(id=self._global_name, ctx=ast.Load())), - slice=c(ast.Index(value=c(ast.Str(s=node.id)))), + slice=c(ast.Index(value=c(ast.Constant(value=node.id)))), ctx=node.ctx, ) ) @@ -1039,8 +1039,8 @@ def assigned_variable(node): else: # Others assert isinstance(target.slice, ast.Index) - assert isinstance(target.slice.value, ast.Str) - key = target.slice.value.s + assert isinstance(target.slice.value, ast.Constant) + key = target.slice.value.value elif isinstance(target, ast.Attribute): assert isinstance(target.attr, str) key = target.attr @@ -1051,11 +1051,11 @@ def assigned_values(node): value = node.value if isinstance(value, ast.List): for v in value.elts: - assert isinstance(v, ast.Str) - yield v.s + assert isinstance(v, ast.Constant) + yield v.value else: - assert isinstance(value, ast.Str) - yield value.s + assert isinstance(value, ast.Constant) + yield value.value assignments = [] diff --git a/mozjs-sys/mozjs/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py b/mozjs-sys/mozjs/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py index cfcc0f18b9a..de06b58819b 100644 --- a/mozjs-sys/mozjs/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py +++ b/mozjs-sys/mozjs/python/mozbuild/mozbuild/vendor/rewrite_mozbuild.py @@ -327,15 +327,13 @@ def assignment_node_to_source_filename_list(code, node): """ if isinstance(node.value, ast.List) and "elts" in node.value._fields: for f in node.value.elts: - if not isinstance(f, ast.Constant) and not isinstance(f, ast.Str): + if not isinstance(f, ast.Constant): log( "Found non-constant source file name in list: ", ast_get_source_segment(code, f), ) return [] - return [ - f.value if isinstance(f, ast.Constant) else f.s for f in node.value.elts - ] + return [f.value for f in node.value.elts] elif isinstance(node.value, ast.ListComp): # SOURCES += [f for f in foo if blah] log("Could not find the files for " + ast_get_source_segment(code, node.value))