mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
crit: add requirements.txt for pip>=20.1
When building with pip version 20.0.2 or older, the pip install
command creates a temporary directory and copies all files from
./crit. This results in the following error message:
ModuleNotFoundError: No module named 'pycriu'
This error appears because the symlink 'pycriu' uses a relative path
that becomes invalid '../lib/py/'.
The '--no-build-isolation' option for pip install is needed to enable
the use of pre-installed dependencies (e.g., protobuf) during build.
The '--ignore-installed' option for pip is needed to avoid an error when
crit is already installed. For example, crit is installed in the GitHub
CI environment as part of the criu OBS package as a dependency for
podman.
Distributions such as Arch Linux have adopted an externally managed
python installation in compliance with PEP 668 [1] that prevents pip
from breaking the system by either installing packages to the system or
locally in the home folder. The '--break-system-packages' [2] option
allows pip to modify an externally managed Python installation.
[1] https://peps.python.org/pep-0668/
[2] https://pip.pypa.io/en/stable/cli/pip_uninstall/
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
f5d06571c5
commit
376f3d1800
3 changed files with 33 additions and 4 deletions
27
lib/Makefile
27
lib/Makefile
|
|
@ -4,6 +4,9 @@ UAPI_HEADERS := lib/c/criu.h images/rpc.proto images/rpc.pb-c.h criu/include/ve
|
|||
|
||||
all-y += lib-c lib-a lib-py
|
||||
|
||||
PYTHON_EXTERNALLY_MANAGED := $(shell $(PYTHON) -c 'import os, sysconfig; print(int(os.path.isfile(os.path.join(sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED"))))')
|
||||
PIP_BREAK_SYSTEM_PACKAGES := 0
|
||||
|
||||
#
|
||||
# C language bindings.
|
||||
lib/c/Makefile: ;
|
||||
|
|
@ -54,9 +57,19 @@ install: lib-c lib-a lib-py lib/c/criu.pc.in
|
|||
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
|
||||
$(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)/criu/),' lib/c/criu.pc.in > lib/c/criu.pc
|
||||
$(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
|
||||
ifeq ($(PYTHON),python3)
|
||||
ifeq ($(PYTHON_EXTERNALLY_MANAGED),1)
|
||||
ifeq ($(PIP_BREAK_SYSTEM_PACKAGES),0)
|
||||
$(E) " SKIP INSTALL crit: Externally managed python environment (See PEP 668 for more information)"
|
||||
$(E) " Consider using PIP_BREAK_SYSTEM_PACKAGES=1 make install"
|
||||
else
|
||||
$(E) " INSTALL " crit
|
||||
$(Q) $(PYTHON) -m pip install --upgrade --force-reinstall --prefix=$(DESTDIR)$(PREFIX) ./crit
|
||||
$(Q) $(PYTHON) -m pip install -r ./crit/requirements.txt
|
||||
$(Q) $(PYTHON) -m pip install --no-build-isolation --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./crit
|
||||
endif
|
||||
else
|
||||
$(E) " INSTALL " crit
|
||||
$(Q) $(PYTHON) -m pip install -r ./crit/requirements.txt
|
||||
$(Q) $(PYTHON) -m pip install --no-build-isolation --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./crit
|
||||
endif
|
||||
.PHONY: install
|
||||
|
||||
|
|
@ -69,7 +82,15 @@ uninstall:
|
|||
$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR)/criu/,$(notdir $(UAPI_HEADERS)))
|
||||
$(E) " UNINSTALL" pkgconfig/criu.pc
|
||||
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/pkgconfig/,criu.pc)
|
||||
ifeq ($(PYTHON),python3)
|
||||
ifeq ($(PYTHON_EXTERNALLY_MANAGED),1)
|
||||
ifeq ($(PIP_BREAK_SYSTEM_PACKAGES),0)
|
||||
$(E) " SKIP UNINSTALL crit: Externally managed python environment (See PEP 668 for more information)"
|
||||
$(E) " Consider using PIP_BREAK_SYSTEM_PACKAGES=1 make uninstall"
|
||||
else
|
||||
$(E) " UNINSTALL" crit
|
||||
$(Q) $(PYTHON) ./scripts/uninstall_module.py --prefix=$(DESTDIR)$(PREFIX) crit
|
||||
endif
|
||||
else
|
||||
$(E) " UNINSTALL" crit
|
||||
$(Q) $(PYTHON) ./scripts/uninstall_module.py --prefix=$(DESTDIR)$(PREFIX) crit
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue