#!/bin/bash set -e ## Exit if Problems set -u ## Fail on Undefined Variable SCRIPT_PATH="$(dirname "$(readlink -f "$0")")" IMAGE="docker.io/debian:bookworm-slim" #################### # - Actions #################### action_exer_1_2() { echo -e "Running Exercise 1.2...\n" podman run \ --rm -it \ -v "$SCRIPT_PATH/exer_1/exer_1_2":/data \ -w /data \ "$IMAGE" \ bash -x run.sh echo echo } action_exer_2() { echo -e "Running Exercise 2...\n" podman run \ --rm -it \ -v "$SCRIPT_PATH/exer_2":/data \ -w /data \ "$IMAGE" \ bash -x run.sh echo echo } action_exer_3() { echo -e "Running Exercise 3...\n" podman run \ --rm -it \ -v "$SCRIPT_PATH/exer_3":/data \ -w /data \ "$IMAGE" \ bash -x run.sh echo echo } action_exer_4() { echo -e "Running Exercise 4...\n" pip show "${2-future}" | grep Location | cut -d ' ' -f 2 echo echo } action_exer_5() { echo -e "Running Exercise 5...\n" echo "VSCodium: Activate the venv in the embedded terminal, and use that to run things. pip freeze for package list." echo echo } action_exer_6() { echo -e "Running Exercise 6...\n" echo "This does not use VSCode, as I do not consent to its proprietary licensing. See https://lab.compute.dtu.dk/cp/02002students/-/issues/1 ." echo echo podman run \ --rm -it \ -v "$SCRIPT_PATH/exer_6":/data \ -w /data \ debian:bookworm-slim \ bash run.sh } action_exer_7() { echo "'pip check' is run in exer_6." } action_exer_8() { echo "At this level, it's identical (but slower than) venv. Just replace 'python3 -m venv' with 'virtualenv'. https://virtualenv.pypa.io/en/latest/" } #################### # - Check Dependencies #################### case $1 in exer_1_2) action_exer_1_2 ;; exer_2) action_exer_2 ;; exer_3) action_exer_3 ;; exer_4) action_exer_4 ;; exer_6) action_exer_6 esac