Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ LOCAL_PYTHON_BIN = './envhelp/lpython'

ifdef PYTHON_BIN
LOCAL_PYTHON_BIN = $(PYTHON_BIN)
else ifeq ($(PY),2)
PYTHON_BIN = './envhelp/python2'
else
PYTHON_BIN = './envhelp/python3'
endif
Expand All @@ -28,7 +26,7 @@ info:
@echo "The following should help you get started:"
@echo
@echo "'make test' - run the test suite (default python 3)"
@echo "'make PY=2 test' - run the test suite (default python 2)"
@echo "'make PYVER=X.Y' - run the test suite (python version X.Y)"
@echo "'make unittest' - execute tests locally for development"

.PHONY: fmt
Expand All @@ -41,7 +39,6 @@ endif

.PHONY: clean
clean:
@rm -f ./envhelp/py2.imageid
@rm -f ./envhelp/py3.imageid
@rm -f ./envhelp/local.depends

Expand All @@ -61,11 +58,7 @@ unittest: dependencies testconfig
@$(LOCAL_PYTHON_BIN) -m unittest discover -s tests/

.PHONY: dependencies
ifeq ($(PY),2)
dependencies: ./envhelp/local.depends
else
dependencies: ./envhelp/venv/pyvenv.cfg ./envhelp/local.depends
endif

.PHONY: testconfig
testconfig: ./envhelp/output/testconfs
Expand Down
9 changes: 0 additions & 9 deletions envhelp/docker/Dockerfile.py2

This file was deleted.

20 changes: 9 additions & 11 deletions envhelp/dpython
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,24 @@ SCRIPT_PATH=$(realpath "$0")
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH")
MIG_BASE=$(realpath "$SCRIPT_BASE/..")

if [ -n "${PY}" ]; then
PYVER="$PY"
PYTHON_SUFFIX="py$PY"
DOCKER_FILE_SUFFIX="$PYTHON_SUFFIX"
elif [ -n "${PYVER}" ]; then
PY=3
if [ -n "${PYVER}" ]; then
PYTHON_SUFFIX="pyver_$PYVER"
DOCKER_FILE_SUFFIX="pyver"
else
echo "No python version specified - please supply a PY env var"
exit 1
echo "No specific python version chosen - defaulting to supported baseline"
PYVER="3 (default)"
PYTHON_SUFFIX="py3"
DOCKER_FILE_SUFFIX="py3"
fi

DOCKER_FILE="$SCRIPT_BASE/docker/Dockerfile.$DOCKER_FILE_SUFFIX"
DOCKER_IMAGEID_FILE="$SCRIPT_BASE/$PYTHON_SUFFIX.imageid"
DOCKER_PYTHON_BIN=${DOCKER_PYTHON_BIN:-"python3"}

# NOTE: portable dynamic lookup with docker as default and fallback to podman
DOCKER_BIN=$(command -v docker || command -v podman || echo "")
if [ -z "${DOCKER_BIN}" ]; then
echo "No docker binary found - cannot use for python $PY tests"
echo "No docker binary found - cannot use for python $PYVER tests"
exit 1
fi

Expand All @@ -66,7 +64,7 @@ MIG_ENV=${MIG_ENV:-'docker'}
PYTHONPYCACHEPREFIX="$PYTHONPATH/envhelp/output/__pycache.${PYTHON_SUFFIX}__"

# determine if the image has changed
echo -n "validating python $PY container.. "
echo -n "validating python $PYVER container.. "

# load a previously written docker image id if present
IMAGEID_STORED=$(cat "$DOCKER_IMAGEID_FILE" 2>/dev/null || echo "")
Expand All @@ -90,4 +88,4 @@ ${DOCKER_BIN} run -it --rm \
--env "PYTHONPATH=$PYTHONPATH" \
--env "PYTHONPYCACHEPREFIX=$PYTHONPYCACHEPREFIX" \
--env "MIG_ENV=$MIG_ENV" \
"$IMAGEID" python$PY $@
"$IMAGEID" "$DOCKER_PYTHON_BIN" $@
3 changes: 1 addition & 2 deletions envhelp/makeconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ SCRIPT_PATH=$(realpath "$0")
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH")
MIG_BASE=$(realpath "$SCRIPT_BASE/..")
PYTHON_BIN=${PYTHON_BIN:-"$SCRIPT_BASE/venv/bin/python3"}
PY=${PY:-'3'}

# default PYTHONPATH such that importing files in the repo "just works"
PYTHONPATH=${PYTHONPATH:-"$MIG_BASE"}

# default any variables for local development
MIG_ENV=${MIG_ENV:-'local'}

MIG_ENV="$MIG_ENV" PY="$PY" "$PYTHON_BIN" "$SCRIPT_BASE/makeconfig.py" "$@"
MIG_ENV="$MIG_ENV" "$PYTHON_BIN" "$SCRIPT_BASE/makeconfig.py" "$@"
33 changes: 0 additions & 33 deletions envhelp/python2

This file was deleted.

2 changes: 1 addition & 1 deletion envhelp/python3
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ set -e
SCRIPT_PATH=$(realpath "$0")
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH")

PY=3 $SCRIPT_BASE/dpython "$@"
$SCRIPT_BASE/dpython "$@"
Loading