From 53372b7a10f9e4d595dab19293dab2be13907406 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 26 Apr 2024 19:49:36 +0200 Subject: [PATCH] Doc: updates to support building with upcoming update proj-docs Docker image updated to Ubuntu 24.04 I've tested locally those changes with a local build of the updated proj-docs Docker image per https://github.com/OSGeo/PROJ/pull/4128 --- .github/workflows/doc_build.yml | 10 +++++++++- doc/source/conf.py | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doc_build.yml b/.github/workflows/doc_build.yml index c46988153e6b..250730b65364 100644 --- a/.github/workflows/doc_build.yml +++ b/.github/workflows/doc_build.yml @@ -30,7 +30,7 @@ jobs: apt update apt install -y libproj-dev swig python3 -m pip install -r doc/requirements.txt - python3 -m pip install numpy + python3 -m pip install numpy setuptools pushd . mkdir build cd build @@ -43,6 +43,14 @@ jobs: -DOGR_BUILD_OPTIONAL_DRIVERS=OFF cmake --build . -j$(nproc) cmake --install . + # With the new ghcr.io/osgeo/proj-docs image based on Ubuntu 24.04 + # a venv is activated. The above does not install the + # Python bindings into it (and the ones in the system are not found + # without overriding PYTHONPATH), so do it through pip install + cd swig/python + python3 setup.py sdist + cp dist/* /tmp/gdal.tar.gz + python3 -m pip install /tmp/gdal.tar.gz ldconfig popd diff --git a/doc/source/conf.py b/doc/source/conf.py index 7b01a6d3954c..98b497994f04 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -429,6 +429,20 @@ \fi """ +# Package substitutefont no longer exists since TeXLive 2023 later than August 2023 +# and has been replaced with sphinxpackagesubstitutefont +# https://github.com/jfbu/sphinx/commit/04cbd819b0e285d058549b2173af7efadf1cd020 +import sphinx + +if os.path.exists( + os.path.join( + os.path.dirname(sphinx.__file__), "texinputs", "sphinxpackagesubstitutefont.sty" + ) +): + substitutefont_package = "sphinxpackagesubstitutefont" +else: + substitutefont_package = "substitutefont" + latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', @@ -436,7 +450,9 @@ #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. "preamble": preamble, - "inputenc": "\\usepackage[utf8]{inputenc}\n\\usepackage{CJKutf8}\n\\usepackage{substitutefont}", + "inputenc": "\\usepackage[utf8]{inputenc}\n\\usepackage{CJKutf8}\n\\usepackage{" + + substitutefont_package + + "}", "babel": "\\usepackage[russian,main=english]{babel}\n\\selectlanguage{english}", "fontenc": "\\usepackage[LGR,X2,T1]{fontenc}" # Latex figure (float) alignment