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

Detect x32 userspace ABI on 64-bit kernel (fixes #4962) #5391

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions news/4962.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Detect x32 userspace ABI on 64-bit kernel
7 changes: 6 additions & 1 deletion src/pip/_internal/pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ def get_platform():
if result == "linux_x86_64" and _is_running_32bit():
# 32 bit Python program (running on a 64 bit Linux): pip should only
# install and run 32 bit compiled extensions in that case.
result = "linux_i686"
machine = platform.machine()

if machine == "x86_64":
result = "linux_x32"
else:
result = "linux_i686" # and machine == "i686"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a conditional with warning here, if machine != "i686"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a standard way within pip that I should warn?

Copy link
Member

Choose a reason for hiding this comment

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

logger.warning

Copy link
Member

Choose a reason for hiding this comment

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

I don't think a warning is necessary here - falling back to source installs when there's no defined wheel tag is perfectly normal (e.g. it always happens on non-macOS BSD systems, Solaris, etc), and there's nothing stopping anyone setting up their own registry with linux_x32 wheels if they want to (even if PyPI doesn't allow them).

Copy link
Member

Choose a reason for hiding this comment

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

Sounds fair to me. :)

Choose a reason for hiding this comment

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

The warning would be to highlight that the platform cannot be detected correctly; eg. some ficticious future x42 ABI that pip doesn't yet understand.

Copy link
Member Author

Choose a reason for hiding this comment

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

Another possibility: if we set result = "linux_" + machine, would that be compatible with all platforms when using setarch? I guess I'd be worried about whether that formatting is right for all arches. (Since this patch will now make pip require setarch for non-x32 ABIs per #5391 (comment))


return result

Expand Down