Skip to content

Comments

fix: pip hack workaround#980

Open
henryiii wants to merge 3 commits intomainfrom
henryiii/fix/piphack
Open

fix: pip hack workaround#980
henryiii wants to merge 3 commits intomainfrom
henryiii/fix/piphack

Conversation

@henryiii
Copy link
Contributor

@henryiii henryiii commented Feb 9, 2026

Attempt to work around pip hack for Gentoo, close #978.

If pip doesn't have RECORD, then this will no longer use it. We could require non-empty RECORD for the check, which would require Gentoo to include a working RECORD without the _vendor files. In general, though, I think if RECORD is missing, this might be a modified pip and we probably shouldn't trust it.

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
src/build/env.py Outdated
# Detect that by checking if pip._vendor` module exists.
if (spec := importlib.util.find_spec('pip')) is not None:
for loc in spec.submodule_search_locations:
vendor_loc = Path(loc) / '_vendor'
Copy link
Member

@layday layday Feb 9, 2026

Choose a reason for hiding this comment

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

This won't work with a zipapp copy of pip because its paths are not filesystem paths - we'd have to use importlib.resources.Traversable. Personally, I'd rather rip this whole thing out and agree with distros some way they could signal that pip is debundled in its metadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is a zipapp pip, couldn't we assume this is not debundled (that's the opposite of what happens here, but I think we could do it).

Working out some mechanics to declare this would be harder, take longer, and would probably need standardization. Gentoo isn't even supporting distribution.files as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also still triggers the distutils hack warning, by the way.

Copy link
Member

Choose a reason for hiding this comment

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

I guess? But it feels like we're just stacking hack upon hack at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed new version with different logic.

Copy link
Member

Choose a reason for hiding this comment

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

New version looks better. Does Gentoo write out a RECORD then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, if the RECORD is missing, it is assumed broken in the current form, so Gentoo won't be used. Homebrew 3.14 also won't be used when it could be due to missing RECORD.

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii force-pushed the henryiii/fix/piphack branch from b5ddb18 to 04aaf1f Compare February 9, 2026 23:18
@henryiii henryiii changed the title fix: pip hack workarounnd fix: pip hack workaround Feb 10, 2026
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

importing pip at runtime breaks Setuptools' distutils hack

2 participants