Skip to content
Snippets Groups Projects
Verified Commit 29c69e7d authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

Work around issue on frozen set generation

This is the sole solution i've managed to make build successfully images.

Refs. swh/infra/sysadm-environment#4724
parent f8ef58b4
No related merge requests found
......@@ -99,6 +99,14 @@ def generate_requirements_frozen(app: str, absolute_apps_dirpath: Path) -> None:
f"{requirements} file for app {app} not found (checked {src_req_file})"
)
def sanitize(requirements_content: bytes) -> bytes:
"""Work around issue with wheel generating wrong version for pkg_resources."""
# Work around the virtualenv packaged in debian. By default, virtualenv will use
# shipped wheel from debian (which hold faulty dependency on
# pkg-resource=0.0.0). Hence creating issue when generating frozen deps set
# https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
return requirements_content.replace(b'pkg_resources==0.0.0\n', b'\n')
with tempfile.TemporaryDirectory(prefix=app) as envdir:
builder = AppEnvBuilder.bootstrap_venv(envdir)
......@@ -106,7 +114,7 @@ def generate_requirements_frozen(app: str, absolute_apps_dirpath: Path) -> None:
freeze_output = builder.run_pip("freeze", capture_output=True)
with tempfile.NamedTemporaryFile(mode="wb", dir=app_dir, delete=False) as f:
f.write(freeze_output.stdout)
f.write(sanitize(freeze_output.stdout))
p = Path(f.name)
p.chmod(0o644)
p.rename(dst_req_file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment