Coverage for cuda/pathfinder/_utils/platform_aware.py: 100.00%
15 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-03 02:41 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-03 02:41 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2# SPDX-License-Identifier: Apache-2.0
4import sys
6IS_WINDOWS = sys.platform == "win32"
7_WINDOWS_PYTHON_ARCH: str | None
9if IS_WINDOWS:
10 from cuda.pathfinder._utils.windows_arch import windows_python_arch
12 _WINDOWS_PYTHON_ARCH = windows_python_arch()
13else:
14 _WINDOWS_PYTHON_ARCH = None
16# These describe the Python process ABI, not the Windows host architecture.
17IS_WINDOWS_X64 = _WINDOWS_PYTHON_ARCH == "x64"
18IS_WINDOWS_ARM64 = _WINDOWS_PYTHON_ARCH == "arm64"
21def quote_for_shell(s: str) -> str:
22 if IS_WINDOWS: 1bcdeflmghijk
23 # This is a relatively heavy import; keep pathfinder lean if possible.
24 from subprocess import list2cmdline 1bcdefghijk
26 return list2cmdline([s]) 1bcdefghijk
27 else:
28 import shlex 1bcdeflmghijk
30 return shlex.quote(s) 1bcdeflmghijk