Skip to content

Commit 8187382

Browse files
committed
DOC: Don't try to link paths that are on a different drive
This may happen if Python is installed on C: and Matplotlib is installed on some other drive. As the point of this extension is to create GitHub links for Matplotlib *only*, we should ignore all paths that cannot be relativized to it. Fixes matplotlib#24574
1 parent a1cc739 commit 8187382

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,10 @@ def linkcode_resolve(domain, info):
682682
if lineno else "")
683683

684684
startdir = Path(matplotlib.__file__).parent.parent
685-
fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, '/')
685+
try:
686+
fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, '/')
687+
except ValueError:
688+
return None
686689

687690
if not fn.startswith(('matplotlib/', 'mpl_toolkits/')):
688691
return None

0 commit comments

Comments
 (0)