Skip to content

Commit 6231755

Browse files
Merge pull request #929 from LalatenduMohanty/use-fromager-wheel-server-in-e2e
refactor(e2e): use fromager wheel-server instead of stdlib http.server
2 parents f4a13d0 + 8cc0080 commit 6231755

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

e2e/common.sh

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,23 @@ on_exit() {
6666
trap on_exit EXIT SIGINT SIGTERM
6767

6868
start_local_wheel_server() {
69-
local serve_dir="${1:-$OUTDIR/wheels-repo/}"
70-
# Determine the bind address and the URL that clients will use.
71-
# On Linux podman can't reach localhost, so we bind to 0.0.0.0 and
72-
# advertise the host's routable IP. On macOS there is no network
73-
# isolation; we bind explicitly to 127.0.0.1 to avoid IPv6-only
74-
# sockets that python3 -m http.server may create by default.
75-
if command -v ip >/dev/null 2>&1; then
76-
local BIND_ADDR="0.0.0.0"
77-
IP=$(ip route get 1.1.1.1 | grep 1.1.1.1 | awk '{print $7}')
78-
else
79-
local BIND_ADDR="127.0.0.1"
80-
IP=127.0.0.1
81-
fi
82-
python3 -m http.server --bind "$BIND_ADDR" --directory "$serve_dir" 9999 &
69+
local serve_dir="${1:-$OUTDIR/wheels-repo}"
70+
# Use the builtin fromager wheel-server (Starlette/uvicorn) instead of
71+
# stdlib http.server. Binding to 127.0.0.1 is safe on all platforms
72+
# because uv pip install always runs on the host without network
73+
# isolation (build_environment.py hardcodes network_isolation=False).
74+
fromager \
75+
--wheels-repo="$serve_dir" \
76+
wheel-server --port 9999 --address 127.0.0.1 &
8377
HTTP_SERVER_PID=$!
84-
export WHEEL_SERVER_URL="http://${IP}:9999/simple"
78+
export WHEEL_SERVER_URL="http://127.0.0.1:9999/simple"
8579

8680
# Wait for the server to accept connections (up to 15 s).
8781
{ set +x; } 2>/dev/null
8882
local ready=false
8983
for _ in $(seq 1 30); do
9084
kill -0 "$HTTP_SERVER_PID" 2>/dev/null || break
91-
curl -sf "http://${IP}:9999/" >/dev/null 2>&1 && { ready=true; break; }
85+
curl -sf "http://127.0.0.1:9999/simple" >/dev/null 2>&1 && { ready=true; break; }
9286
sleep 0.5
9387
done
9488
set -x

0 commit comments

Comments
 (0)