From 4af174ea343add56bae5153037be3d300b2fd3fa Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Wed, 1 Mar 2023 09:35:41 -0500 Subject: [PATCH] * Containers: Added simplistic tool to dump info about Python inside the container. --- containers/simg-python-dump-info.sh | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 containers/simg-python-dump-info.sh diff --git a/containers/simg-python-dump-info.sh b/containers/simg-python-dump-info.sh new file mode 100755 index 0000000..2c2a08c --- /dev/null +++ b/containers/simg-python-dump-info.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Tool to dump info about the installed Python and Conda +# stuff insided a singularity image. +# This tool does not require root privilege. +# +# This does not depend on the OS distro flavor. +# +# Usage: +# simg-python-dump-info.sh INFO_DIR CONT_NAME [CRUN_NAME] +# +# INFO_DIR is the location to dump the info files +# CONT_NAME is the name of the container (to be used as the basenames) +# +# Info dumped so far: + + +set -e + +MYSELF=$0 +MYDIR=$(dirname "$MYSELF") + +INFO_DIR=${1:?INFO_DIR required as arg 1} +CONT_NAME=${2:?CONT_NAME required as arg 2} +CRUN_NAME=$3 + +if [ -z "$CRUN_NAME" ]; then + CRUN_NAME=crun.$CONT_NAME +fi + +_crun () { + "$CRUN_NAME" "$@" +} + +_crun which python > "${INFO_DIR}/python-exec" +_crun which python3 > "${INFO_DIR}/python3-exec" +_crun python --version > "${INFO_DIR}/python-version" + +_crun conda list > "${INFO_DIR}/conda-list"