diff --git a/ci_scripts/gendoc.sh b/ci_scripts/gendoc.sh index f7377d0d3bc..a3874f1dac5 100755 --- a/ci_scripts/gendoc.sh +++ b/ci_scripts/gendoc.sh @@ -15,9 +15,31 @@ export DOCROOT # install paddle if not installed yet. # PADDLE_WHL is defined in ci_start.sh -pip3 list --disable-pip-version-check | grep paddlepaddle > /dev/null -if [ $? -ne 0 ] ; then - pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple ${PADDLE_WHL} +if ! pip3 list --disable-pip-version-check | grep paddlepaddle; then + echo "Paddle is not found, attempting to install from ${PADDLE_WHL}..." + + # Install logic: + # - If PADDLE_WHL is a .whl file URL: download and install locally + # - Otherwise: install directly via pip (supports package names and other URLs) + if [[ "${PADDLE_WHL}" == *.whl ]]; then + echo "Downloading wheel file: ${PADDLE_WHL}" + wget -q ${PADDLE_WHL} -O /tmp/paddle.whl + if [ $? -ne 0 ]; then + echo -e "\e[31mError: Failed to download wheel file from ${PADDLE_WHL}\e[0m" + exit 1 + fi + echo "Installing local wheel file..." + pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple /tmp/paddle.whl + else + echo "Using pip install directly..." + pip3 install --no-cache-dir -q --progress-bar off -i https://pypi.tuna.tsinghua.edu.cn/simple ${PADDLE_WHL} + fi + + if [ $? -ne 0 ]; then + echo -e "\e[31mError: Failed to install paddle from ${PADDLE_WHL}\e[0m" + exit 1 + fi + echo "Paddle installed successfully." fi