Skip to content
Open
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
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ exclude_also = [
extend-select = [
"ANN", # flake8-annotations
"B", # flake8-bugbear
"FLY", # flynt
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concat
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"RUF100", # unused noqa (yesqa)
"UP", # pyupgrade
"W", # pycodestyle warnings
Expand Down
6 changes: 3 additions & 3 deletions src/wheel/_bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def finalize_options(self):
egg_info = self.distribution.get_command_obj("egg_info")
egg_info.ensure_finalized() # needed for correct `wheel_dist_name`

self.data_dir = self.wheel_dist_name + ".data"
self.data_dir = f"{self.wheel_dist_name}.data"
self.plat_name_supplied = self.plat_name is not None

try:
Expand Down Expand Up @@ -447,7 +447,7 @@ def run(self):
if not os.path.exists(self.dist_dir):
os.makedirs(self.dist_dir)

wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl")
wheel_path = os.path.join(self.dist_dir, f"{archive_basename}.whl")
with WheelFile(wheel_path, "w", self.compression) as wf:
wf.write_files(archive_root)

Expand Down Expand Up @@ -485,7 +485,7 @@ def write_wheelfile(
for impl in impl_tag.split("."):
for abi in abi_tag.split("."):
for plat in plat_tag.split("."):
msg["Tag"] = "-".join((impl, abi, plat))
msg["Tag"] = f"{impl}-{abi}-{plat}"

wheelfile_path = os.path.join(wheelfile_base, "WHEEL")
log.info(f"creating {wheelfile_path}")
Expand Down
6 changes: 3 additions & 3 deletions src/wheel/_commands/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def tags(
with WheelFile(wheel, "r") as f:
assert f.filename, f"{f.filename} must be available"

wheel_info = f.read(f.dist_info_path + "/WHEEL")
wheel_info = f.read(f"{f.dist_info_path}/WHEEL")
info = BytesParser(policy=email.policy.compat32).parsebytes(wheel_info)

original_wheel_name = os.path.basename(f.filename)
Expand Down Expand Up @@ -127,9 +127,9 @@ def tags(
for item in fin.infolist():
if item.is_dir():
continue
if item.filename == f.dist_info_path + "/RECORD":
if item.filename == f"{f.dist_info_path}/RECORD":
continue
if item.filename == f.dist_info_path + "/WHEEL":
if item.filename == f"{f.dist_info_path}/WHEEL":
fout.writestr(item, info.as_bytes())
else:
fout.writestr(item, fin.read(item))
Expand Down
8 changes: 4 additions & 4 deletions src/wheel/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def requires_to_requires_dist(requirement: Requirement) -> str:
if requirement.url:
return " @ " + requirement.url

requires_dist: list[str] = []
for spec in requirement.specifier:
requires_dist.append(spec.operator + spec.version)
requires_dist: list[str] = [
spec.operator + spec.version for spec in requirement.specifier
]

if requires_dist:
return " " + ",".join(sorted(requires_dist))
Expand Down Expand Up @@ -133,7 +133,7 @@ def generate_requirements(
if extra:
yield "Provides-Extra", extra
if condition:
condition = "(" + condition + ") and "
condition = f"({condition}) and "
condition += f"extra == '{extra}'"

if condition:
Expand Down
4 changes: 2 additions & 2 deletions src/wheel/macosx_libfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def calculate_macosx_platform_tag(archive_root: StrPath, platform_tag: str) -> s
versions_dict: dict[str, tuple[int, int]] = {}
for dirpath, _dirnames, filenames in os.walk(archive_root):
for filename in filenames:
if filename.endswith(".dylib") or filename.endswith(".so"):
if filename.endswith((".dylib", ".so")):
lib_path = os.path.join(dirpath, filename)
min_ver = extract_macosx_min_system_version(lib_path)
if min_ver is not None:
Expand Down Expand Up @@ -482,5 +482,5 @@ def calculate_macosx_platform_tag(archive_root: StrPath, platform_tag: str) -> s

sys.stderr.write(error_message)

platform_tag = prefix + "_" + fin_base_version + "_" + suffix
platform_tag = f"{prefix}_{fin_base_version}_{suffix}"
return platform_tag
8 changes: 4 additions & 4 deletions src/wheel/wheelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ def __init__(
self.dist_info_path = "{}.dist-info".format(
self.parsed_filename.group("namever")
)
self.record_path = self.dist_info_path + "/RECORD"
self.record_path = f"{self.dist_info_path}/RECORD"
self._file_hashes: dict[str, tuple[None, None] | tuple[int, bytes]] = {}
self._file_sizes = {}
if mode == "r":
# Ignore RECORD and any embedded wheel signatures
self._file_hashes[self.record_path] = None, None
self._file_hashes[self.record_path + ".jws"] = None, None
self._file_hashes[self.record_path + ".p7s"] = None, None
self._file_hashes[f"{self.record_path}.jws"] = None, None
self._file_hashes[f"{self.record_path}.p7s"] = None, None

# Fill in the expected hashes by reading them from RECORD
try:
Expand Down Expand Up @@ -231,7 +231,7 @@ def close(self) -> None:
writer = csv.writer(data, delimiter=",", quotechar='"', lineterminator="\n")
writer.writerows(
(
(fname, algorithm + "=" + hash_, self._file_sizes[fname])
(fname, f"{algorithm}={hash_}", self._file_sizes[fname])
for fname, (algorithm, hash_) in self._file_hashes.items()
)
)
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_python_tags(wheelpath: Path) -> None:
assert newname == TESTWHEEL_NAME.replace("py2.py3", "py3")
output_file = wheelpath.parent / newname
with WheelFile(output_file) as f:
output = f.read(f.dist_info_path + "/WHEEL")
output = f.read(f"{f.dist_info_path}/WHEEL")

assert (
output == b"Wheel-Version: 1.0\nGenerator: bdist_wheel (0.30.0)"
Expand Down Expand Up @@ -161,7 +161,7 @@ def test_multi_tags(wheelpath: Path) -> None:
output_file = wheelpath.parent / newname
assert output_file.exists()
with WheelFile(output_file) as f:
output = f.read(f.dist_info_path + "/WHEEL")
output = f.read(f"{f.dist_info_path}/WHEEL")

assert output == (
b"Wheel-Version: 1.0\n"
Expand Down
Loading