Skip to content

Commit

Permalink
Add working version for devs
Browse files Browse the repository at this point in the history
  • Loading branch information
lowener committed Jan 15, 2025
1 parent 32e8073 commit c6c3e00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def setup(app):
linkcode_resolve = make_linkcode_resolve(
"pylibraft",
"https://github.com/rapidsai/raft"
"raft/blob/{revision}/python/pylibraft"
"/blob/{revision}/python/"
"{package}/{path}#L{lineno}",
)

Expand Down
13 changes: 6 additions & 7 deletions docs/source/sphinxext/github_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,18 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
# fn is expected to be the absolute path.
fn = os.path.relpath(source_file, start=package)
print("{}:{}".format(
os.path.abspath(os.path.join("..", "python", "raft", fn)),
os.path.abspath(os.path.join("..", "python", "pylibraft", fn)),
lineno))
else:
return
else:
if fn.endswith(".pyx"):
sp_path = next(x for x in sys.path if re.match(".*site-packages$", x))
fn = fn.replace("/opt/conda/conda-bld/work/python/cuvs", sp_path)
# Test if we are absolute or not (pyx are relative)
if (not os.path.isabs(fn)):
# Should be relative to docs right now
fn = os.path.abspath(os.path.join("..", "python", fn))

# Convert to relative from module root
fn = os.path.relpath(fn,
start=os.path.dirname(
__import__(package).__file__))
fn = os.path.relpath(fn, start=package)

# Get the line number if we need it. (Can work without it)
if (lineno is None):
Expand Down

0 comments on commit c6c3e00

Please sign in to comment.