-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-75229: ensurepip does not honour the value of $(prefix) #17634
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
Changes from all commits
5754521
184d067
893fc98
4622115
22767b5
a90a458
47927a1
aee28db
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 | ||||
---|---|---|---|---|---|---|
|
@@ -1981,7 +1981,7 @@ install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKI | |||||
install|*) ensurepip="" ;; \ | ||||||
esac; \ | ||||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ | ||||||
$$ensurepip --root=$(DESTDIR)/ ; \ | ||||||
$$ensurepip --prefix=$(prefix) ; \ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know enough about the Unix build process to know if using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can test it on *nix and macOS, but I know very little about pip/ensurepip :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. Looking at the pip source, So if you have There's all sorts of qualifications and special cases (because this is packaging 🙁) but that's the basic idea. Given that the original issue was around cross-compilation for Android, I have zero idea how any of this would impact that actual scenario, though... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would guess you'd use cc. @gpshead, since you dabble with embedded systems IIRC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm not the right person to answer this either, i've poked #build on discord to see if anyone else is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can confirm that using Having only one or the other leads to headaches; TL;DR: We expect With a basic build process and environment as such : SOURCE_DIR=/tmp/py3.12.3
TARGET_ROOT=/tmp/build.out
TARGET_PREFIX=/opt/python/py3.12.3
cd ${SOURCE_DIR}
configure --prefix=${TARGET_PREFIX} --with-ensurepip=no [...]
make
make DESTDIR=${TARGET_ROOT} install altinstall We get these results : ${TARGET_ROOT}${TARGET_PREFIX}/bin/python3 -m ensurepip
head -n 1 ${TARGET_ROOT}${TARGET_PREFIX}/bin/pip
#!/tmp/build.out/opt/python/py3.12.3/bin/python3 ${TARGET_ROOT}${TARGET_PREFIX}/bin/python -m ensurepip --root ${TARGET_ROOT}
head -n 1 ${TARGET_ROOT}${TARGET_ROOT}${TARGET_PREFIX}/bin/pip
#!/tmp/build.out/tmp/build.out/opt/python/py3.12.3/bin/python3 In both cases the script installed contains the The expected install locations for pip3 should be:
The behaviour becomes even weirder when using LD_LIBRARY_PATH=${SOURCE_DIR} ${SOURCE_DIR}/python -E -m ensurepip [--upgrade] --root=${DESTDIR} But this call ignores the With thing the way they are currently,
I agree that the proper solution would be to have the makefile call something along the lines of:
Suggested change
I'm not sure the trailing One issue remains when cross-compiling (eg. AARCH64 binaries on a X86_64 host), the build host (x86_64) must be able to execute the target's binaries (AARCH64) for the actual call to work. Assuming I don't see it as a blocking issue since the person building the package should be able to tell if they can use EDIT: EDIT2: Added TL;DR an some clarifications |
||||||
fi | ||||||
|
||||||
.PHONY: altinstall | ||||||
|
@@ -1992,7 +1992,7 @@ altinstall: commoninstall | |||||
install|*) ensurepip="--altinstall" ;; \ | ||||||
esac; \ | ||||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ | ||||||
$$ensurepip --root=$(DESTDIR)/ ; \ | ||||||
$$ensurepip --prefix=$(prefix) ; \ | ||||||
fi | ||||||
|
||||||
.PHONY: commoninstall | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A directory prefix can now be specified when using :mod:`ensurepip`. |
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.
I think we should explain the difference between root and prefix better. Per now, it is not obvious how they differ.
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.
I agree it's not obvious. And that's speaking as a pip maintainer... It's all shrouded in mystery and legacy behaviour dating back to the origins of distutils, I think. And it's very much to do with Unix - on Windows, those options are essentially never used (which is mostly why I don't understand them...)
But I think it's fair to assume that anyone using these options is doing so because they know of the same options in pip, and so they understand what they are doing (or at least their confusion isn't our problem). It's not ideal, but OTOH, this isn't the place for a tutorial on packaging concepts, either.
Uh oh!
There was an error while loading. Please reload this page.
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.
root vs prefix goes back to the base unix model I think, and may be explained in make documentation or something similarly old.
Something along the lines: the prefix (for installation) can be /usr or /usr/local or /opt/my-program but the root directory (for building) is /tmp/something, so the actual part where files are created is /tmp/something/usr/local/bin/python but strings embedded in the programs/libraries/docs look like /usr/local/bin/python so that they’re good at runtime.
(don’t ask me which of the three values corresponds to DESTDIR)
(edit: better replies at #17634 (comment))
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.
DESTDIR is the make equivalent of specifying --root