From b04a4028e729bf3a16b2f6dfa27a91c28222e119 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Wed, 11 Sep 2024 08:46:44 +1000 Subject: [PATCH] Download class map files to user-writable location --- .gitignore | 1 + conf.in.py | 21 ++++++--------------- scripts/build-docs.sh | 13 ++++++++++--- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index e38c3b4bdb5c..b93bf409498f 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ source/i18n/*/conf.py source/static/ sphinx_rtd_theme/ .token* +temp/ diff --git a/conf.in.py b/conf.in.py index c6add74b48f5..30cd741ceb36 100644 --- a/conf.in.py +++ b/conf.in.py @@ -227,21 +227,12 @@ user_paths = [] class_maps = {} -qgis_module_path = None -for path in user_paths: - candidate_path = path / "qgis" / "core" - if candidate_path.exists(): - qgis_module_path = candidate_path - break - -if qgis_module_path: - for module in ("3d", "analysis", "core", "gui", "server"): - class_map_path = qgis_module_path / module / "class_map.yaml" - if not class_map_path.exists(): - print(f"Cannot find class_map.yaml for {module}, skipping...") - continue - with open(qgis_module_path / module / "class_map.yaml") as f: - class_maps[module] = yaml.safe_load(f) + +for module in ("3d", "analysis", "core", "gui", "server"): + class_map_path = Path("..") / ".." / "temp" / module / "class_map.yaml" + assert class_map_path.exists(), f"Cannot find {class_map_path.resolve()}" + with open(class_map_path) as f: + class_maps[module] = yaml.safe_load(f) def linkcode_resolve(domain, info): diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh index a11eb0acb124..b9aa9b619932 100755 --- a/scripts/build-docs.sh +++ b/scripts/build-docs.sh @@ -66,10 +66,17 @@ echo "RELEASE TAG: ${RELEASE_TAG}" echo "PACKAGE LIMIT: ${PACKAGE}" echo "SINGLE CLASS: ${CLASS}" -# download class_map until correctly installed -# TODO: remove this when https://github.com/qgis/QGIS/pull/58200 is merged +# download current class_map file, if it hasn't already been +mkdir -p temp for module in "3d" "analysis" "core" "gui" "server"; do - wget -O /usr/lib/python3/dist-packages/qgis/${module}/class_map.yaml https://raw.githubusercontent.com/qgis/QGIS/${RELEASE_TAG}/python/${module}/class_map.yaml + CLASS_MAP_FILE="temp/${module}/class_map.yaml" + if [ -f "$CLASS_MAP_FILE" ]; then + echo "${module} class map file already downloaded" + else + echo "Need to fetch ${module} class map file" + mkdir -p temp/${module} + wget -O "$CLASS_MAP_FILE" https://raw.githubusercontent.com/qgis/QGIS/${RELEASE_TAG}/python/${module}/class_map.yaml + fi done if [[ -n ${QGIS_BUILD_DIR} ]]; then