Skip to content
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

Implement variant-specific patches #488

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

tiran
Copy link
Collaborator

@tiran tiran commented Oct 28, 2024

Fromager now supports variant-specific patches in additional to versioned and unversioned patches. Variant-specific patches are in subfolders, e.g. atches/test_pkg-1.0.2/cpu/005-cpuver.patch.

Patch files are sorted alphanumerically by their base name, not their full path. This allows users to sort versioned/unversioned and plain/variant patches as they like.

Internal changes: sources.patch_source() now uses PackageBuildInfo to get patches. patches_for_requirement() has been removed.

Fixes: #486

Fromager now supports variant-specific patches in additional to
versioned and unversioned patches. Variant-specific patches are in
subfolders, e.g. `atches/test_pkg-1.0.2/cpu/005-cpuver.patch`.

Patch files are sorted alphanumerically by their *base* name, not their
full path. This allows users to sort versioned/unversioned and
plain/variant patches as they like.

Internal changes: `sources.patch_source()` now uses
`PackageBuildInfo` to get patches. `patches_for_requirement()` has been
removed.

Fixes: python-wheel-build#486
Signed-off-by: Christian Heimes <[email protected]>
@mergify mergify bot added the ci label Oct 28, 2024
Copy link
Contributor

@rd4398 rd4398 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
I will leave it to @dhellmann for final approval and merging

@mergify mergify bot merged commit 34a4072 into python-wheel-build:main Oct 28, 2024
71 checks passed
pattern = f"{self.override_module_name}-*"
prefix_len = len(pattern) - 1
version: Version | None
pattern = f"{self.override_module_name}*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern is going to find patches for foo-bar when it the module is foo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch directories use module override names, so foo-bar is normalized to foo_bar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test and fix in #493

@tiran tiran deleted the variant-patches branch November 2, 2024 07:16
dhellmann added a commit to dhellmann/fromager that referenced this pull request Nov 3, 2024
Fix a problem introduced in python-wheel-build#488 that could cause packages with a prefix
common to another package's full name to have their patches included
when scanning for patches of the package with the shorter name. For
example, with patches for both 'foo' and 'foo-bar' when patches for
'foo' are loaded they would have included patches for 'foo-bar'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support variant specific patches
3 participants