@@ -11,7 +11,12 @@ echo "pyyaml" > req.txt
1111echo " pip install requests" > post.sh
1212
1313default_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
1520
1621cat ../../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'
1722if grep -q share_container my_config.yaml ; then
@@ -69,6 +74,18 @@ rm -fr PIP_INSTALL_DIR
6974mkdir PIP_INSTALL_DIR
7075t_run " wrap-container -w /usr/sbin/zdump --prefix PIP_INSTALL_DIR test_container.sif" " wrap-container works with single target"
7176
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+
7289rm -fr PIP_INSTALL_DIR
7390mkdir PIP_INSTALL_DIR
7491t_run " wrap-container -w /usr/sbin --prefix PIP_INSTALL_DIR test_container.sif" " wrap-container works"
0 commit comments