Skip to content

Commit

Permalink
Download class map files to user-writable location
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 11, 2024
1 parent c22ab5a commit b04a402
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ source/i18n/*/conf.py
source/static/
sphinx_rtd_theme/
.token*
temp/
21 changes: 6 additions & 15 deletions conf.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
13 changes: 10 additions & 3 deletions scripts/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b04a402

Please sign in to comment.