Skip to content

Commit f0ce8ee

Browse files
committed
use Python 3.8 if avail (#41)
1 parent 84ad509 commit f0ce8ee

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

installer/rpm/rpmbuild/SPECS/laps4linux-client.spec

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,22 @@ cp usr/share/pixmaps/laps.png $RPM_BUILD_ROOT/usr/share/pixmaps
3737

3838
%post
3939
DIR=/usr/share/laps4linux-client
40-
python3 -m venv --system-site-packages $DIR/venv
40+
PYTHON_BIN=python3
41+
if [[ "$(python3 --version)" == "Python 3.0"* ]] \
42+
|| [[ "$(python3 --version)" == "Python 3.1"* ]] \
43+
|| [[ "$(python3 --version)" == "Python 3.2"* ]] \
44+
|| [[ "$(python3 --version)" == "Python 3.3"* ]] \
45+
|| [[ "$(python3 --version)" == "Python 3.4"* ]] \
46+
|| [[ "$(python3 --version)" == "Python 3.5"* ]] \
47+
|| [[ "$(python3 --version)" == "Python 3.6"* ]] \
48+
|| [[ "$(python3 --version)" == "Python 3.7"* ]]; then
49+
echo "Default Python version on this system ($(python3 --version)) is not compatible with LAPS4LINUX! Install at least Python 3.8."
50+
if command -v python3.8; then
51+
PYTHON_BIN=python3.8
52+
echo "Found compatible Python version: $PYTHON_BIN"
53+
fi
54+
fi
55+
$PYTHON_BIN -m venv --system-site-packages --clear $DIR/venv
4156
$DIR/venv/bin/pip3 install --upgrade pip==25.0.0
4257
$DIR/venv/bin/pip3 install --upgrade $DIR[barcode]
4358
$DIR/venv/bin/pip3 uninstall -y pip

installer/rpm/rpmbuild/SPECS/laps4linux-runner.spec

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,22 @@ cp usr/sbin/laps-runner-pam $RPM_BUILD_ROOT/%{_sbindir}/laps-runner-pam
3737

3838
%post
3939
DIR=/usr/share/laps4linux-runner
40-
python3 -m venv --system-site-packages $DIR/venv
40+
PYTHON_BIN=python3
41+
if [[ "$(python3 --version)" == "Python 3.0"* ]] \
42+
|| [[ "$(python3 --version)" == "Python 3.1"* ]] \
43+
|| [[ "$(python3 --version)" == "Python 3.2"* ]] \
44+
|| [[ "$(python3 --version)" == "Python 3.3"* ]] \
45+
|| [[ "$(python3 --version)" == "Python 3.4"* ]] \
46+
|| [[ "$(python3 --version)" == "Python 3.5"* ]] \
47+
|| [[ "$(python3 --version)" == "Python 3.6"* ]] \
48+
|| [[ "$(python3 --version)" == "Python 3.7"* ]]; then
49+
echo "Default Python version on this system ($(python3 --version)) is not compatible with LAPS4LINUX! Install at least Python 3.8."
50+
if command -v python3.8; then
51+
PYTHON_BIN=python3.8
52+
echo "Found compatible Python version: $PYTHON_BIN"
53+
fi
54+
fi
55+
$PYTHON_BIN -m venv --system-site-packages --clear $DIR/venv
4156
$DIR/venv/bin/pip3 install --upgrade pip==25.0.0
4257
$DIR/venv/bin/pip3 install --upgrade $DIR
4358
$DIR/venv/bin/pip3 uninstall -y pip

0 commit comments

Comments
 (0)