From 7dc6143a6874d1896da50b084c0de75e1c4a2f64 Mon Sep 17 00:00:00 2001 From: Jake Awe Date: Mon, 25 Mar 2024 05:03:02 -0500 Subject: [PATCH] update other processing scripts --- .../__pycache__/util.cpython-310.pyc | Bin 0 -> 1109 bytes ci/customization/customize_doc.py | 14 +++++++----- ci/customization/customize_docs_in_folder.sh | 6 ++++- ci/customization/util.py | 17 ++++++++++++++ ci/update_symlinks.sh | 21 +++++++++++++----- 5 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 ci/customization/__pycache__/util.cpython-310.pyc create mode 100644 ci/customization/util.py diff --git a/ci/customization/__pycache__/util.cpython-310.pyc b/ci/customization/__pycache__/util.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee2f88734beb323faf18f978ceaaf00d20cadfe9 GIT binary patch literal 1109 zcmZ`&&u`N(6t*3w?MnB9Qo+Q@+O48AOagJ?*ES?>J8Yb)Nl}R1HCqxF+hJPOowh#& zj{BE<TaLxs71FeTK)s2tq&IqCO}rK7i>SxKD^9 zjxWFjI`>AHlYP|pV%WJeZgaK)76{_dh(M0ViJ)W3Jx(v^$ghwFAU zm*9l9ZL9E`P&$#hw!SnIp=?75Q>Z)!(zl}lUq09lm_7h!kim2G9S;A2&&dHfBWGTT z;TlHI{5hG^W29L*6SXn-=Ke8K8}5P?HYhQo2He|6oB}O>_G(9F(?|);%!ym|9dzMiIu={GFZA{{Gt zzmb0`BDFPYWHL9Ct;KS?T5ew=)q$Yj?}LfVL~s4x4yUKK885Emj?^pQdZdTf3B_xeVoGM+e_a?>p?BnWc^;UP z|Jvn)^k@#!bA0Sx3Yop!E1Ra-XH^K6jG4P4OEgP`1`#Jw4okm22rGR<7bD zQ4e4$RVi=1aLa(%PNG9sCvh|+4u zgXgD~Ttz2=rC+2>Re6H@gKJbuQcgJKo}e?`0@p%a-0eK3CA!-uYW*hUf4R2xX2IiK KS-=V2Lw^BrO%28X literal 0 HcmV?d00001 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}