Skip to content

Commit

Permalink
DOC: Don't try to link to code for non-metpy objects
Browse files Browse the repository at this point in the history
This avoids potential problems with building on Windows with
environments that span multiple drives, like on GitHub Actions.
  • Loading branch information
dopplershift committed Nov 7, 2024
1 parent 72e893e commit 38112e6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 38112e6

Please sign in to comment.