diff --git a/makefile b/makefile index c63806c..de02d17 100644 --- a/makefile +++ b/makefile @@ -44,6 +44,14 @@ CONDA_ENV_NAMES := \ CONDA_ENV_PATHS := \ $(subst pypy,$(ENV_PREFIX)/$(PKG_NAME)_pypy,$(subst python=,$(ENV_PREFIX)/$(PKG_NAME)_py,$(subst .,,$(SUPPORTED_PYTHON_VERSIONS)))) +CONDA_ENV_BIN_PYTHON_PATHS := \ + $(shell echo "$(CONDA_ENV_PATHS)" \ + | sed 's!\(_py[[:digit:]]\+\)!\1/bin/python!g' \ + | sed 's!\(_pypy2[[:digit:]]\)!\1/bin/pypy!g' \ + | sed 's!\(_pypy3[[:digit:]]\)!\1/bin/pypy3!g' \ +) + + empty := literal_space := $(empty) $(empty) @@ -92,6 +100,7 @@ build/envs.txt: requirements/conda.txt @SUPPORTED_PYTHON_VERSIONS="$(SUPPORTED_PYTHON_VERSIONS)" \ CONDA_ENV_NAMES="$(CONDA_ENV_NAMES)" \ CONDA_ENV_PATHS="$(CONDA_ENV_PATHS)" \ + CONDA_ENV_BIN_PYTHON_PATHS="$(CONDA_ENV_BIN_PYTHON_PATHS)" \ CONDA_BIN="$(CONDA_BIN)" \ bash scripts/setup_conda_envs.sh; @@ -109,6 +118,7 @@ build/deps.txt: build/envs.txt requirements/*.txt @SUPPORTED_PYTHON_VERSIONS="$(SUPPORTED_PYTHON_VERSIONS)" \ CONDA_ENV_NAMES="$(CONDA_ENV_NAMES)" \ CONDA_ENV_PATHS="$(CONDA_ENV_PATHS)" \ + CONDA_ENV_BIN_PYTHON_PATHS="$(CONDA_ENV_BIN_PYTHON_PATHS)" \ CONDA_BIN="$(CONDA_BIN)" \ bash scripts/update_conda_env_deps.sh; @@ -131,9 +141,8 @@ build/deps.txt: build/envs.txt requirements/*.txt @rm -f build/deps.txt.tmp; - @for env_name in $(CONDA_ENV_NAMES); do \ - env_py="$(ENV_PREFIX)/$${env_name}/bin/python"; \ - printf "\n# pip freeze for $${env_name}:\n" >> build/deps.txt.tmp; \ + @for env_py in $(CONDA_ENV_BIN_PYTHON_PATHS); do \ + printf "\n# pip freeze for $${env_py}:\n" >> build/deps.txt.tmp; \ $${env_py} -m pip freeze >> build/deps.txt.tmp; \ printf "\n\n" >> build/deps.txt.tmp; \ done diff --git a/makefile.extra.make b/makefile.extra.make index 0068ea2..4d4302b 100644 --- a/makefile.extra.make +++ b/makefile.extra.make @@ -16,14 +16,6 @@ compat_test/%.py: test/%.py mv $@.tmp $@; -CONDA_ENV_PYS := \ - $(shell echo "$(CONDA_ENV_PATHS)" \ - | sed 's!\(_py[[:digit:]]\+\)!\1/bin/python!g' \ - | sed 's!\(_pypy2[[:digit:]]\)!\1/bin/pypy!g' \ - | sed 's!\(_pypy3[[:digit:]]\)!\1/bin/pypy3!g' \ -) - - ## Run pytest integration tests .PHONY: test_compat test_compat: $(COMPAT_TEST_FILES) @@ -36,7 +28,7 @@ test_compat: $(COMPAT_TEST_FILES) mkdir -p build/test_wheel; $(DEV_ENV_PY) setup.py bdist_wheel --dist-dir build/test_wheel; - IFS=' ' read -r -a env_pys <<< "$(CONDA_ENV_PYS)"; \ + IFS=' ' read -r -a env_pys <<< "$(CONDA_ENV_BIN_PYTHON_PATHS)"; \ for i in $${!env_pys[@]}; do \ env_py=$${env_pys[i]}; \ $${env_py} -m pip install --upgrade build/test_wheel/*.whl; \ diff --git a/requirements/conda.txt b/requirements/conda.txt index 67ba6a0..d58bfc3 100644 --- a/requirements/conda.txt +++ b/requirements/conda.txt @@ -33,9 +33,5 @@ # speed, security, and simplicity. # pyblake2 -# pytest is required in every environment to run the test suite -# against the installed modules. -pytest - # needed for mypy coverage report lxml diff --git a/scripts/setup_conda_envs.sh b/scripts/setup_conda_envs.sh index 11b16b4..230c82c 100755 --- a/scripts/setup_conda_envs.sh +++ b/scripts/setup_conda_envs.sh @@ -1,12 +1,11 @@ #!/bin/bash -read -r -a env_paths <<< "${CONDA_ENV_PATHS//, /$IFS}"; read -r -a env_names <<< "${CONDA_ENV_NAMES//, /$IFS}"; +read -r -a env_py_paths <<< "${CONDA_ENV_BIN_PYTHON_PATHS//, /$IFS}"; read -r -a py_versions <<< "${SUPPORTED_PYTHON_VERSIONS//, /$IFS}"; -for i in ${!env_paths[@]}; do - env_path=${env_paths[i]}; - env_path_python=${env_path}/bin/python; +for i in ${!env_py_paths[@]}; do + env_path_python=${env_py_paths[i]}; env_name=${env_names[i]}; py_version=${py_versions[i]}; @@ -19,6 +18,8 @@ for i in ${!env_paths[@]}; do ${CONDA_BIN} install --name ${env_name} --channel conda-forge --yes --quiet \ $(grep -o '^[^#][^ ]*' requirements/conda.txt) + ${env_path_python} -m ensurepip; + ${env_path_python} --version >> build/envs.txt.tmp \ 2>>build/envs.txt.tmp \ 1>>build/envs.txt.tmp; diff --git a/scripts/update_conda_env_deps.sh b/scripts/update_conda_env_deps.sh index c578f3d..fb80e6f 100755 --- a/scripts/update_conda_env_deps.sh +++ b/scripts/update_conda_env_deps.sh @@ -1,17 +1,22 @@ #!/bin/bash -read -r -a env_paths <<< "${CONDA_ENV_PATHS//, /$IFS}"; +read -r -a env_py_paths <<< "${CONDA_ENV_BIN_PYTHON_PATHS//, /$IFS}"; read -r -a env_names <<< "${CONDA_ENV_NAMES//, /$IFS}"; -for i in ${!env_paths[@]}; do - env_path=${env_paths[i]}; - env_path_python=${env_path}/bin/python; +for i in ${!env_py_paths[@]}; do + env_path_python=${env_py_paths[i]}; env_name=${env_names[i]}; ${env_path_python} -m pip install --upgrade --quiet pip; echo "updating ${env_name} pypi deps ..."; + # pytest is required in every environment to run the test suite + # against the installed modules. + ${env_path_python} -m pip install \ + --disable-pip-version-check --upgrade --quiet \ + pytest; + ${env_path_python} -m pip install \ --disable-pip-version-check --upgrade --quiet \ --requirement=requirements/pypi.txt;