Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def _check_git_state(session, version_tag):
]
result = subprocess.run(
["git", "remote", "get-url", "--push", "upstream"],
check=False,
capture_output=True,
encoding="utf-8",
)
Expand All @@ -245,6 +246,7 @@ def _check_git_state(session, version_tag):
# Ensure we're on main branch for cutting a release.
result = subprocess.run(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
check=False,
capture_output=True,
encoding="utf-8",
)
Expand All @@ -253,15 +255,21 @@ def _check_git_state(session, version_tag):

# Ensure there are no uncommitted changes.
result = subprocess.run(
["git", "status", "--porcelain"], capture_output=True, encoding="utf-8"
["git", "status", "--porcelain"],
check=False,
capture_output=True,
encoding="utf-8",
)
if result.stdout:
print(result.stdout, end="", file=sys.stderr)
session.error("The working tree has uncommitted changes")

# Ensure this tag doesn't exist already.
result = subprocess.run(
["git", "rev-parse", version_tag], capture_output=True, encoding="utf-8"
["git", "rev-parse", version_tag],
check=False,
capture_output=True,
encoding="utf-8",
)
if not result.returncode:
session.error(f"Tag already exists! {version_tag} -- {result.stdout!r}")
Expand All @@ -280,8 +288,8 @@ def _bump(session, *, version, file, kind):
file.write_text(new_contents)

session.log("git commit")
subprocess.run(["git", "add", str(file)])
subprocess.run(["git", "commit", "-m", f"Bump for {kind}"])
subprocess.run(["git", "add", str(file)], check=False)
subprocess.run(["git", "commit", "-m", f"Bump for {kind}"], check=False)


@contextlib.contextmanager
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ extend-select = [
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PGH", # pygrep-hooks
"PL", # pylint
"PYI", # flake8-pyi
"RUF", # Ruff-specific rules
"SLOT", # flake8-slots
Expand All @@ -109,11 +110,14 @@ extend-select = [
"YTT", # flake8-2020
]
ignore = [
"N818", # exceptions must end in "*Error"
"N818", # exceptions must end in "*Error"
"PLR09", # too many ...
"PLR2004", # magic value in comparison
"PLW0127", # duplicate of F821
"TRY003", # long messages outside exception class
]

[tool.ruff.lint.per-file-ignores]
"tests/test_*.py" = ["PYI024"]
"tests/test_*.py" = ["PYI024", "PLR"]
"tasks/check.py" = ["UP032"]
"tests/test_requirements.py" = ["UP032"]
4 changes: 2 additions & 2 deletions src/packaging/_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _glibc_version_string_ctypes() -> str | None:
Fallback implementation of glibc_version_string using ctypes.
"""
try:
import ctypes
import ctypes # noqa: PLC0415
except ImportError:
return None

Expand Down Expand Up @@ -184,7 +184,7 @@ def _is_compatible(arch: str, version: _GLibCVersion) -> bool:
return False
# Check for presence of _manylinux module.
try:
import _manylinux
import _manylinux # noqa: PLC0415
except ImportError:
return True
if hasattr(_manylinux, "manylinux_compatible"):
Expand Down
2 changes: 1 addition & 1 deletion src/packaging/_musllinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_musl_version(executable: str) -> _MuslVersion | None:
return None
if ld is None or "musl" not in ld:
return None
proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True)
proc = subprocess.run([ld], check=False, stderr=subprocess.PIPE, text=True)
return _parse_musl_version(proc.stderr)


Expand Down
6 changes: 3 additions & 3 deletions src/packaging/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ def parse_email(data: bytes | str) -> tuple[RawMetadata, dict[str, list[str]]]:
# We have to wrap parsed.keys() in a set, because in the case of multiple
# values for a key (a list), the key will appear multiple times in the
# list of keys, but we're avoiding that by using get_all().
for name in frozenset(parsed.keys()):
for name_with_case in frozenset(parsed.keys()):
# Header names in RFC are case insensitive, so we'll normalize to all
# lower case to make comparisons easier.
name = name.lower()
name = name_with_case.lower()

# We use get_all() here, even for fields that aren't multiple use,
# because otherwise someone could have e.g. two Name fields, and we
Expand Down Expand Up @@ -399,7 +399,7 @@ def parse_email(data: bytes | str) -> tuple[RawMetadata, dict[str, list[str]]]:
# can be independently encoded, so we'll need to check each
# of them.
chunks: list[tuple[bytes, str | None]] = []
for bin, encoding in email.header.decode_header(h):
for bin, _encoding in email.header.decode_header(h):
try:
bin.decode("utf8", "strict")
except UnicodeDecodeError:
Expand Down
5 changes: 1 addition & 4 deletions src/packaging/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,9 @@ def mac_platforms(
text=True,
).stdout
version = cast("AppleVersion", tuple(map(int, version_str.split(".")[:2])))
else:
version = version

if arch is None:
arch = _mac_arch(cpu_arch)
else:
arch = arch

if (10, 0) <= version < (11, 0):
# Prior to Mac OS 11, each yearly release of Mac OS bumped the
Expand Down
1 change: 1 addition & 0 deletions tests/test_musllinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def mock_run(*args, **kwargs):
expected_calls = [
pretend.call(
[ld_musl],
check=False,
stderr=subprocess.PIPE,
text=True,
)
Expand Down
Loading