From 38112e652cdea2e45a77df122aaa7678851cc5c5 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 7 Nov 2024 16:56:18 -0700 Subject: [PATCH] DOC: Don't try to link to code for non-metpy objects This avoids potential problems with building on Windows with environments that span multiple drives, like on GitHub Actions. --- docs/conf.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 37f8c5fe97..09b1678849 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -519,12 +519,15 @@ def linkcode_resolve(domain, info): else: linespec = "" - fn = os.path.relpath(fn, start=os.path.dirname(metpy.__file__)) - - if "+" in metpy.__version__: - return f"https://github.com/Unidata/MetPy/blob/main/src/metpy/{fn}{linespec}" + if 'metpy' in fn: + fn = os.path.relpath(fn, start=os.path.dirname(metpy.__file__)) + + if "+" in metpy.__version__: + return f"https://github.com/Unidata/MetPy/blob/main/src/metpy/{fn}{linespec}" + else: + return ( + f"https://github.com/Unidata/MetPy/blob/" + f"v{metpy.__version__}/src/metpy/{fn}{linespec}" + ) else: - return ( - f"https://github.com/Unidata/MetPy/blob/" - f"v{metpy.__version__}/src/metpy/{fn}{linespec}" - ) + return None