diskimage-builder/diskimage_builder/elements/python-stow-versions/test-elements/test-python-stow/install.d/71-test-python-stow
Dmitriy Rabotyagov 1de6fe4ba7 Add python-stow-versions element
This element is designed to install latest minor versions of different
python releases, like py27, py35, py36, py37, py38
into stow directory, and later easily enable them with stow.

Change-Id: Iab6d20e7643e549b53c629fb430e58b1c5e72991
2020-03-19 21:21:01 +02:00

27 lines
723 B
Bash
Executable file

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eux
set -o pipefail
DIB_STOW_PATH="/usr/local/stow"
DIB_PY_BUILD_COUNTER=0
for pybuilds in $(ls -1 ${DIB_STOW_PATH} | grep "python-"); do
DIB_PY_BUILD_COUNTER=$((DIB_PY_BUILD_COUNTER+1))
py_dir_version=$(echo ${pybuilds} | cut -d "-" -f 2)
py_real_version=$(\
${DIB_STOW_PATH}/${pybuilds}/bin/python --version | cut -d " " -f 2)
[[ ${py_real_version} == ${py_dir_version} ]]
pushd ${DIB_STOW_PATH}
stow ${pybuilds}
popd
py_stow_version=$(\
/usr/local/bin/python${py_dir_version%.*} --version | cut -d " " -f 2)
[[ ${py_stow_version} == ${py_dir_version} ]]
done
[ $DIB_PY_BUILD_COUNTER -eq 1 ]