diff --git a/scripts/prepare-fnos-dependencies.sh b/scripts/prepare-fnos-dependencies.sh index 69ac7bb..7357144 100755 --- a/scripts/prepare-fnos-dependencies.sh +++ b/scripts/prepare-fnos-dependencies.sh @@ -5,6 +5,8 @@ ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) PYTHON_BIN=${PYTHON:-python3} WHEELHOUSE=${IMAGEFIND_WHEEL_CACHE:-$ROOT_DIR/.fnos-wheel-cache/python312} DOWNLOAD_ROOT=${IMAGEFIND_DEPENDENCY_TMPDIR:-${TMPDIR:-/tmp}} +PIP_INDEX_URL=${PIP_INDEX_URL:-https://pypi.tuna.tsinghua.edu.cn/simple} +PIP_TIMEOUT=${PIP_TIMEOUT:-60} OPENCL_URL=https://deb.debian.org/debian/pool/main/o/ocl-icd/ocl-icd-libopencl1_2.2.14-2_amd64.deb OPENCL_SHA256=f3367b78f2548e6211e23081b3e0f144babfcc906c5bdbbe0d5e41915de70128 @@ -13,6 +15,7 @@ for command_name in curl dpkg-deb find install sha256sum; do command -v "$comman mkdir -p "$WHEELHOUSE" "$ROOT_DIR/vendor" "$DOWNLOAD_ROOT" "$PYTHON_BIN" -m pip download --disable-pip-version-check --only-binary=:all: \ + --index-url "$PIP_INDEX_URL" --timeout "$PIP_TIMEOUT" --retries 4 \ --implementation cp --python-version 312 --abi cp312 \ --platform manylinux_2_28_x86_64 --platform manylinux_2_27_x86_64 \ --platform manylinux2014_x86_64 --platform manylinux2010_x86_64 --platform manylinux1_x86_64 \ diff --git a/tests/test_fnos_dependency_script.py b/tests/test_fnos_dependency_script.py new file mode 100644 index 0000000..09ab4e2 --- /dev/null +++ b/tests/test_fnos_dependency_script.py @@ -0,0 +1,8 @@ +from pathlib import Path + + +def test_fnos_dependency_download_uses_fast_configurable_index() -> None: + script = (Path(__file__).parents[1] / "scripts" / "prepare-fnos-dependencies.sh").read_text() + assert "PIP_INDEX_URL=${PIP_INDEX_URL:-https://pypi.tuna.tsinghua.edu.cn/simple}" in script + assert '--index-url "$PIP_INDEX_URL"' in script + assert '--timeout "$PIP_TIMEOUT" --retries 4' in script