gitlab-ci: Add dl custom python and source with python packages.

This commit is contained in:
Pierre-Antoine Rouby committed 2024-05-29 10:35:23 +02:00
1 parent 7d235fdcc2
commit 07cdf72528
2 files changed
+60 -19

No files matched your search

+9 -19
View File
@@ -20,42 +20,32 @@ function perr() {
}
function try() {
echo "run: $1"
echo "$1"
res=$($1)
if [ $? -ne 0 ];
then
perr "Command failed with exit value $?: '$1'"
perr " $res"
perr " !!! Command failed with exit value $?: '$1'"
perr " - $res"
exit 2
fi
}
if [ $# -ne 1 ];
if [ $# -ne 0 ];
then
perr "usage: $0 <version>"
perr "usage: $0"
exit 1
fi
version=$1
# Download last version
try "curl https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/archive/$version/pamhyr-$version.tar.gz -o pamhyr-$version.tar.gz"
# Setup last version
try "tar xf pamhyr-$version.tar.gz"
mv pamhyr-$version/ pamhyr/
OLD_PWD=$PWD
cd pamhyr
try "python3 -m venv .pamhyr-env"
try "source .pamhyr-env/bin/activate"
try "python3 -m pip install -r requirements.txt"
echo '#! /usr/bin/env bash' > pamhyr.sh
echo 'source .pamhyr-env/bin/activate' >> pamhyr.sh
echo 'python3 ./src/pamhyr.py' >> pamhyr.sh
echo '#! /usr/bin/env bash' > pamhyr
echo 'source .pamhyr-env/bin/activate' >> pamhyr
echo 'python3 ./pamhyr/src/pamhyr.py $@' >> pamhyr
try "chmod +x pamhyr.sh"
try "chmod +x pamhyr"
cd $OLD_PWD