"""Build and smoke-test the release packages with an isolated Python interpreter.""" from pathlib import Path import subprocess import sys import venv def main(work, binary, destination, dll_dirs): root = Path(__file__).resolve().parents[2] directory = str(Path(work).resolve() / "py") builder = venv.EnvBuilder(with_pip=True) builder.create(directory) # CPython distributions use different executable names and venv layouts on Windows. python = builder.ensure_directories(directory).env_exec_cmd print(f"Packaging with {python} ({sys.platform})", flush=True) subprocess.run([python, "-m", "pip", "install", "--disable-pip-version-check", "--no-input", "--require-hashes", "-r", root / "packaging/windows/requirements.txt"], check=True) args = [python, root / "packaging/package.py", "windows", binary, "--output", destination, "--require-static-crt"] for directory in dll_dirs: args.extend(["--dll-dir", directory]) subprocess.run(args, check=True) subprocess.run([python, root / "packaging/check_windows_release.py", destination], check=True) if __name__ == "__main__": main(*sys.argv[1:4], sys.argv[4:])