Skip to content

Commit 9ddd9ef

Browse files
committed
proper key.
1 parent fb137f2 commit 9ddd9ef

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def build_hwloc_xml() -> str:
125125
PROJECT_ROOT,
126126
"--config-settings=fetch-hwloc=True",
127127
f"--config-settings=hwloc-src-dir={hwloc_src_dir}",
128+
"--config-settings=with-cuda=False",
128129
"--no-deps",
129130
"--no-build-isolation",
130131
]

hatch/backend.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import hatchling.build
1212

13-
from .hook import BUILD_KEY, FETCH_KEY, ROOT_KEY, SRC_KEY
13+
from .hook import BUILD_KEY, CUDA_KEY, FETCH_KEY, ROOT_KEY, SRC_KEY
1414

1515

1616
@contextmanager
@@ -26,6 +26,10 @@ def build_config(config_settings: dict[str, Any] | None) -> Iterator[None]:
2626
os.environ[SRC_KEY] = config_settings["hwloc-src-dir"]
2727
if "hwloc-root-dir" in config_settings:
2828
os.environ[ROOT_KEY] = config_settings["hwloc-root-dir"]
29+
if "with-cuda" in config_settings:
30+
v = config_settings["with-cuda"]
31+
assert v in ("True", "False")
32+
os.environ[FETCH_KEY] = CUDA_KEY
2933
try:
3034
yield
3135
finally:

hatch/hook.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from packaging.tags import platform_tags
1717

1818
FETCH_KEY = "PYHWLOC_FETCH_HWLOC"
19+
CUDA_KEY = "PYHWLOC_WITH_CUDA"
1920
BUILD_KEY = "PYHWLOC_BUILD_DIR"
2021
ROOT_KEY = "PYHWLOC_HWLOC_ROOT_DIR"
2122
SRC_KEY = "PYHWLOC_HWLOC_SRC_DIR"
@@ -169,8 +170,9 @@ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
169170
cmake_args.append(f"-DHWLOC_ROOT={root_dir}")
170171

171172
# No CUDA in RTD
172-
if os.environ.get("READTHEDOCS", None) == "True":
173-
cmake_args.append("-DPYHWLOC_WITH_CUDA=OFF")
173+
with_cuda = os.environ.get(CUDA_KEY, None)
174+
if with_cuda == "False":
175+
cmake_args.append(f"-D{CUDA_KEY}=OFF")
174176

175177
# Source path
176178
if os.environ.get(SRC_KEY, None) is not None:

0 commit comments

Comments
 (0)