-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix path overrides in python3 when generating the testconfig.
With all the many lines of development, branches and recent shuffling somewhere this went missing - handle fallout from config generation changes that make auto path arguments always be from the base root instead of relative the output directory. Opt to patch the testconfig generator rather than fiddle with generateconfs again. fixup fixup fixup fixup !!! seems isolated directories work locally as of this commit !!! force everything into the tests output directory explain allowig absolute paths in temppath() fixup fixup ci++ fixup fixup fixup invoke pip via the active local python binary fixup fixup fixup fixup
- Loading branch information
Showing
16 changed files
with
330 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM python:3.9 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY requirements.txt local-requirements.txt ./ | ||
RUN pip install --no-cache-dir -r requirements.txt -r local-requirements.txt | ||
|
||
CMD [ "python", "--version" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/sh | ||
# | ||
# --- BEGIN_HEADER --- | ||
# | ||
# dpython - wrapper to invoke a containerised python | ||
# Copyright (C) 2003-2024 The MiG Project by the Science HPC Center at UCPH | ||
# | ||
# This file is part of MiG. | ||
# | ||
# MiG is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# MiG is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
# USA. | ||
# | ||
# --- END_HEADER --- | ||
# | ||
|
||
set -e | ||
|
||
SCRIPT_PATH=$(realpath "$0") | ||
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH") | ||
MIG_BASE=$(realpath "$SCRIPT_BASE/..") | ||
|
||
if [ -z "${PY}" ]; then | ||
echo "No python version specified - please supply a PY env var" | ||
exit 1 | ||
fi | ||
|
||
PYTHON_SUFFIX="py$PY" | ||
DOCKER_IMAGEID_FILE="$SCRIPT_BASE/$PYTHON_SUFFIX.imageid" | ||
DOCKER_PYTHON_BIN="python$PY" | ||
|
||
# NOTE: portable dynamic lookup with docker as default and fallback to podman | ||
DOCKER_BIN=$(command -v docker || command -v podman || echo "") | ||
DOCKER_BASE="$SCRIPT_BASE/docker" | ||
DOCKER_FILE="$DOCKER_BASE/Dockerfile.$PYTHON_SUFFIX" | ||
if [ -z "${DOCKER_BIN}" ]; then | ||
echo "No docker binary found - cannot use for python $PY tests" | ||
exit 1 | ||
fi | ||
|
||
# default PYTHONPATH such that directly executing files in the repo "just works" | ||
# NOTE: this is hard-coded to the mount point used within the container | ||
PYTHONPATH='/usr/src/app' | ||
|
||
# default any variables for container development | ||
MIG_ENV=${MIG_ENV:-'docker'} | ||
|
||
# determine if the image has changed | ||
echo -n "validating container.. " | ||
|
||
# load a previously written docker image id if present | ||
IMAGEID_STORED=$(cat "$DOCKER_IMAGEID_FILE" 2>/dev/null || echo "") | ||
|
||
IMAGEID=$(${DOCKER_BIN} build -f "$DOCKER_FILE" . -q) | ||
if [ "$IMAGEID" != "$IMAGEID_STORED" ]; then | ||
echo "rebuilt for changes" | ||
|
||
# reset the image id so the next call finds no changes | ||
echo "$IMAGEID" > "$DOCKER_IMAGEID_FILE" | ||
else | ||
echo "no changes needed" | ||
fi | ||
|
||
echo "running with MIG_ENV='$MIG_ENV' under python $PY" | ||
echo | ||
|
||
# execute python2 within the image passing the supplied arguments | ||
|
||
${DOCKER_BIN} run -it --rm \ | ||
--mount "type=bind,source=$MIG_BASE,target=/usr/src/app" \ | ||
--env "PYTHONPATH=$PYTHONPATH" \ | ||
--env "MIG_ENV=$MIG_ENV" \ | ||
"$IMAGEID" $DOCKER_PYTHON_BIN $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
# | ||
# --- BEGIN_HEADER --- | ||
# | ||
# python3 - wrapper to invoke a local python3 virtual environment | ||
# Copyright (C) 2003-2024 The MiG Project by the Science HPC Center at UCPH | ||
# | ||
# This file is part of MiG. | ||
# | ||
# MiG is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# MiG is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
# USA. | ||
# | ||
# --- END_HEADER --- | ||
# | ||
|
||
set -e | ||
|
||
SCRIPT_PATH=$(realpath "$0") | ||
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH") | ||
MIG_BASE=$(realpath "$SCRIPT_BASE/..") | ||
|
||
PYTHON_BIN=${PYTHON_BIN:-"$SCRIPT_BASE/venv/bin/python3"} | ||
if [ ! -f "${PYTHON_BIN}" ]; then | ||
echo "No python binary found - perhaps the virtual env was not created" | ||
exit 1 | ||
fi | ||
|
||
# default PYTHONPATH such that directly executing files in the repo "just works" | ||
PYTHONPATH=${PYTHONPATH:-"$MIG_BASE"} | ||
|
||
# default any variables for local development | ||
MIG_ENV=${MIG_ENV:-'local'} | ||
|
||
echo "running with MIG_ENV='$MIG_ENV' under local python 3" | ||
echo | ||
|
||
PYTHONPATH="$PYTHONPATH" MIG_ENV="$MIG_ENV" "$PYTHON_BIN" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.