From 4c15ee1050498d407d7b7d0d66badbfc9ec7ac1a Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 8 Mar 2024 09:04:41 +0000 Subject: [PATCH] Fix devdocs version switcher --- doc/conf.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 4241ada05cf4..e33687773b32 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -36,6 +36,14 @@ # are we running circle CI? CIRCLECI = 'CIRCLECI' in os.environ +# are we deploying this build to matplotlib.org/devdocs? +# This is a copy of the logic in .circleci/deploy-docs.sh +DEVDOCS = ( + CIRCLECI and + (os.environ.get("CIRCLE_PROJECT_USERNAME") == "matplotlib") and + (os.environ.get("CIRCLE_BRANCH") == "main") and + (not os.environ.get("CIRCLE_PULL_REQUEST", "").startswith( + "https://github.com/matplotlib/matplotlib/pull"))) def _parse_skip_subdirs_file(): @@ -489,7 +497,7 @@ def js_tag_with_cache_busting(js): "https://output.circle-artifacts.com/output/job/" f"{os.environ['CIRCLE_WORKFLOW_JOB_ID']}/artifacts/" f"{os.environ['CIRCLE_NODE_INDEX']}" - "/doc/build/html/_static/switcher.json" if CIRCLECI else + "/doc/build/html/_static/switcher.json" if CIRCLECI and not DEVDOCS else f"https://matplotlib.org/devdocs/_static/switcher.json?{SHA}" ), "version_match": (