mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-05-07 11:57:57 +03:00
contrib/jenkins.sh: add setup_venv()
Reduece code duplication by factoring out virtualenv setup and activation into a shell function. Change-Id: Ibb193d12d5502c78104ef53badc6037f08e92df1
This commit is contained in:
@@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
setup_venv() {
|
||||||
|
virtualenv -p python3 venv --system-site-packages
|
||||||
|
. venv/bin/activate
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -d "./tests/" ] ; then
|
if [ ! -d "./tests/" ] ; then
|
||||||
echo "###############################################"
|
echo "###############################################"
|
||||||
echo "Please call from pySim-prog top directory"
|
echo "Please call from pySim-prog top directory"
|
||||||
@@ -23,8 +28,7 @@ fi
|
|||||||
|
|
||||||
case "$JOB_TYPE" in
|
case "$JOB_TYPE" in
|
||||||
"test")
|
"test")
|
||||||
virtualenv -p python3 venv --system-site-packages
|
setup_venv
|
||||||
. venv/bin/activate
|
|
||||||
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
pip install pyshark
|
pip install pyshark
|
||||||
@@ -36,8 +40,7 @@ case "$JOB_TYPE" in
|
|||||||
tests/pySim-trace_test/pySim-trace_test.sh
|
tests/pySim-trace_test/pySim-trace_test.sh
|
||||||
;;
|
;;
|
||||||
"card-test") # tests requiring physical cards
|
"card-test") # tests requiring physical cards
|
||||||
virtualenv -p python3 venv --system-site-packages
|
setup_venv
|
||||||
. venv/bin/activate
|
|
||||||
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
@@ -53,8 +56,7 @@ case "$JOB_TYPE" in
|
|||||||
tests/pySim-smpp2sim_test/pySim-smpp2sim_test.sh
|
tests/pySim-smpp2sim_test/pySim-smpp2sim_test.sh
|
||||||
;;
|
;;
|
||||||
"distcheck")
|
"distcheck")
|
||||||
virtualenv -p python3 venv --system-site-packages
|
setup_venv
|
||||||
. venv/bin/activate
|
|
||||||
|
|
||||||
pip install .
|
pip install .
|
||||||
pip install pyshark
|
pip install pyshark
|
||||||
@@ -67,8 +69,7 @@ case "$JOB_TYPE" in
|
|||||||
# Print pylint version
|
# Print pylint version
|
||||||
pip3 freeze | grep pylint
|
pip3 freeze | grep pylint
|
||||||
|
|
||||||
virtualenv -p python3 venv --system-site-packages
|
setup_venv
|
||||||
. venv/bin/activate
|
|
||||||
|
|
||||||
pip install .
|
pip install .
|
||||||
|
|
||||||
@@ -86,8 +87,7 @@ case "$JOB_TYPE" in
|
|||||||
contrib/*.py
|
contrib/*.py
|
||||||
;;
|
;;
|
||||||
"docs")
|
"docs")
|
||||||
virtualenv -p python3 venv --system-site-packages
|
setup_venv
|
||||||
. venv/bin/activate
|
|
||||||
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user