diff --git a/.gitignore b/.gitignore index 0bd78099b49..9708efd3418 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ lib_map.json .jekyll-cache .jekyll-metadata .netlify +__pycache__/ diff --git a/ci/customization/customize_doc.py b/ci/customization/customize_doc.py index 2a9a5eb1f3c..090f5f4c83f 100644 --- a/ci/customization/customize_doc.py +++ b/ci/customization/customize_doc.py @@ -8,8 +8,10 @@ import json import os from bs4 import BeautifulSoup +from util import r_versions FILEPATH = sys.argv[1] +IS_UCXX_FILE = len(sys.argv) > 2 and sys.argv[2] == "--is-ucxx" LIB_MAP_PATH = os.path.join(os.path.dirname(__file__), "lib_map.json") RELEASES_PATH = os.path.join( @@ -22,9 +24,11 @@ with open(RELEASES_PATH) as fp: release_data = json.load(fp) VERSIONS_DICT = { - "nightly": release_data["nightly"]["version"], - "stable": release_data["stable"]["version"], - "legacy": release_data["legacy"]["version"], + "nightly": release_data["nightly"][ + "ucxx_version" if IS_UCXX_FILE else "version" + ], + "stable": release_data["stable"]["ucxx_version" if IS_UCXX_FILE else "version"], + "legacy": release_data["legacy"]["ucxx_version" if IS_UCXX_FILE else "version"], } SCRIPT_TAG_ID = "rapids-selector-js" @@ -40,11 +44,11 @@ def get_version_from_fp(): based on the file path """ match = re.search(r"/(\d?\d\.\d\d)/", FILEPATH) - version_number_str = match.group(1) + version_number_str = r_versions(match.group(1)) version_name = "stable" - if version_number_str > VERSIONS_DICT["stable"]: + if version_number_str.is_greater_than(VERSIONS_DICT["stable"]): version_name = "nightly" - if version_number_str < VERSIONS_DICT["stable"]: + if version_number_str.is_less_than(VERSIONS_DICT["stable"]): version_name = "legacy" return {"name": version_name, "number": version_number_str} diff --git a/ci/customization/customize_docs_in_folder.sh b/ci/customization/customize_docs_in_folder.sh index 98d8c21a6e7..d86a5f5085d 100755 --- a/ci/customization/customize_docs_in_folder.sh +++ b/ci/customization/customize_docs_in_folder.sh @@ -46,7 +46,11 @@ for FILE in $(grep "${JTD_SEARCH_TERM}\|${DOXYGEN_SEARCH_TERM}\|${PYDATA_SEARCH_ --exclude-dir=legacy \ --exclude-dir=cudf-java \ ${FOLDER_TO_CUSTOMIZE} ); do - python ${SCRIPT_SRC_FOLDER}/customize_doc.py $(realpath ${FILE}) + if [[ ${FILE} == *"ucxx"* ]]; then + python ${SCRIPT_SRC_FOLDER}/customize_doc.py $(realpath ${FILE}) --is-ucxx + else + python ${SCRIPT_SRC_FOLDER}/customize_doc.py $(realpath ${FILE}) + fi echo "" # line break for readability done IFS="$OIFS" diff --git a/ci/customization/util.py b/ci/customization/util.py new file mode 100644 index 00000000000..0c7847e3621 --- /dev/null +++ b/ci/customization/util.py @@ -0,0 +1,17 @@ +class r_versions(str): + def compare(self, other: str) -> int: + yearA, monthA = map(int, self.split(".")) + yearB, monthB = map(int, other.split(".")) + + if yearA < yearB or (yearA == yearB and monthA < monthB): + return -1 + elif yearA == yearB and monthA == monthB: + return 0 + else: + return 1 + + def is_less_than(self, other: str) -> bool: + return self.compare(other) == -1 + + def is_greater_than(self, other: str) -> bool: + return self.compare(other) == 1 diff --git a/ci/download_from_s3.sh b/ci/download_from_s3.sh index 510af41face..3f16600ba21 100755 --- a/ci/download_from_s3.sh +++ b/ci/download_from_s3.sh @@ -63,26 +63,26 @@ download_lib_docs() { SRC VERSION_MAP VERSION_NAME \ VERSION_NUMBER - VERSION_MAP=$( - jq '{ - "legacy": .legacy.version, - "stable": .stable.version, - "nightly": .nightly.version - }' _data/releases.json - ) - export VERSION_MAP + VERSION_MAP=$(jq '{ + "legacy": { "version": .legacy.version, "ucxx_version": .legacy.ucxx_version }, + "stable": { "version": .stable.version, "ucxx_version": .stable.ucxx_version }, + "nightly": { "version": .nightly.version, "ucxx_version": .nightly.ucxx_version } + }' _data/releases.json) PROJECT_MAP=$(yq '.apis + .libs' _data/docs.yml) - export PROJECT_MAP - - for VERSION_NAME in $(jq -nr 'env.VERSION_MAP | fromjson | keys | .[]'); do - for PROJECT in $(yq -n 'env(PROJECT_MAP) | keys | .[]'); do - export VERSION_NAME PROJECT - VERSION_NUMBER=$(jq -nr 'env.VERSION_MAP | fromjson | .[env.VERSION_NAME]') - - if yq -en 'env(PROJECT_MAP) | .[strenv(PROJECT)].versions.[strenv(VERSION_NAME)] == 0' > /dev/null 2>&1; then - echo "skipping: $PROJECT | $VERSION_NAME | $VERSION_NUMBER" + for VERSION_NAME in $(jq -r 'keys | .[]' <<< "$VERSION_MAP"); do + for PROJECT in $(yq -r 'keys | .[]' <<< "$PROJECT_MAP"); do + VERSION_NUMBER=$(jq -r --arg vn "$VERSION_NAME" --arg pr "$PROJECT" ' + if ($pr | contains("ucxx")) then + .[$vn].ucxx_version + else + .[$vn].version + end' <<< "$VERSION_MAP") + + PROJECT_MAP_JSON=$(yq -r -o json '.' <<< "$PROJECT_MAP") + if [ "$(jq -r --arg pr "$PROJECT" --arg vn "$VERSION_NAME" '.[$pr].versions[$vn]' <<< "$PROJECT_MAP_JSON")" == "0" ]; then + echo "Skipping: $PROJECT | $VERSION_NAME | $VERSION_NUMBER" continue fi diff --git a/ci/update_symlinks.sh b/ci/update_symlinks.sh index c0448a4149b..85c7193b801 100755 --- a/ci/update_symlinks.sh +++ b/ci/update_symlinks.sh @@ -5,14 +5,28 @@ set -euEo pipefail PROJ_ROOT=$(realpath "$(dirname $(realpath $0))/../") +RELEASES="${PROJ_ROOT}/_data/releases.json" -STABLE_FOLDER=$( cat "${PROJ_ROOT}/_data/releases.json" | jq -r '.stable.version') -LEGACY_FOLDER=$( cat "${PROJ_ROOT}/_data/releases.json" | jq -r '.legacy.version') -NIGHTLY_FOLDER=$( cat "${PROJ_ROOT}/_data/releases.json" | jq -r '.nightly.version') +STABLE_VERSION=$(jq -r '.stable.version' < "${RELEASES}") +LEGACY_VERSION=$(jq -r '.legacy.version' < "${RELEASES}") +NIGHTLY_VERSION=$(jq -r '.nightly.version' < "${RELEASES}") + +STABLE_UCXX_VERSION=$(jq -r '.stable.ucxx_version' < "${RELEASES}") +LEGACY_UCXX_VERSION=$(jq -r '.legacy.ucxx_version' < "${RELEASES}") +NIGHTLY_UCXX_VERSION=$(jq -r '.nightly.ucxx_version' < "${RELEASES}") echo "Updating symlinks..." echo "" for FOLDER in _site/api/*/ ; do + if [[ "${FOLDER}" == *"ucxx"* ]]; then + STABLE_FOLDER=$STABLE_UCXX_VERSION + LEGACY_FOLDER=$LEGACY_UCXX_VERSION + NIGHTLY_FOLDER=$NIGHTLY_UCXX_VERSION + else + STABLE_FOLDER=$STABLE_VERSION + LEGACY_FOLDER=$LEGACY_VERSION + NIGHTLY_FOLDER=$NIGHTLY_VERSION + fi cd ${FOLDER} echo ""