diff --git a/.ci_support/migrations/python39.yaml b/.ci_support/migrations/python39.yaml deleted file mode 100644 index 1c915c1..0000000 --- a/.ci_support/migrations/python39.yaml +++ /dev/null @@ -1,27 +0,0 @@ -migrator_ts: 1602104489 -__migrator: - migration_number: 2 - operation: key_add - primary_key: python - ordering: - python: - - 3.6.* *_cpython - - 3.7.* *_cpython - - 3.8.* *_cpython - - 3.9.* *_cpython # new entry - - 3.6.* *_73_pypy - paused: false - longterm: True - pr_limit: 50 - exclude: - # this shouldn't attempt to modify the python feedstocks - - python - - pypy3.6 - - pypy-meta -python: - - 3.9.* *_cpython -# additional entries to add for zip_keys -numpy: - - 1.19 -python_impl: - - cpython diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index 7fbce05..99baf86 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -10,9 +10,10 @@ export FEEDSTOCK_ROOT="${FEEDSTOCK_ROOT:-/home/conda/feedstock_root}" source ${FEEDSTOCK_ROOT}/.scripts/logging_utils.sh -endgroup "Start Docker" +( endgroup "Start Docker" ) 2> /dev/null + +( startgroup "Configuring conda" ) 2> /dev/null -startgroup "Configuring conda" export PYTHONUNBUFFERED=1 export RECIPE_ROOT="${RECIPE_ROOT:-/home/conda/recipe_root}" export CI_SUPPORT="${FEEDSTOCK_ROOT}/.ci_support" @@ -40,34 +41,38 @@ if [[ "${HOST_PLATFORM}" != "${BUILD_PLATFORM}" ]] && [[ "${BUILD_WITH_CONDA_DEB EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --no-test" fi -endgroup "Configuring conda" + +( endgroup "Configuring conda" ) 2> /dev/null if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then - startgroup "Running conda debug" if [[ "x${BUILD_OUTPUT_ID:-}" != "x" ]]; then EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --output-id ${BUILD_OUTPUT_ID}" fi conda debug "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ ${EXTRA_CB_OPTIONS:-} \ --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" - endgroup "Running conda debug" + # Drop into an interactive shell /bin/bash else - startgroup "Running conda $BUILD_CMD" conda $BUILD_CMD "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" - endgroup "Running conda build" - startgroup "Validating outputs" + ( startgroup "Validating outputs" ) 2> /dev/null + validate_recipe_outputs "${FEEDSTOCK_NAME}" - endgroup "Validating outputs" + + ( endgroup "Validating outputs" ) 2> /dev/null + + ( startgroup "Uploading packages" ) 2> /dev/null if [[ "${UPLOAD_PACKAGES}" != "False" ]]; then - startgroup "Uploading packages" upload_package --validate --feedstock-name="${FEEDSTOCK_NAME}" "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" - endgroup "Uploading packages" fi + + ( endgroup "Uploading packages" ) 2> /dev/null fi +( startgroup "Final checks" ) 2> /dev/null + touch "${FEEDSTOCK_ROOT}/build_artifacts/conda-forge-build-done-${CONFIG}" \ No newline at end of file diff --git a/.scripts/logging_utils.sh b/.scripts/logging_utils.sh index a53ef3f..57bc95c 100644 --- a/.scripts/logging_utils.sh +++ b/.scripts/logging_utils.sh @@ -13,18 +13,23 @@ function startgroup { travis ) echo "$1" echo -en 'travis_fold:start:'"${1// /}"'\\r';; + github_actions ) + echo "::group::$1";; * ) echo "$1";; esac -} +} 2> /dev/null function endgroup { # End a foldable group of log lines # Pass a single argument, quoted + case ${CI:-} in azure ) echo "##[endgroup]";; travis ) echo -en 'travis_fold:end:'"${1// /}"'\\r';; + github_actions ) + echo "::endgroup::";; esac -} +} 2> /dev/null diff --git a/.scripts/run_docker_build.sh b/.scripts/run_docker_build.sh index 16d6c15..244ccd1 100755 --- a/.scripts/run_docker_build.sh +++ b/.scripts/run_docker_build.sh @@ -7,7 +7,7 @@ source .scripts/logging_utils.sh -startgroup "Configure Docker" +( startgroup "Configure Docker" ) 2> /dev/null set -xeo pipefail @@ -52,11 +52,11 @@ if [ -z "${DOCKER_IMAGE}" ]; then echo "WARNING: DOCKER_IMAGE variable not set and shyaml not installed. Trying to parse with coreutils" DOCKER_IMAGE=$(cat .ci_support/${CONFIG}.yaml | grep '^docker_image:$' -A 1 | tail -n 1 | cut -b 3-) if [ "${DOCKER_IMAGE}" = "" ]; then - echo "No docker_image entry found in ${CONFIG}. Falling back to condaforge/linux-anvil-comp7" - DOCKER_IMAGE="condaforge/linux-anvil-comp7" + echo "No docker_image entry found in ${CONFIG}. Falling back to quay.io/condaforge/linux-anvil-comp7" + DOCKER_IMAGE="quay.io/condaforge/linux-anvil-comp7" fi else - DOCKER_IMAGE="$(cat "${FEEDSTOCK_ROOT}/.ci_support/${CONFIG}.yaml" | shyaml get-value docker_image.0 condaforge/linux-anvil-comp7 )" + DOCKER_IMAGE="$(cat "${FEEDSTOCK_ROOT}/.ci_support/${CONFIG}.yaml" | shyaml get-value docker_image.0 quay.io/condaforge/linux-anvil-comp7 )" fi fi @@ -69,9 +69,11 @@ DOCKER_RUN_ARGS="${CONDA_FORGE_DOCKER_RUN_ARGS}" if [ -z "${CI}" ]; then DOCKER_RUN_ARGS="-it ${DOCKER_RUN_ARGS}" fi -endgroup "Configure Docker" -startgroup "Start Docker" +( endgroup "Configure Docker" ) 2> /dev/null + +( startgroup "Start Docker" ) 2> /dev/null + export UPLOAD_PACKAGES="${UPLOAD_PACKAGES:-True}" docker run ${DOCKER_RUN_ARGS} \ -v "${RECIPE_ROOT}":/home/conda/recipe_root:rw,z,delegated \ @@ -94,4 +96,7 @@ docker run ${DOCKER_RUN_ARGS} \ /home/conda/feedstock_root/${PROVIDER_DIR}/build_steps.sh # verify that the end of the script was reached -test -f "$DONE_CANARY" \ No newline at end of file +test -f "$DONE_CANARY" + +# This closes the last group opened in `build_steps.sh` +( endgroup "Final checks" ) 2> /dev/null \ No newline at end of file diff --git a/.scripts/run_osx_build.sh b/.scripts/run_osx_build.sh index 7688497..708b1e1 100755 --- a/.scripts/run_osx_build.sh +++ b/.scripts/run_osx_build.sh @@ -2,19 +2,24 @@ source .scripts/logging_utils.sh -set -x +set -xe + +MINIFORGE_HOME=${MINIFORGE_HOME:-${HOME}/miniforge3} + +( startgroup "Installing a fresh version of Miniforge" ) 2> /dev/null -startgroup "Installing a fresh version of Miniforge" MINIFORGE_URL="https://github.com/conda-forge/miniforge/releases/latest/download" MINIFORGE_FILE="Miniforge3-MacOSX-x86_64.sh" curl -L -O "${MINIFORGE_URL}/${MINIFORGE_FILE}" -bash $MINIFORGE_FILE -b -endgroup "Installing a fresh version of Miniforge" +bash $MINIFORGE_FILE -b -p ${MINIFORGE_HOME} + +( endgroup "Installing a fresh version of Miniforge" ) 2> /dev/null + +( startgroup "Configuring conda" ) 2> /dev/null -startgroup "Configuring conda" BUILD_CMD=build -source ${HOME}/miniforge3/etc/profile.d/conda.sh +source ${MINIFORGE_HOME}/etc/profile.d/conda.sh conda activate base echo -e "\n\nInstalling conda-forge-ci-setup=3 and conda-build." @@ -24,21 +29,27 @@ conda install -n base --quiet --yes "conda-forge-ci-setup=3" conda-build pip ${G echo -e "\n\nSetting up the condarc and mangling the compiler." setup_conda_rc ./ ./recipe ./.ci_support/${CONFIG}.yaml -mangle_compiler ./ ./recipe .ci_support/${CONFIG}.yaml -echo -e "\n\nMangling homebrew in the CI to avoid conflicts." -/usr/bin/sudo mangle_homebrew -/usr/bin/sudo -k +if [[ "${CI:-}" != "" ]]; then + mangle_compiler ./ ./recipe .ci_support/${CONFIG}.yaml +fi + +if [[ "${CI:-}" != "" ]]; then + echo -e "\n\nMangling homebrew in the CI to avoid conflicts." + /usr/bin/sudo mangle_homebrew + /usr/bin/sudo -k +else + echo -e "\n\nNot mangling homebrew as we are not running in CI" +fi echo -e "\n\nRunning the build setup script." source run_conda_forge_build_setup -endgroup "Configuring conda" -set -e +( endgroup "Configuring conda" ) 2> /dev/null + -startgroup "Running conda $BUILD_CMD" echo -e "\n\nMaking the build clobber file" make_build_number ./ ./recipe ./.ci_support/${CONFIG}.yaml @@ -47,13 +58,16 @@ if [[ "${HOST_PLATFORM}" != "${BUILD_PLATFORM}" ]]; then fi conda $BUILD_CMD ./recipe -m ./.ci_support/${CONFIG}.yaml --suppress-variables --clobber-file ./.ci_support/clobber_${CONFIG}.yaml ${EXTRA_CB_OPTIONS:-} -endgroup "Running conda build" -startgroup "Validating outputs" +( startgroup "Validating outputs" ) 2> /dev/null + validate_recipe_outputs "${FEEDSTOCK_NAME}" -endgroup "Validating outputs" + +( endgroup "Validating outputs" ) 2> /dev/null + +( startgroup "Uploading packages" ) 2> /dev/null if [[ "${UPLOAD_PACKAGES}" != "False" ]]; then - startgroup "Uploading packages" upload_package --validate --feedstock-name="${FEEDSTOCK_NAME}" ./ ./recipe ./.ci_support/${CONFIG}.yaml - endgroup "Uploading packages" -fi \ No newline at end of file +fi + +( endgroup "Uploading packages" ) 2> /dev/null \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index b79c621..94f6727 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,22 +10,27 @@ matrix: - env: CONFIG=linux_ppc64le_python3.6.____73_pypypython_implpypy UPLOAD_PACKAGES=True PLATFORM=linux-ppc64le DOCKER_IMAGE=quay.io/condaforge/linux-anvil-ppc64le os: linux arch: ppc64le + dist: focal - env: CONFIG=linux_ppc64le_python3.6.____cpythonpython_implcpython UPLOAD_PACKAGES=True PLATFORM=linux-ppc64le DOCKER_IMAGE=quay.io/condaforge/linux-anvil-ppc64le os: linux arch: ppc64le + dist: focal - env: CONFIG=linux_ppc64le_python3.7.____cpythonpython_implcpython UPLOAD_PACKAGES=True PLATFORM=linux-ppc64le DOCKER_IMAGE=quay.io/condaforge/linux-anvil-ppc64le os: linux arch: ppc64le + dist: focal - env: CONFIG=linux_ppc64le_python3.8.____cpythonpython_implcpython UPLOAD_PACKAGES=True PLATFORM=linux-ppc64le DOCKER_IMAGE=quay.io/condaforge/linux-anvil-ppc64le os: linux arch: ppc64le + dist: focal - env: CONFIG=linux_ppc64le_python3.9.____cpythonpython_implcpython UPLOAD_PACKAGES=True PLATFORM=linux-ppc64le DOCKER_IMAGE=quay.io/condaforge/linux-anvil-ppc64le os: linux arch: ppc64le + dist: focal script: - export CI=travis diff --git a/README.md b/README.md index 17d1bd1..84302e8 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ Installing `anyio` from the `conda-forge` channel can be achieved by adding `con ``` conda config --add channels conda-forge +conda config --set channel_priority strict ``` Once the `conda-forge` channel has been enabled, `anyio` can be installed with: diff --git a/build-locally.py b/build-locally.py index 3453cfe..00eeb34 100755 --- a/build-locally.py +++ b/build-locally.py @@ -7,6 +7,7 @@ import glob import subprocess from argparse import ArgumentParser +import platform def setup_environment(ns): @@ -16,6 +17,10 @@ def setup_environment(ns): os.environ["BUILD_WITH_CONDA_DEBUG"] = "1" if ns.output_id: os.environ["BUILD_OUTPUT_ID"] = ns.output_id + if "MINIFORGE_HOME" not in os.environ: + os.environ["MINIFORGE_HOME"] = os.path.join( + os.path.dirname(__file__), "miniforge3" + ) def run_docker_build(ns): @@ -23,6 +28,11 @@ def run_docker_build(ns): subprocess.check_call([script]) +def run_osx_build(ns): + script = ".scripts/run_osx_build.sh" + subprocess.check_call([script]) + + def verify_config(ns): valid_configs = { os.path.basename(f)[:-5] for f in glob.glob(".ci_support/*.yaml") @@ -46,10 +56,16 @@ def verify_config(ns): else: raise ValueError("config " + ns.config + " is not valid") # Remove the following, as implemented - if not ns.config.startswith("linux"): + if ns.config.startswith("win"): raise ValueError( - f"only Linux configs currently supported, got {ns.config}" + f"only Linux/macOS configs currently supported, got {ns.config}" ) + elif ns.config.startswith("osx") and platform.system() == "Darwin": + if "OSX_SDK_DIR" not in os.environ: + raise RuntimeError( + "Need OSX_SDK_DIR env variable set. Run 'export OSX_SDK_DIR=/opt'" + "to download the SDK automatically to '/opt/MacOSX.sdk'" + ) def main(args=None): @@ -68,7 +84,12 @@ def main(args=None): verify_config(ns) setup_environment(ns) - run_docker_build(ns) + if ns.config.startswith("linux") or ( + ns.config.startswith("osx") and platform.system() == "Linux" + ): + run_docker_build(ns) + elif ns.config.startswith("osx"): + run_osx_build(ns) if __name__ == "__main__": diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 92b3a2a..7125be0 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,5 +1,5 @@ {% set name = "anyio" %} -{% set version = "2.2.0" %} +{% set version = "3.0.1" %} package: name: {{ name|lower }} @@ -8,10 +8,10 @@ package: source: - folder: dist url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz - sha256: 4a41c5b3a65ed92e469d51b6fba3779301850ea2e352afcf9e36c46f21ee14a9 + sha256: 1ef7622396ab55829d4236a6f75e2199df6d26a4ba79bea0cb942a5fd2f79a23 - folder: src url: https://github.com/agronholm/{{ name }}/archive/{{ version }}.tar.gz - sha256: c1b748c399cc1051af7663d9765777d695534c17943285403c5bce993a34cd20 + sha256: 45f4169148897135b3e4471a803acea443edc3e18654861dcbacd9faa182f49b build: number: 0 @@ -25,7 +25,7 @@ requirements: host: - pip - python - - setuptools_scm + - setuptools-scm run: - async_generator # [py<37] - dataclasses # [py<37] @@ -35,22 +35,21 @@ requirements: - typing_extensions # [py<38] run_constrained: - trio >=0.16 - - curio >=1.4 test: source_files: - src/tests + - src/pyproject.toml requires: - coverage >=4.5 - - curio + - trio - hypothesis >=4.0 - pip - pytest >=6.0 - pytest-cov - toml - - trio - trustme - # TODO: won't be available on pypy + # won't be available on pypy, or windows, any time soon - uvloop # [unix and python_impl == 'cpython'] imports: - anyio diff --git a/recipe/run_test.py b/recipe/run_test.py index 369f278..f11bded 100644 --- a/recipe/run_test.py +++ b/recipe/run_test.py @@ -1,19 +1,21 @@ import os import sys +from pathlib import Path +import subprocess -import pytest +HERE = Path(__file__).parent print("preflighting uvloop...", flush=True) try: import uvloop - print("... uvloop _appears_ to be working!") + print(f"... uvloop {uvloop} _appears_ to be working!") except Exception as err: print(f"... uvloop import error, ignoring:\n{err}") COV_THRESHOLD = { - "win32": "68", - "linux": "71", - "darwin": "71" + "win32": "60", + "linux": "67", + "darwin": "67" }.get(sys.platform) SKIPS = [ @@ -26,10 +28,11 @@ "-vv", "--cov", os.environ["PKG_NAME"], "--cov-fail-under", COV_THRESHOLD, - "-k", f"""not ({" or ".join(SKIPS)})""", - "src" + "--cov-report", "term-missing:skip-covered", + "--no-cov-on-fail", + *(["-k", f"""not ({" or ".join(SKIPS)})"""] if SKIPS else []) ] print(">>> pytest", " ".join(PYTEST_ARGS), flush=True) -sys.exit(pytest.main(PYTEST_ARGS)) +sys.exit(subprocess.call(["pytest", *PYTEST_ARGS], cwd=str(HERE / "src")))