Skip to content

Commit 741f971

Browse files
committed
Align WSL detection helpers
Remove the environment-variable fallback from cuda_python_test_helpers._detect_wsl so the test helper matches cuda.core's /proc-based WSL detection. Add comments to both copies to keep the duplicated implementations synchronized. Xref: https://github.com/NVIDIA/cuda-python/pull/2118/changes#r3278720224
1 parent b78cdb5 commit 741f971

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

cuda_core/cuda/core/system/_system.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
CUDA_BINDINGS_NVML_IS_COMPATIBLE: bool
1212

1313

14+
# Please keep in sync with the equivalent implementation in
15+
# cuda_python_test_helpers/cuda_python_test_helpers/__init__.py.
1416
cdef bint _detect_wsl():
1517
try:
1618
with open("/proc/sys/kernel/osrelease") as f:

cuda_python_test_helpers/cuda_python_test_helpers/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
]
1616

1717

18+
# Please keep in sync with the equivalent implementation in
19+
# cuda_core/cuda/core/system/_system.pyx.
1820
def _detect_wsl() -> bool:
1921
data = ""
2022
with suppress(Exception), open("/proc/sys/kernel/osrelease") as f:
2123
data = f.read().lower()
22-
if "microsoft" in data or "wsl" in data:
23-
return True
24-
return any(os.environ.get(k) for k in ("WSL_DISTRO_NAME", "WSL_INTEROP"))
24+
return "microsoft" in data or "wsl" in data
2525

2626

2727
IS_WSL: bool = _detect_wsl()

0 commit comments

Comments
 (0)