Skip to content

Commit

Permalink
update other processing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AyodeAwe committed Mar 25, 2024
1 parent ed296e8 commit cbbc7fd
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 13 deletions.
Binary file added ci/customization/__pycache__/util.cpython-310.pyc
Binary file not shown.
20 changes: 14 additions & 6 deletions ci/customization/customize_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -22,9 +24,15 @@
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"
Expand All @@ -40,11 +48,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}

Expand Down
6 changes: 5 additions & 1 deletion ci/customization/customize_docs_in_folder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
17 changes: 17 additions & 0 deletions ci/customization/util.py
Original file line number Diff line number Diff line change
@@ -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
21 changes: 15 additions & 6 deletions ci/update_symlinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit cbbc7fd

Please sign in to comment.