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

setup.py
Pierre-Antoine Rouby 2024-05-29 10:35:23 +02:00
parent 7d235fdcc2
commit 07cdf72528
2 changed files with 60 additions and 19 deletions

View File

@ -30,6 +30,7 @@ stages:
variables: variables:
MAGE_8_VERSION: "v8.3.6" MAGE_8_VERSION: "v8.3.6"
CUSTOM_PYTHON_VERSION: "3.10.14-build1"
dl-mage8-doc: dl-mage8-doc:
stage: downloads stage: downloads
@ -83,6 +84,21 @@ dl-mage8-windows:
- mage8-windows/mailleurTT.exe - mage8-windows/mailleurTT.exe
- mage8-windows/libbief.dll - mage8-windows/libbief.dll
dl-python-linux:
stage: downloads
tags:
- linux
rules:
- if: $CI_COMMIT_BRANCH == 'setup.py' || $CI_COMMIT_TAG
script:
- curl -L -o python.tar.xz https://gitlab.irstea.fr/parouby/custom-python-build/-/releases/$CUSTOM_PYTHON_VERSION/downloads/packages/python.tar.xz
- mkdir -p linux-python/
- cd linux-python
- tar xvf ../python.tgz
artifacts:
paths:
- linux-python
############# #############
# CONFIGURE # # CONFIGURE #
############# #############
@ -408,6 +424,41 @@ windows-package-exe:
- copy ..\packages\pamhyr.nsi pamhyr.nsi - copy ..\packages\pamhyr.nsi pamhyr.nsi
- .\make-windows-exe.bat - .\make-windows-exe.bat
linux-python-with-sources:
stage: package
tags:
- release
- linux
needs:
- job: dl-python-linux
artifacts: true
- job: set-version
artifacts: true
- job: build-lang
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'setup.py' || $CI_COMMIT_TAG
artifacts:
paths:
- linux-sources-with-python.tar.xz
script:
- git archive --format=tar.gz --output=src.tar.gz $CI_COMMIT_BRANCH
- cd linux-python
- mkdir -p pamhyr
- cd pamhyr
- tar xvf ../../src.tar.gz
- cp -v ../../VERSION ./
- cp -v ../../src/lang/*.qm ./src/lang/
- cd ..
- cp ../package/setup.sh ./setup.sh
- sed -i 's|python3|$(dirname $0)/python/python|' setup.sh
- sed -i 's|.pamhyr-env|$(dirname $0)/.pamhyr-env|' setup.sh
- sed -i 's|./pamhyr|$(dirname $0)/pamhyr|' setup.sh
- cd ..
- mv linux-python pamhyr
- tar cf linux-sources-with-python.tar.xz pamhyr
- mv pamhyr linux-python # Keep 'pamhyr' path avalaible
######## ########
# HASH # # HASH #
######## ########

View File

@ -20,42 +20,32 @@ function perr() {
} }
function try() { function try() {
echo "run: $1" echo "$1"
res=$($1) res=$($1)
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
perr "Command failed with exit value $?: '$1'" perr " !!! Command failed with exit value $?: '$1'"
perr " $res" perr " - $res"
exit 2 exit 2
fi fi
} }
if [ $# -ne 1 ]; if [ $# -ne 0 ];
then then
perr "usage: $0 <version>" perr "usage: $0"
exit 1 exit 1
fi 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 OLD_PWD=$PWD
cd pamhyr
try "python3 -m venv .pamhyr-env" try "python3 -m venv .pamhyr-env"
try "source .pamhyr-env/bin/activate" try "source .pamhyr-env/bin/activate"
try "python3 -m pip install -r requirements.txt" try "python3 -m pip install -r requirements.txt"
echo '#! /usr/bin/env bash' > pamhyr.sh echo '#! /usr/bin/env bash' > pamhyr
echo 'source .pamhyr-env/bin/activate' >> pamhyr.sh echo 'source .pamhyr-env/bin/activate' >> pamhyr
echo 'python3 ./src/pamhyr.py' >> pamhyr.sh echo 'python3 ./pamhyr/src/pamhyr.py $@' >> pamhyr
try "chmod +x pamhyr.sh" try "chmod +x pamhyr"
cd $OLD_PWD cd $OLD_PWD