summaryrefslogtreecommitdiffstats
path: root/testing/zipapp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-16 09:45:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-16 09:45:11 +0000
commitf2ae340aa5fc69bc4f305365bfe7ad41cf5f4973 (patch)
tree10c69f11608df1ba4aa763602ad45e4748d0a6ce /testing/zipapp
parentAdding upstream version 3.3.2. (diff)
downloadpre-commit-f2ae340aa5fc69bc4f305365bfe7ad41cf5f4973.tar.xz
pre-commit-f2ae340aa5fc69bc4f305365bfe7ad41cf5f4973.zip
Adding upstream version 3.3.3.upstream/3.3.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/zipapp')
-rw-r--r--testing/zipapp/Dockerfile4
-rwxr-xr-xtesting/zipapp/make16
2 files changed, 13 insertions, 7 deletions
diff --git a/testing/zipapp/Dockerfile b/testing/zipapp/Dockerfile
index 7c74c1b..ea967e3 100644
--- a/testing/zipapp/Dockerfile
+++ b/testing/zipapp/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:focal
+FROM ubuntu:jammy
RUN : \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -11,4 +11,4 @@ RUN : \
ENV LANG=C.UTF-8 PATH=/venv/bin:$PATH
RUN : \
&& python3 -mvenv /venv \
- && pip install --no-cache-dir pip setuptools wheel no-manylinux --upgrade
+ && pip install --no-cache-dir pip distlib no-manylinux --upgrade
diff --git a/testing/zipapp/make b/testing/zipapp/make
index 37b5c35..165046f 100755
--- a/testing/zipapp/make
+++ b/testing/zipapp/make
@@ -4,7 +4,6 @@ from __future__ import annotations
import argparse
import base64
import hashlib
-import importlib.resources
import io
import os.path
import shutil
@@ -42,10 +41,17 @@ def _add_shim(dest: str) -> None:
with zipfile.ZipFile(bio, 'w') as zipf:
zipf.write(shim, arcname='__main__.py')
- with open(os.path.join(dest, 'python.exe'), 'wb') as f:
- f.write(importlib.resources.read_binary('distlib', 't32.exe'))
- f.write(b'#!py.exe -3\n')
- f.write(bio.getvalue())
+ with tempfile.TemporaryDirectory() as tmpdir:
+ _exit_if_retv(
+ 'podman', 'run', '--rm', '--volume', f'{tmpdir}:/out:rw', IMG,
+ 'cp', '/venv/lib/python3.10/site-packages/distlib/t32.exe', '/out',
+ )
+
+ with open(os.path.join(dest, 'python.exe'), 'wb') as f:
+ with open(os.path.join(tmpdir, 't32.exe'), 'rb') as t32:
+ f.write(t32.read())
+ f.write(b'#!py.exe -3\n')
+ f.write(bio.getvalue())
def _write_cache_key(version: str, wheeldir: str, dest: str) -> None: