Skip to content

Commit 1b91071

Browse files
authored
[CI] Explicit exit when pip install whl_url failed (#7591)
1 parent 6571d61 commit 1b91071

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

ci_scripts/gendoc.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,31 @@ export DOCROOT
1515

1616
# install paddle if not installed yet.
1717
# PADDLE_WHL is defined in ci_start.sh
18-
pip3 list --disable-pip-version-check | grep paddlepaddle > /dev/null
19-
if [ $? -ne 0 ] ; then
20-
pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple ${PADDLE_WHL}
18+
if ! pip3 list --disable-pip-version-check | grep paddlepaddle; then
19+
echo "Paddle is not found, attempting to install from ${PADDLE_WHL}..."
20+
21+
# Install logic:
22+
# - If PADDLE_WHL is a .whl file URL: download and install locally
23+
# - Otherwise: install directly via pip (supports package names and other URLs)
24+
if [[ "${PADDLE_WHL}" == *.whl ]]; then
25+
echo "Downloading wheel file: ${PADDLE_WHL}"
26+
wget -q ${PADDLE_WHL} -O /tmp/paddle.whl
27+
if [ $? -ne 0 ]; then
28+
echo -e "\e[31mError: Failed to download wheel file from ${PADDLE_WHL}\e[0m"
29+
exit 1
30+
fi
31+
echo "Installing local wheel file..."
32+
pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple /tmp/paddle.whl
33+
else
34+
echo "Using pip install directly..."
35+
pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple ${PADDLE_WHL}
36+
fi
37+
38+
if [ $? -ne 0 ]; then
39+
echo -e "\e[31mError: Failed to install paddle from ${PADDLE_WHL}\e[0m"
40+
exit 1
41+
fi
42+
echo "Paddle installed successfully."
2143
fi
2244

2345

0 commit comments

Comments
 (0)