Skip to content

Commit

Permalink
Fix broken link to python doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lowener committed Jan 10, 2025
1 parent 8fc988e commit 32e8073
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions docs/source/sphinxext/github_link.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# This contains code with copyright by the scikit-learn project, subject to the
# license in /thirdparty/LICENSES/LICENSE.scikit_learn
#
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import inspect
import os
Expand Down Expand Up @@ -96,15 +111,14 @@ 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", "cuml", fn)),
os.path.abspath(os.path.join("..", "python", "raft", fn)),
lineno))
else:
return
else:
# 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))
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)

# Convert to relative from module root
fn = os.path.relpath(fn,
Expand Down

0 comments on commit 32e8073

Please sign in to comment.