Skip to content

Commit 7e7d3c1

Browse files
authored
build: report internal build dependency provenance (#2509)
1 parent 418595b commit 7e7d3c1

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

‎cuda_bindings/build_hooks.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import sysconfig
1818
import tempfile
19+
from pathlib import Path
1920
from warnings import warn
2021

2122
from setuptools import build_meta as _build_meta
@@ -50,9 +51,9 @@ def _import_get_cuda_path_or_home():
5051
cuda = None
5152

5253
for p in sys.path:
53-
sp_cuda = os.path.join(p, "cuda")
54-
if os.path.isdir(os.path.join(sp_cuda, "pathfinder")):
55-
cuda.__path__ = list(cuda.__path__) + [sp_cuda]
54+
sp_cuda = Path(p) / "cuda"
55+
if (sp_cuda / "pathfinder").is_dir():
56+
cuda.__path__ = list(cuda.__path__) + [str(sp_cuda)]
5657
break
5758
else:
5859
raise ModuleNotFoundError(
@@ -61,6 +62,11 @@ def _import_get_cuda_path_or_home():
6162
)
6263
import cuda.pathfinder
6364

65+
pathfinder_dir = Path(cuda.pathfinder.__file__).parent
66+
print(
67+
f"Using cuda-pathfinder {cuda.pathfinder.__version__} from {pathfinder_dir}",
68+
file=sys.stderr,
69+
)
6470
return cuda.pathfinder.get_cuda_path_or_home
6571

6672

‎cuda_core/build_hooks.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ def _import_get_cuda_path_or_home():
4646
cuda = None
4747

4848
for p in sys.path:
49-
sp_cuda = os.path.join(p, "cuda")
50-
if os.path.isdir(os.path.join(sp_cuda, "pathfinder")):
51-
cuda.__path__ = list(cuda.__path__) + [sp_cuda]
49+
sp_cuda = Path(p) / "cuda"
50+
if (sp_cuda / "pathfinder").is_dir():
51+
cuda.__path__ = list(cuda.__path__) + [str(sp_cuda)]
5252
break
5353
else:
5454
raise ModuleNotFoundError(
@@ -57,6 +57,11 @@ def _import_get_cuda_path_or_home():
5757
)
5858
import cuda.pathfinder
5959

60+
pathfinder_dir = Path(cuda.pathfinder.__file__).parent
61+
print(
62+
f"Using cuda-pathfinder {cuda.pathfinder.__version__} from {pathfinder_dir}",
63+
file=sys.stderr,
64+
)
6065
return cuda.pathfinder.get_cuda_path_or_home
6166

6267

@@ -136,6 +141,7 @@ def _build_cuda_core(debug=False):
136141
import cuda.bindings
137142

138143
bindings_path = Path(cuda.bindings.__file__).parent # .../cuda/bindings/
144+
print(f"Using cuda-bindings {cuda.bindings.__version__} from {bindings_path}", file=sys.stderr)
139145
cuda_package_dir = bindings_path.parent.parent # .../cuda_bindings/ (contains cuda/)
140146
if str(cuda_package_dir) not in sys.path:
141147
sys.path.insert(0, str(cuda_package_dir))

0 commit comments

Comments
 (0)