From ef35f51e5a460a4ffdd7fcfbfcc4b6ec48cf5f0b Mon Sep 17 00:00:00 2001 From: "Zhang, Jianyu" Date: Mon, 14 Oct 2024 15:10:34 +0800 Subject: [PATCH] update for bug fix and review comments --- scripts/build.sh | 21 +++++++++++++++------ scripts/requirements.txt | 7 ++++--- scripts/setup_env.sh | 2 +- scripts/show-versions.py | 13 ++++++------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 063ee6df..245ce56d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -12,7 +12,7 @@ pwd source $ENV_NAME/bin/activate #clone repos -for repo_name in GenAIComps GenAIEval GenAIExamples GenAIInfra opea-project.github.io; do +for repo_name in docs GenAIComps GenAIEval GenAIExamples GenAIInfra opea-project.github.io; do echo "prepare for $repo_name" if [[ "$1" == "f" ]]; then @@ -22,7 +22,6 @@ for repo_name in GenAIComps GenAIEval GenAIExamples GenAIInfra opea-project.gith if [ ! -d ${repo_name} ]; then URL=https://github.com/opea-project/${repo_name}.git - echo "git clone $URL" git clone $URL retval=$? @@ -33,7 +32,7 @@ for repo_name in GenAIComps GenAIEval GenAIExamples GenAIInfra opea-project.gith fi sleep 10 else - echo "found existed repo folder ${repo_name}, skip to clone" + echo "repo ${repo_name} exists, skipping cloning" fi done @@ -41,18 +40,28 @@ echo "Build HTML" cd docs make clean make html -echo "Build online doc done!" -echo "update github.io" +if [ ! -d _build/html ]; then + echo "Build online doc is wrong!" + exit 1 +else + echo "Build online doc done!" +fi + +echo "Update github.io" RELEASE_FOLDER=../opea-project.github.io BUILDDIR=_build PUBLISHDIR=${RELEASE_FOLDER}/latest +echo "Clear all content in ${PUBLISHDIR}" +rm -rf ${PUBLISHDIR}/* + +echo "Copy html content to ${PUBLISHDIR}" cp -r ${BUILDDIR}/html/* ${PUBLISHDIR} cp scripts/publish-README.md ${PUBLISHDIR}/../README.md bash scripts/publish-redirect.sh ${PUBLISHDIR}/../index.html latest/index.html sed 's//\n /' ${BUILDDIR}/html/404.html > ${PUBLISHDIR}/../404.html -echo "CP html to ${PUBLISHDIR}" +echo "Copied html content to ${PUBLISHDIR}" diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 4261cc2c..f17f22b4 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -4,6 +4,7 @@ sphinx_rtd_theme==2.0 sphinx-tabs==3.4.5 myst-parser>=3.0 sphinx-md==0.0.3 -sphinxcontrib-mermaid -pymarkdownlnt -sphinx-design +sphinxcontrib-mermaid==0.9.2 +pymarkdownlnt==0.9.24 +sphinx-design==0.6.1 +requirements-parser==0.11.0 diff --git a/scripts/setup_env.sh b/scripts/setup_env.sh index 9c826e98..32df9aa5 100755 --- a/scripts/setup_env.sh +++ b/scripts/setup_env.sh @@ -1,6 +1,6 @@ #!/bin/bash -sudo apt install git doxygen graphviz -y +sudo apt install git graphviz -y ENV_NAME=env_sphinx deactivate diff --git a/scripts/show-versions.py b/scripts/show-versions.py index 714f7087..3a10af18 100755 --- a/scripts/show-versions.py +++ b/scripts/show-versions.py @@ -7,7 +7,7 @@ import os.path import sys -import pkg_resources +import requirements import subprocess class color: @@ -28,15 +28,14 @@ class color: rf = open(reqfile, "r") -for reqs in pkg_resources.parse_requirements(rf): +for req in requirements.parse(rf): try: - ver = pkg_resources.get_distribution(reqs.project_name).version - print (" " + reqs.project_name.ljust(25," ") + " version: " + ver) - if not reqs.__contains__(ver): + print(" {} version: {}".format(req.name.ljust(25," "), req.specs)) + if len(req.specs) == 0: print (color.RED + color.BOLD + " >>> Warning: Expected version " + - reqs.__str__() + " Python module from scripts/requirements.text." + color.END) + req.name + " Python module from scripts/requirements.text." + color.END) except: - print (color.RED + color.BOLD + reqs.project_name + " is missing." + color.END + + print (color.RED + color.BOLD + req.name + " is missing." + color.END + " (Hint: install all dependencies with " + color.YELLOW + "\"pip3 install --user -r scripts/requirements.txt\"" + color.END + ")")