@@ -11,7 +11,12 @@ echo "pyyaml" > req.txt
11
11
echo " pip install requests" > post.sh
12
12
13
13
default_container=$( cat $SCRIPT_DIR /../default_config/config.yaml | grep container_src | cut -d " :" -f2- | sed " s/'//g" )
14
- singularity pull test_container.sif $default_container
14
+ if [[ " $default_container " == " auto" ]]; then
15
+ default_container=$( python3 ../get_container.py)
16
+ fi
17
+ set -e
18
+ t_run " singularity pull test_container.sif docker://$default_container " " default or auto determined container exists and can be downloaded"
19
+ set +e
15
20
16
21
cat ../../default_config/config.yaml | sed " s@container_src.*\$ @container_src: $PWD /test_container.sif@g" > my_config.yaml | sed ' s/container_image.*$/container_image: container.sif/g'
17
22
if grep -q share_container my_config.yaml ; then
@@ -69,6 +74,18 @@ rm -fr PIP_INSTALL_DIR
69
74
mkdir PIP_INSTALL_DIR
70
75
t_run " wrap-container -w /usr/sbin/zdump --prefix PIP_INSTALL_DIR test_container.sif" " wrap-container works with single target"
71
76
77
+ rm -fr WRAP_TEST
78
+ mkdir WRAP_TEST
79
+ t_run " wrap-container docker://python:3.12.9-slim-bookworm -w /usr/local/bin --prefix WRAP_TEST/WW" " Wrap container for remote container"
80
+ t_run " WRAP_TEST/WW/bin/python --version | grep '3.12.9'" " Wrapped container actually contains the correct version of python"
81
+ t_run " WRAP_TEST/WW/bin/python -m venv WRAP_TEST/Py" " Creating a virtual environment on wrapped python works"
82
+ t_run " WRAP_TEST/Py/bin/python -c 'import sys;sys.exit( sys.prefix == sys.base_prefix )'" " Created venv is functional"
83
+ t_run " WRAP_TEST/Py/bin/python -c 'import shutil; print(shutil.which(\" python\" ))' | grep 'WRAP_TEST/Py'" " Trick to retain venv path works"
84
+ source WRAP_TEST/Py/bin/activate
85
+ t_run " python -c 'import sys;sys.exit( sys.prefix == sys.base_prefix )'" " Created venv is functional (activated env)"
86
+ t_run " python -c 'import shutil; print(shutil.which(\" python\" ))' | grep 'WRAP_TEST/Py'" " Trick to retain venv path works (activated env)"
87
+ deactivate
88
+
72
89
rm -fr PIP_INSTALL_DIR
73
90
mkdir PIP_INSTALL_DIR
74
91
t_run " wrap-container -w /usr/sbin --prefix PIP_INSTALL_DIR test_container.sif" " wrap-container works"
0 commit comments