Skip to content

Commit feb7040

Browse files
committed
Fix missing pylock.toml wheel RECORD entry.
1 parent 7a78e88 commit feb7040

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## 0.32.1
4+
5+
This release fixes the dev-cmd wheel `RECORD` metadata to include the embedded `pylock.toml` lock.
6+
37
## 0.32.0
48

59
Drop support for Python 3.8 and officially add support for Python PI.

build-backend/dev_cmd_build/setuptools/build.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
from __future__ import annotations
55

6+
import base64
7+
import csv
8+
import hashlib
69
import os.path
710
import shutil
811
import subprocess
@@ -56,7 +59,7 @@ def build_sdist(sdist_directory: str, config_settings: dict[str, Any] | None = N
5659
sdist_name = setuptools.build_meta.build_sdist(sdist_directory, config_settings)
5760

5861
sdist_path = Path(sdist_directory) / sdist_name
59-
tarball_root_dir_name = "dev_cmd-{version}".format(version=__version__)
62+
tarball_root_dir_name = f"dev_cmd-{__version__}"
6063

6164
with _build_dir("sdist") as tmpdir:
6265
tarball_root_dir = tmpdir / tarball_root_dir_name
@@ -78,14 +81,24 @@ def build_wheel(
7881
)
7982

8083
wheel_path = Path(wheel_directory) / wheel_name
81-
dist_info_dir_name = "dev_cmd-{version}.dist-info".format(version=__version__)
84+
dist_info_dir_name = f"dev_cmd-{__version__}.dist-info"
8285

8386
with _build_dir("wheel") as tmpdir:
8487
with zipfile.ZipFile(wheel_path) as zf:
8588
original_contents = zf.namelist()
8689
zf.extractall(tmpdir)
90+
8791
pylock_toml = _add_lock(tmpdir / dist_info_dir_name / "pylock")
92+
pylock_toml_data = pylock_toml.read_bytes()
93+
fingerprint = base64.urlsafe_b64encode(hashlib.sha256(pylock_toml_data).digest()).rstrip(
94+
b"="
95+
)
8896
pylock_toml_dest: str | None = str(pylock_toml.relative_to(tmpdir).as_posix())
97+
with (tmpdir / dist_info_dir_name / "RECORD").open(mode="a") as fp:
98+
csv.writer(fp).writerow(
99+
(pylock_toml_dest, f"sha256={fingerprint.decode('ascii')}", len(pylock_toml_data))
100+
)
101+
89102
with zipfile.ZipFile(wheel_path, "w") as zf:
90103
for path in original_contents:
91104
if (

dev_cmd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright 2024 John Sirois.
22
# Licensed under the Apache License, Version 2.0 (see LICENSE).
33

4-
__version__ = "0.32.0"
4+
__version__ = "0.32.1"

0 commit comments

Comments
 (0)