backport: bug 1970223 - python3.14 support
This commit is contained in:
@@ -292,14 +292,14 @@ class DecoratorVisitor(ast.NodeVisitor):
|
|||||||
kwarg_dict = {}
|
kwarg_dict = {}
|
||||||
|
|
||||||
for name, arg in zip(["command", "subcommand"], decorator.args):
|
for name, arg in zip(["command", "subcommand"], decorator.args):
|
||||||
kwarg_dict[name] = arg.s
|
kwarg_dict[name] = arg.value
|
||||||
|
|
||||||
for keyword in decorator.keywords:
|
for keyword in decorator.keywords:
|
||||||
if keyword.arg not in relevant_kwargs:
|
if keyword.arg not in relevant_kwargs:
|
||||||
# We only care about these 3 kwargs, so we can safely skip the rest
|
# We only care about these 3 kwargs, so we can safely skip the rest
|
||||||
continue
|
continue
|
||||||
|
|
||||||
kwarg_dict[keyword.arg] = getattr(keyword.value, "s", "")
|
kwarg_dict[keyword.arg] = keyword.value.value
|
||||||
|
|
||||||
command = kwarg_dict.pop("command")
|
command = kwarg_dict.pop("command")
|
||||||
self.results.setdefault(command, {})
|
self.results.setdefault(command, {})
|
||||||
|
|||||||
@@ -289,16 +289,14 @@ class CommandAction(argparse.Action):
|
|||||||
group = parser.add_argument_group(title, description)
|
group = parser.add_argument_group(title, description)
|
||||||
|
|
||||||
description = handler.description
|
description = handler.description
|
||||||
group.add_argument(command, help=description, action="store_true")
|
group.add_argument(command, help=description)
|
||||||
|
|
||||||
if disabled_commands and "disabled" in r.categories:
|
if disabled_commands and "disabled" in r.categories:
|
||||||
title, description, _priority = r.categories["disabled"]
|
title, description, _priority = r.categories["disabled"]
|
||||||
group = parser.add_argument_group(title, description)
|
group = parser.add_argument_group(title, description)
|
||||||
if verbose:
|
if verbose:
|
||||||
for c in disabled_commands:
|
for c in disabled_commands:
|
||||||
group.add_argument(
|
group.add_argument(c["command"], help=c["description"])
|
||||||
c["command"], help=c["description"], action="store_true"
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
@@ -405,9 +403,7 @@ class CommandAction(argparse.Action):
|
|||||||
subhandlers,
|
subhandlers,
|
||||||
key=by_decl_order if handler.order == "declaration" else by_name,
|
key=by_decl_order if handler.order == "declaration" else by_name,
|
||||||
):
|
):
|
||||||
group.add_argument(
|
group.add_argument(subcommand, help=subhandler.description)
|
||||||
subcommand, help=subhandler.description, action="store_true"
|
|
||||||
)
|
|
||||||
|
|
||||||
if handler.docstring:
|
if handler.docstring:
|
||||||
parser.description = format_docstring(handler.docstring)
|
parser.description = format_docstring(handler.docstring)
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ class TemplateFunction:
|
|||||||
return c(
|
return c(
|
||||||
ast.Subscript(
|
ast.Subscript(
|
||||||
value=c(ast.Name(id=self._global_name, ctx=ast.Load())),
|
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,
|
ctx=node.ctx,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1039,8 +1039,8 @@ class BuildReader:
|
|||||||
else:
|
else:
|
||||||
# Others
|
# Others
|
||||||
assert isinstance(target.slice, ast.Index)
|
assert isinstance(target.slice, ast.Index)
|
||||||
assert isinstance(target.slice.value, ast.Str)
|
assert isinstance(target.slice.value, ast.Constant)
|
||||||
key = target.slice.value.s
|
key = target.slice.value.value
|
||||||
elif isinstance(target, ast.Attribute):
|
elif isinstance(target, ast.Attribute):
|
||||||
assert isinstance(target.attr, str)
|
assert isinstance(target.attr, str)
|
||||||
key = target.attr
|
key = target.attr
|
||||||
@@ -1051,11 +1051,11 @@ class BuildReader:
|
|||||||
value = node.value
|
value = node.value
|
||||||
if isinstance(value, ast.List):
|
if isinstance(value, ast.List):
|
||||||
for v in value.elts:
|
for v in value.elts:
|
||||||
assert isinstance(v, ast.Str)
|
assert isinstance(v, ast.Constant)
|
||||||
yield v.s
|
yield v.value
|
||||||
else:
|
else:
|
||||||
assert isinstance(value, ast.Str)
|
assert isinstance(value, ast.Constant)
|
||||||
yield value.s
|
yield value.value
|
||||||
|
|
||||||
assignments = []
|
assignments = []
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
if isinstance(node.value, ast.List) and "elts" in node.value._fields:
|
||||||
for f in node.value.elts:
|
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(
|
log(
|
||||||
"Found non-constant source file name in list: ",
|
"Found non-constant source file name in list: ",
|
||||||
ast_get_source_segment(code, f),
|
ast_get_source_segment(code, f),
|
||||||
)
|
)
|
||||||
return []
|
return []
|
||||||
return [
|
return [f.value for f in node.value.elts]
|
||||||
f.value if isinstance(f, ast.Constant) else f.s for f in node.value.elts
|
|
||||||
]
|
|
||||||
elif isinstance(node.value, ast.ListComp):
|
elif isinstance(node.value, ast.ListComp):
|
||||||
# SOURCES += [f for f in foo if blah]
|
# SOURCES += [f for f in foo if blah]
|
||||||
log("Could not find the files for " + ast_get_source_segment(code, node.value))
|
log("Could not find the files for " + ast_get_source_segment(code, node.value))
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ EXCLUDED_PACKAGES = {
|
|||||||
# modified 'dummy' version of it so that the dependency checks still succeed, but
|
# modified 'dummy' version of it so that the dependency checks still succeed, but
|
||||||
# if it ever is attempted to be used, it will fail gracefully.
|
# if it ever is attempted to be used, it will fail gracefully.
|
||||||
"ansicon",
|
"ansicon",
|
||||||
|
# jsonschema 4.17.3 is incompatible with Python 3.14+,
|
||||||
|
# but later versions use a dependency with Rust components, which we thus can't vendor.
|
||||||
|
# For now we apply the minimal patch to jsonschema to make it work again.
|
||||||
|
"jsonschema",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -875,8 +875,11 @@ class RefResolver:
|
|||||||
return None
|
return None
|
||||||
uri, fragment = urldefrag(url)
|
uri, fragment = urldefrag(url)
|
||||||
for subschema in subschemas:
|
for subschema in subschemas:
|
||||||
|
id = subschema["$id"]
|
||||||
|
if not isinstance(id, str):
|
||||||
|
continue
|
||||||
target_uri = self._urljoin_cache(
|
target_uri = self._urljoin_cache(
|
||||||
self.resolution_scope, subschema["$id"],
|
self.resolution_scope, id,
|
||||||
)
|
)
|
||||||
if target_uri.rstrip("/") == uri.rstrip("/"):
|
if target_uri.rstrip("/") == uri.rstrip("/"):
|
||||||
if fragment:
|
if fragment:
|
||||||
|
|||||||
Reference in New Issue
Block a user