Skip to content

WIP: bpo-31046: ensurepip should honour the value of $(prefix) #19068

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

Closed
wants to merge 1 commit 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
12 changes: 10 additions & 2 deletions Lib/ensurepip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ def _disable_pip_configuration_settings():
os.environ['PIP_CONFIG_FILE'] = os.devnull


def bootstrap(*, root=None, upgrade=False, user=False,
def bootstrap(*, root=None, prefix=None, upgrade=False, user=False,
altinstall=False, default_pip=False,
verbosity=0):
"""
Bootstrap pip into the current Python installation (or the given root
directory).
and prefix directory).

Note that calling this function will alter both sys.path and os.environ.
"""
Expand Down Expand Up @@ -122,6 +122,8 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
args = ["install", "--no-index", "--find-links", tmpdir]
if root:
args += ["--root", root]
if prefix:
args += ["--prefix", prefix]
if upgrade:
args += ["--upgrade"]
if user:
Expand Down Expand Up @@ -193,6 +195,11 @@ def _main(argv=None):
default=None,
help="Install everything relative to this alternate root directory.",
)
parser.add_argument(
"--prefix",
default=None,
help="Install everything using this prefix.",
)
parser.add_argument(
"--altinstall",
action="store_true",
Expand All @@ -212,6 +219,7 @@ def _main(argv=None):

return _bootstrap(
root=args.root,
prefix=args.prefix,
upgrade=args.upgrade,
user=args.user,
verbosity=args.verbosity,
Expand Down
4 changes: 2 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKI
install|*) ensurepip="" ;; \
esac; \
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
$$ensurepip --root=$(DESTDIR)/ ; \
$$ensurepip --root=$(DESTDIR)/ --prefix=$(prefix) ; \
fi

altinstall: commoninstall
Expand All @@ -1198,7 +1198,7 @@ altinstall: commoninstall
install|*) ensurepip="--altinstall" ;; \
esac; \
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
$$ensurepip --root=$(DESTDIR)/ ; \
$$ensurepip --root=$(DESTDIR)/ --prefix=$(prefix) ; \
fi

commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
Expand Down