diff --git a/ci/customization/__pycache__/util.cpython-310.pyc b/ci/customization/__pycache__/util.cpython-310.pyc new file mode 100644 index 00000000000..ee2f88734be Binary files /dev/null and b/ci/customization/__pycache__/util.cpython-310.pyc differ diff --git a/ci/customization/customize_doc.py b/ci/customization/customize_doc.py index 2a9a5eb1f3c..78f137cb865 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,9 @@ 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 +42,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..a8eec8ce231 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} == *"libucxx"* ]]; 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/update_symlinks.sh b/ci/update_symlinks.sh index a12f7910a41..1d4079849b8 100755 --- a/ci/update_symlinks.sh +++ b/ci/update_symlinks.sh @@ -5,18 +5,27 @@ 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}" == *"libucxx"* ]]; then - STABLE_FOLDER=$( cat "${PROJ_ROOT}/_data/releases.json" | jq -r '.stable.ucxx_version') - LEGACY_FOLDER=$( cat "${PROJ_ROOT}/_data/releases.json" | jq -r '.legacy.ucxx_version') - NIGHTLY_FOLDER=$( cat "${PROJ_ROOT}/_data/releases.json" | jq -r '.nightly.ucxx_version') + 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}