changeset 52954:80f7ec132a65

makefile: more fix to the pip invocation The Makefile is now usable by Mercurial developers and for downstream packaging. `make help` explains how. I had to introduce more options (PIP_OPTIONS_INSTALL, PIP_PREFIX) to be able to change the behavior of the install targets (usable for local installation and downstream packaging) and to deal with an issue on Linux with the --prefix pip option (see https://discuss.python.org/t/linux-distro-patches-to-sysconfig-are-changing-pip-install-prefix-outside-virtual-environments/18240).
author paugier <pierre.augier@univ-grenoble-alpes.fr>
date Tue, 18 Feb 2025 01:26:22 +0100
parents 037febb862d2
children 3cb9f9166a46
files Makefile
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue Feb 18 01:25:35 2025 +0100
+++ b/Makefile	Tue Feb 18 01:26:22 2025 +0100
@@ -20,6 +20,9 @@
 $(eval HGROOT := $(shell pwd))
 HGPYTHONS ?= $(HGROOT)/build/pythons
 PURE=
+PIP_OPTIONS_PURE=--config-settings --global-option="$(PURE)"
+PIP_OPTIONS_INSTALL=--no-deps --ignore-installed --no-build-isolation
+PIP_PREFIX=$(PREFIX)
 PYFILESCMD=find mercurial hgext doc -name '*.py'
 PYFILES:=$(shell $(PYFILESCMD))
 DOCFILES=mercurial/helptext/*.txt
@@ -44,10 +47,20 @@
 	@echo '                 (except installed files or dist source tarball)'
 	@echo '  update-pot   - update i18n/hg.pot'
 	@echo
+	@echo 'See CONTRIBUTING.md for the build and development dependencies.'
+	@echo
+	@echo 'Example for a system-wide installation under /usr/local for'
+	@echo 'downstream packaging (build and runtime deps have to be installed by hand)'
+	@echo '  su -c "make install" && hg version'
+	@echo
 	@echo 'Example for a system-wide installation under /usr/local:'
 	@echo '  make doc'
 	@echo '  su -c "make install PIP_OPTIONS_INSTALL=" && hg version'
 	@echo
+	@echo 'On some Linux distributions, you might need to specify both'
+	@echo 'PREFIX and PIP_PREFIX (here to install everything in /data/local)'
+	@echo '  make install PREFIX=/data/local PIP_PREFIX=/data PIP_OPTIONS_INSTALL='
+	@echo
 	@echo 'Example for a local installation (usable in this directory):'
 	@echo '  make local && ./hg version'
 
@@ -55,7 +68,7 @@
 local:
 	$(PYTHON) -m venv $(VENV_NAME) --clear --upgrade-deps
 	$(VENV_NAME)/$(PYBINDIRNAME)/python -m \
-	  pip install -e . -v --config-settings --global-option="$(PURE)"
+	  pip install -e . -v $(PIP_OPTIONS_PURE)
 	env HGRCPATH= $(VENV_NAME)/$(PYBINDIRNAME)/hg version
 
 .PHONY: build
@@ -102,7 +115,7 @@
 
 .PHONY: install-bin
 install-bin:
-	$(PYTHON) -m pip install . --prefix="$(PREFIX)" --force -v --config-settings --global-option="$(PURE)"
+	$(PYTHON) -m pip install . --prefix="$(PIP_PREFIX)" --force -v $(PIP_OPTIONS_PURE) $(PIP_OPTIONS_INSTALL)
 
 .PHONY: install-chg
 install-chg: build-chg
@@ -117,7 +130,7 @@
 
 .PHONY: install-home-bin
 install-home-bin:
-	$(PYTHON) -m pip install . --user --force -v --config-settings --global-option="$(PURE)"
+	$(PYTHON) -m pip install . --user --force -v $(PIP_OPTIONS_PURE) $(PIP_OPTIONS_INSTALL)
 
 .PHONY: install-home-doc
 install-home-doc: