From 4bb41b28d5bac09bccd636d8c5fefe1a462f63a7 Mon Sep 17 00:00:00 2001 From: Alm Date: Mon, 25 Aug 2025 08:56:38 +0300 Subject: [PATCH 1/4] Exclude .pyc files from the computed digest in the jit stencils --- Tools/jit/_targets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index 7e261c9f8e297f..47aeb510385e5e 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -72,6 +72,9 @@ def _compute_digest(self) -> str: hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes()) for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)): for filename in filenames: + # Exclude .pyc files from digest computation to ensure reproducible builds. + if filename.endswith(".pyc"): + continue hasher.update(pathlib.Path(dirpath, filename).read_bytes()) return hasher.hexdigest() From 7a1718be22ee60c41e95d298c131864736b417da Mon Sep 17 00:00:00 2001 From: Alm Date: Mon, 25 Aug 2025 13:33:45 +0300 Subject: [PATCH 2/4] Exclude the pycache dir instead of the pyc files --- Tools/jit/_targets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index 47aeb510385e5e..c3ce24643fd4a6 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -71,10 +71,10 @@ def _compute_digest(self) -> str: hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes()) hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes()) for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)): + # Exclude cache files from digest computation to ensure reproducible builds. + if dirpath.endswith("__pycache__"): + continue for filename in filenames: - # Exclude .pyc files from digest computation to ensure reproducible builds. - if filename.endswith(".pyc"): - continue hasher.update(pathlib.Path(dirpath, filename).read_bytes()) return hasher.hexdigest() From 1723f728d5ce3eefc9df330335cbcf9eeeb55976 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 09:52:47 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst diff --git a/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst b/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst new file mode 100644 index 00000000000000..73e9779e07137f --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst @@ -0,0 +1 @@ +Make JIT stencil header generation reproducible by excluding `__pycache__` directories from the computed digest. From 8666f3a2657897a483297909eb9ed3fd73d641ef Mon Sep 17 00:00:00 2001 From: Alm Date: Wed, 27 Aug 2025 12:55:52 +0300 Subject: [PATCH 4/4] Fix news --- .../next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst b/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst index 73e9779e07137f..7af79d0b87ef55 100644 --- a/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst +++ b/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst @@ -1 +1 @@ -Make JIT stencil header generation reproducible by excluding `__pycache__` directories from the computed digest. +Ensure reproducible builds by making JIT stencil header generation deterministic.