fix: name the python floor in generate_pack

This commit is contained in:
Abdessamad Derraz committed 2026-11-06 03:13:13 +01:00
1 parent b274e2303d
commit 1c3462e7fd
3 files changed
+29 -7

No files matched your search

+9 -5
View File
@@ -12,6 +12,13 @@ and 3-tier storage (embedded/external/user_provided).
from __future__ import annotations
import sys
# The README's first command. Under 3.8 it stopped on a SyntaxError that read
# like a damaged file. The build needs 3.9, as pipeline.py says.
if sys.version_info < (3, 9):
sys.exit(f"generate_pack.py needs Python 3.9 or newer, this is {sys.version.split()[0]}")
from collections.abc import Callable, Iterable, Iterator
from artifacts import _build_timestamp, set_plain_mode
@@ -23,7 +30,6 @@ import json
import os
import re
import shutil
import sys
import tempfile
import zipfile
from pathlib import Path
@@ -5079,10 +5085,8 @@ def inject_manifest(zip_path: str, manifest: dict) -> None:
with zipfile.ZipFile(scratch, "a", zipfile.ZIP_DEFLATED) as zf:
_write_generated_member(zf, "manifest.json", manifest_json)
else:
with (
zipfile.ZipFile(zip_path, "r") as src,
zipfile.ZipFile(scratch, "w", zipfile.ZIP_DEFLATED) as dst,
):
with zipfile.ZipFile(zip_path, "r") as src, \
zipfile.ZipFile(scratch, "w", zipfile.ZIP_DEFLATED) as dst:
for item in src.infolist():
if item.filename == "manifest.json":
continue
+2 -2
View File
@@ -57,8 +57,8 @@ import tempfile
import time
from pathlib import Path
# generate_pack's parenthesized context managers do not compile before
# CPython 3.9, which builds the same database, manifests and packs as 3.12.
# The build scripts need CPython 3.9, which builds the same database,
# manifests and packs as 3.12.
# On an older interpreter the run got through the first steps and failed in
# the packs, so it stops before step 0. A test compiles every script under
# this floor.
+18
View File
@@ -118,6 +118,24 @@ class ReadmeRegressions(unittest.TestCase):
self.assertEqual(proc.returncode, 1)
self.assertIn("needs Python 3.9", proc.stderr)
def test_the_readme_build_command_names_the_floor(self):
"""The README's first command is generate_pack.py. Under 3.8 it
stopped on a raw SyntaxError at a parenthesized `with`."""
import shutil # noqa: PLC0415
python38 = shutil.which("python3.8")
if python38 is None:
if os.environ.get("CI"):
self.fail("CI must provide python3.8")
self.skipTest("no python3.8 on PATH")
proc = subprocess.run(
[python38, "-I", "scripts/generate_pack.py", "--help"],
cwd=ROOT, capture_output=True, text=True, timeout=60, check=False,
)
self.assertEqual(proc.returncode, 1)
self.assertNotIn("SyntaxError", proc.stderr)
self.assertIn("generate_pack.py needs Python 3.9", proc.stderr)
def test_the_floor_interpreter_imports_every_script(self):
"""Every module under scripts/ is loaded by a real interpreter of the
floor version, as the installer's 3.8 floor is proven by running it.