Skip to content

Commit

Permalink
[Framework] Add error detection to python pip calls (#5927)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
mreid-tt and th0ma7 authored Jan 27, 2024
1 parent 223b3cc commit bc2327f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions mk/spksrc.service.installer.functions
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bc2327f

Please sign in to comment.