From bc2327fc473946b7ffe1532f620e996058cfeeb7 Mon Sep 17 00:00:00 2001 From: Michael Reid Date: Sat, 27 Jan 2024 11:02:38 -0400 Subject: [PATCH] [Framework] Add error detection to python pip calls (#5927) * Add error detection to pip calls * python: Always update pip to match version found in spksrc package * pip: Add information message relatively to pip version found * Simplify and clean-up exit 1 code * installer.functions: Add --disable-pip-version-check to pip call * installer.functions: Drop pip version check and use default --------- Co-authored-by: Vincent Fortier --- mk/spksrc.service.installer.functions | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mk/spksrc.service.installer.functions b/mk/spksrc.service.installer.functions index c46e002b19b..a6ee4894091 100644 --- a/mk/spksrc.service.installer.functions +++ b/mk/spksrc.service.installer.functions @@ -68,15 +68,16 @@ initialize_variables () install_python_virtualenv () { - # Output Python version (confirming PATH) + # Print out default python version found in PATH python3 --version + # Print out default pip version + read -r -a PIP_VERSION 2>/dev/null <<< $(python3 -m pip --version) + echo "INFO: Default pip version found ${PIP_VERSION[1]}" + # Create a Python virtualenv python3 -m venv --system-site-packages ${SYNOPKG_PKGDEST}/env - # Update to latest pip package installer - python3 -m pip install --upgrade pip - if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then set_unix_permissions ${SYNOPKG_PKGDEST}/env fi @@ -95,10 +96,12 @@ install_python_wheels () if [ -s ${requirements} ]; then echo "Install packages from wheels [${requirements}]" pip install $([ $# -gt 0 ] && echo $*) \ + --disable-pip-version-check \ --force-reinstall \ --cache-dir ${cachedir} \ --find-links ${wheelhouse} \ - --requirement ${requirements} + --requirement ${requirements} \ + || echo "ERROR: Python package installation failed" 1>&2 fi if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then