-
Notifications
You must be signed in to change notification settings - Fork 163
Skip internal non-Python references #683
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
base: main
Are you sure you want to change the base?
Changes from all commits
4e91f4d
116209c
e1d8094
72c0563
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |||||||||||||||||||||||
| class WheelAbIInfo: | ||||||||||||||||||||||||
| policies: WheelPolicies | ||||||||||||||||||||||||
| full_external_refs: dict[Path, dict[str, ExternalReference]] | ||||||||||||||||||||||||
| repair_external_refs: dict[Path, dict[str, ExternalReference]] | ||||||||||||||||||||||||
| overall_policy: Policy | ||||||||||||||||||||||||
| external_refs: dict[str, ExternalReference] | ||||||||||||||||||||||||
| ref_policy: Policy | ||||||||||||||||||||||||
|
|
@@ -52,11 +53,34 @@ class WheelElfData: | |||||||||||||||||||||||
| policies: WheelPolicies | ||||||||||||||||||||||||
| full_elftree: dict[Path, DynamicExecutable] | ||||||||||||||||||||||||
| full_external_refs: dict[Path, dict[str, ExternalReference]] | ||||||||||||||||||||||||
| repair_external_refs: dict[Path, dict[str, ExternalReference]] | ||||||||||||||||||||||||
| versioned_symbols: dict[str, set[str]] | ||||||||||||||||||||||||
| uses_ucs2_symbols: bool | ||||||||||||||||||||||||
| uses_pyfpe_jbuf: bool | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def _filter_repair_refs( | ||||||||||||||||||||||||
| external_refs: dict[str, ExternalReference], | ||||||||||||||||||||||||
| wheel_sonames: frozenset[str], | ||||||||||||||||||||||||
| ) -> dict[str, ExternalReference]: | ||||||||||||||||||||||||
| """Return external refs with unresolved sonames already present in the | ||||||||||||||||||||||||
| wheel removed. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ``external_refs`` maps policy name to the libraries needed by one ELF. | ||||||||||||||||||||||||
| ``wheel_sonames`` is the set of shared-library sonames already present in | ||||||||||||||||||||||||
| the wheel. The returned mapping keeps only refs that still need repair. | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| filtered_refs = {} | ||||||||||||||||||||||||
| for name, external_ref in external_refs.items(): | ||||||||||||||||||||||||
| libs = { | ||||||||||||||||||||||||
| lib: path | ||||||||||||||||||||||||
| for lib, path in external_ref.libs.items() | ||||||||||||||||||||||||
| if path is not None or lib not in wheel_sonames | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| filtered_refs[name] = ExternalReference(libs, external_ref.blacklist, external_ref.policy) | ||||||||||||||||||||||||
| return filtered_refs | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @functools.lru_cache | ||||||||||||||||||||||||
| def get_wheel_elfdata( | ||||||||||||||||||||||||
| libc: Libc | None, | ||||||||||||||||||||||||
|
|
@@ -67,6 +91,7 @@ def get_wheel_elfdata( | |||||||||||||||||||||||
| full_elftree: dict[Path, DynamicExecutable] = {} | ||||||||||||||||||||||||
| nonpy_elftree: dict[Path, DynamicExecutable] = {} | ||||||||||||||||||||||||
| full_external_refs: dict[Path, dict[str, ExternalReference]] = {} | ||||||||||||||||||||||||
| repair_external_refs: dict[Path, dict[str, ExternalReference]] = {} | ||||||||||||||||||||||||
| versioned_symbols: dict[str, set[str]] = defaultdict(set) | ||||||||||||||||||||||||
| uses_ucs2_symbols = False | ||||||||||||||||||||||||
| uses_pyfpe_jbuf = False | ||||||||||||||||||||||||
|
|
@@ -142,6 +167,7 @@ def get_wheel_elfdata( | |||||||||||||||||||||||
| elftree, | ||||||||||||||||||||||||
| ctx.path, | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| repair_external_refs[fn] = full_external_refs[fn] | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| repair_external_refs[fn] = full_external_refs[fn] | |
| # Apply the same external-reference filtering used for other ELFs | |
| # so that unresolved DT_NEEDED entries that are actually provided | |
| # by libraries inside the wheel (wheel_sonames) do not cause | |
| # spurious repair failures. | |
| filtered_refs = _filter_repair_refs( | |
| {fn: full_external_refs[fn]}, | |
| wheel_sonames, | |
| ) | |
| if fn in filtered_refs: | |
| repair_external_refs[fn] = filtered_refs[fn] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wheel_sonamesis built fromfn.name(the filenames of ELF entries in the wheel), but_filter_repair_refsand its docstring describe this as a set of SONAMEs. To avoid confusion for future maintainers, consider renaming the parameter/variable (e.g., to reflect DT_NEEDED/filename matching) and updating the docstring accordingly.