Skip to content

Commit

Permalink
Fixes github link from pyx files (#6202)
Browse files Browse the repository at this point in the history
Fixes #5261

Authors:
  - Thomas J. Fan (https://github.com/thomasjpfan)
  - Tim Head (https://github.com/betatim)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Tim Head (https://github.com/betatim)

URL: #6202
  • Loading branch information
thomasjpfan authored Jan 8, 2025
1 parent 4375738 commit 225d0aa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion 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 @@ -103,7 +118,7 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
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", sp_path)
fn = fn.replace("/opt/conda/conda-bld/work/python/cuml", sp_path)

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

0 comments on commit 225d0aa

Please sign in to comment.