This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ensurepip does not honour the value of $(prefix)
Type: behavior Stage: patch review
Components: Cross-Build Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alex.Willmer, ZackerySpytz, dstufft, martin.panter, mcepl, ncoghlan
Priority: normal Keywords: patch

Created on 2017-07-26 16:39 by xdegaye, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
ensurepip_prefix.diff xdegaye, 2017-07-26 16:39
Pull Requests
URL Status Linked Edit
PR 17634 open ZackerySpytz, 2019-12-17 01:26
PR 19068 closed mcepl, 2020-03-19 10:08
Messages (3)
msg299252 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-07-26 16:39
When cross-compiling, the local Python interpreter that is used to run ensurepip may not have the same value of sys.prefix as the value of the 'prefix' variable that is set in the Makefile.

With the following values used to install Python locally for a later copy to the files hierarchy owned by the 'termux' application on an Android device:

    DESTDIR=/tmp/android
    prefix=/data/data/com.termux/files/usr/local

'make install' causes ensurepip to install pip in $(DESTDIR)/usr/local instead of the expected $(DESTDIR)/$(prefix) where is installed the standard library.

The attached patch fixes the problem. The patch was implemented assuming that pip uses distutils for the installation (note that setup.py also uses the --prefix option in the Makefile), but I know nothing about pip so forgive me if the patch is wrong and please just assume it is just a way to demonstrate the problem.
msg299290 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2017-07-27 03:18
This looks like the right technical fix to me (see https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-prefix), but I'd like Donald to confirm that before we merge anything.

Making this change will also require an update to the ensurepip docs: https://docs.python.org/3/library/ensurepip.html#command-line-interface
msg330805 - (view) Author: Matej Cepl (mcepl) * Date: 2018-11-30 16:39
Per https://devguide.python.org/pullrequest/, can I ask you Xavier to prepare a proper pull request for this patch to the GitHub repo, please?
History
Date User Action Args
2022-04-11 14:58:49adminsetgithub: 75229
2020-03-19 10:08:27mceplsetpull_requests: + pull_request18422
2019-12-17 01:26:59ZackerySpytzsetnosy: + ZackerySpytz

versions: + Python 3.9, - Python 3.7
2019-12-17 01:26:37ZackerySpytzsetstage: patch review
pull_requests: + pull_request17103
2019-12-10 08:08:09xdegayesetnosy: - xdegaye
2018-11-30 16:39:20mceplsetnosy: + mcepl
messages: + msg330805
2017-07-27 03:18:33ncoghlansetmessages: + msg299290
2017-07-26 16:39:28xdegayecreate