Skip to content

Commit 5fb42a7

Browse files
albu-dikujonasbardino
authored andcommitted
Remove conditionality on PY variable from project bootstrap code.
This follows up the retirement of Python 2 by removing any provisions that were explicitly for it and its use as a bootstrap version.
1 parent 4a7e628 commit 5fb42a7

File tree

6 files changed

+12
-64
lines changed

6 files changed

+12
-64
lines changed

Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ LOCAL_PYTHON_BIN = './envhelp/lpython'
1010

1111
ifdef PYTHON_BIN
1212
LOCAL_PYTHON_BIN = $(PYTHON_BIN)
13-
else ifeq ($(PY),2)
14-
PYTHON_BIN = './envhelp/python2'
1513
else
1614
PYTHON_BIN = './envhelp/python3'
1715
endif
@@ -28,7 +26,7 @@ info:
2826
@echo "The following should help you get started:"
2927
@echo
3028
@echo "'make test' - run the test suite (default python 3)"
31-
@echo "'make PY=2 test' - run the test suite (default python 2)"
29+
@echo "'make PYVER=X.Y' - run the test suite (python version X.Y)"
3230
@echo "'make unittest' - execute tests locally for development"
3331

3432
.PHONY: fmt
@@ -41,7 +39,6 @@ endif
4139

4240
.PHONY: clean
4341
clean:
44-
@rm -f ./envhelp/py2.imageid
4542
@rm -f ./envhelp/py3.imageid
4643
@rm -f ./envhelp/local.depends
4744

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

6360
.PHONY: dependencies
64-
ifeq ($(PY),2)
65-
dependencies: ./envhelp/local.depends
66-
else
6761
dependencies: ./envhelp/venv/pyvenv.cfg ./envhelp/local.depends
68-
endif
6962

7063
.PHONY: testconfig
7164
testconfig: ./envhelp/output/testconfs

envhelp/docker/Dockerfile.py2

Lines changed: 0 additions & 9 deletions
This file was deleted.

envhelp/dpython

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,24 @@ SCRIPT_PATH=$(realpath "$0")
3131
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH")
3232
MIG_BASE=$(realpath "$SCRIPT_BASE/..")
3333

34-
if [ -n "${PY}" ]; then
35-
PYVER="$PY"
36-
PYTHON_SUFFIX="py$PY"
37-
DOCKER_FILE_SUFFIX="$PYTHON_SUFFIX"
38-
elif [ -n "${PYVER}" ]; then
39-
PY=3
34+
if [ -n "${PYVER}" ]; then
4035
PYTHON_SUFFIX="pyver_$PYVER"
4136
DOCKER_FILE_SUFFIX="pyver"
4237
else
43-
echo "No python version specified - please supply a PY env var"
44-
exit 1
38+
echo "No specific python version chosen - defaulting to supported baseline"
39+
PYVER="3 (default)"
40+
PYTHON_SUFFIX="py3"
41+
DOCKER_FILE_SUFFIX="py3"
4542
fi
4643

4744
DOCKER_FILE="$SCRIPT_BASE/docker/Dockerfile.$DOCKER_FILE_SUFFIX"
4845
DOCKER_IMAGEID_FILE="$SCRIPT_BASE/$PYTHON_SUFFIX.imageid"
46+
DOCKER_PYTHON_BIN=${DOCKER_PYTHON_BIN:-"python3"}
4947

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

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

6866
# determine if the image has changed
69-
echo -n "validating python $PY container.. "
67+
echo -n "validating python $PYVER container.. "
7068

7169
# load a previously written docker image id if present
7270
IMAGEID_STORED=$(cat "$DOCKER_IMAGEID_FILE" 2>/dev/null || echo "")
@@ -90,4 +88,4 @@ ${DOCKER_BIN} run -it --rm \
9088
--env "PYTHONPATH=$PYTHONPATH" \
9189
--env "PYTHONPYCACHEPREFIX=$PYTHONPYCACHEPREFIX" \
9290
--env "MIG_ENV=$MIG_ENV" \
93-
"$IMAGEID" python$PY $@
91+
"$IMAGEID" "$DOCKER_PYTHON_BIN" $@

envhelp/makeconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ SCRIPT_PATH=$(realpath "$0")
3131
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH")
3232
MIG_BASE=$(realpath "$SCRIPT_BASE/..")
3333
PYTHON_BIN=${PYTHON_BIN:-"$SCRIPT_BASE/venv/bin/python3"}
34-
PY=${PY:-'3'}
3534

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

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

42-
MIG_ENV="$MIG_ENV" PY="$PY" "$PYTHON_BIN" "$SCRIPT_BASE/makeconfig.py" "$@"
41+
MIG_ENV="$MIG_ENV" "$PYTHON_BIN" "$SCRIPT_BASE/makeconfig.py" "$@"

envhelp/python2

Lines changed: 0 additions & 33 deletions
This file was deleted.

envhelp/python3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ set -e
3030
SCRIPT_PATH=$(realpath "$0")
3131
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH")
3232

33-
PY=3 $SCRIPT_BASE/dpython "$@"
33+
$SCRIPT_BASE/dpython "$@"

0 commit comments

Comments
 (0)