Skip to content

Don't check external psycopg packages for openssl3 copies #20513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 35 additions & 18 deletions .builders/scripts/repair_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import urllib3
from utils import extract_metadata, normalize_project_name

# Packages for which we're skipping the openssl-3 build check
OPENSSL_PACKAGE_BYPASS = ["psycopg"]


@cache
def get_wheel_hashes(project) -> dict[str, str]:
Expand Down Expand Up @@ -97,6 +100,28 @@ def __str__(self):
]) + '.whl'


def check_unacceptable_files(
wheel: Path,
bypass_prefixes: list[str],
invalid_file_patterns: list[str],
):
"""Check if a wheel contains any unacceptable files and exit if found."""
if any(wheel.name.startswith(pkg_prefix) for pkg_prefix in bypass_prefixes):
print(
f'Warning: Bypassing unacceptable file check for {wheel.name}'
)
return

unacceptable_files = find_patterns_in_wheel(wheel, invalid_file_patterns)
if unacceptable_files:
print(
f"Found copies of unacceptable files in external wheel '{wheel.name}'",
f'(matching {invalid_file_patterns}): ',
unacceptable_files,
)
sys.exit(1)


def repair_linux(source_dir: str, built_dir: str, external_dir: str) -> None:
from auditwheel.patcher import Patchelf
from auditwheel.policy import WheelPolicies
Expand Down Expand Up @@ -129,15 +154,11 @@ def repair_linux(source_dir: str, built_dir: str, external_dir: str) -> None:
if not wheel_was_built(wheel):
print('Using existing wheel')

unacceptable_files = find_patterns_in_wheel(wheel, external_invalid_file_patterns)
if unacceptable_files:
print(
f"Found copies of unacceptable files in external wheel '{wheel.name}'",
f'(matching {external_invalid_file_patterns}): ',
unacceptable_files,
)
sys.exit(1)

check_unacceptable_files(
wheel,
bypass_prefixes=OPENSSL_PACKAGE_BYPASS,
invalid_file_patterns=external_invalid_file_patterns,
)
shutil.move(wheel, external_dir)
continue

Expand Down Expand Up @@ -179,15 +200,11 @@ def repair_windows(source_dir: str, built_dir: str, external_dir: str) -> None:
if not wheel_was_built(wheel):
print('Using existing wheel')

unacceptable_files = find_patterns_in_wheel(wheel, external_invalid_file_patterns)
if unacceptable_files:
print(
f"Found copies of unacceptable files in external wheel '{wheel.name}'",
f'(matching {external_invalid_file_patterns}): ',
unacceptable_files,
)
sys.exit(1)

check_unacceptable_files(
wheel,
bypass_prefixes=OPENSSL_PACKAGE_BYPASS,
invalid_file_patterns=external_invalid_file_patterns,
)
shutil.move(wheel, external_dir)
continue

Expand Down
Loading