Fix Ruff linting (#14111)

This commit is contained in:
Zanie Blue
2025-06-17 12:28:23 -05:00
committed by GitHub
parent 10e1d17cfc
commit c25c800367
9 changed files with 20 additions and 16 deletions
@@ -39,10 +39,9 @@ if hasattr(sys, "implementation"):
# GraalPy reports the CPython version as sys.implementation.version,
# so we need to discover the GraalPy version from the cache_tag
import re
implementation_version = re.sub(
r"graalpy(\d)(\d+)-\d+",
r"\1.\2",
sys.implementation.cache_tag
r"graalpy(\d)(\d+)-\d+", r"\1.\2", sys.implementation.cache_tag
)
else:
implementation_version = format_full_version(sys.implementation.version)
@@ -583,7 +582,6 @@ def main() -> None:
elif os_and_arch["os"]["name"] == "musllinux":
manylinux_compatible = True
# By default, pip uses sysconfig on Python 3.10+.
# But Python distributors can override this decision by setting:
# sysconfig._PIP_USE_SYSCONFIG = True / False
@@ -608,7 +606,7 @@ def main() -> None:
except (ImportError, AttributeError):
pass
import distutils.dist
import distutils.dist # noqa: F401
except ImportError:
# We require distutils, but it's not installed; this is fairly
# common in, e.g., deadsnakes where distutils is packaged
@@ -641,7 +639,10 @@ def main() -> None:
# Prior to the introduction of `sysconfig` patching, python-build-standalone installations would always use
# "/install" as the prefix. With `sysconfig` patching, we rewrite the prefix to match the actual installation
# location. So in newer versions, we also write a dedicated flag to indicate standalone builds.
"standalone": sysconfig.get_config_var("prefix") == "/install" or bool(sysconfig.get_config_var("PYTHON_BUILD_STANDALONE")),
"standalone": (
sysconfig.get_config_var("prefix") == "/install"
or bool(sysconfig.get_config_var("PYTHON_BUILD_STANDALONE"))
),
"scheme": get_scheme(use_sysconfig_scheme),
"virtualenv": get_virtualenv(),
"platform": os_and_arch,
@@ -69,8 +69,7 @@ class ELFFile:
}[(self.capacity, self.encoding)]
except KeyError:
raise ELFInvalid(
f"unrecognized capacity ({self.capacity}) or "
f"encoding ({self.encoding})"
f"unrecognized capacity ({self.capacity}) or encoding ({self.encoding})"
)
try:
@@ -161,8 +161,7 @@ def _parse_glibc_version(version_str: str) -> _GLibCVersion:
m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
if not m:
warnings.warn(
f"Expected glibc version with 2 components major.minor,"
f" got: {version_str}",
f"Expected glibc version with 2 components major.minor, got: {version_str}",
RuntimeWarning,
)
return _GLibCVersion(-1, -1)
+2
View File
@@ -0,0 +1,2 @@
# It is important retain compatibility when querying interpreters
target-version = "py37"