Skip to content

Commit a302aab

Browse files
committed
fix setup.py again
1 parent 718e401 commit a302aab

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

setup.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010

1111
# If WITH_CUDA is defined
12-
if os.getenv("WITH_CUDA") is None:
13-
if os.environ.get("WITH_CUDA", "0") == "1":
14-
use_cuda = True
15-
elif os.environ.get("WITH_CUDA", "0") == "0":
16-
use_cuda = False
17-
else:
18-
raise ValueError("Invalid flag with WITH_CUDA environment variable. Expected '0' or '1'")
12+
env_with_cuda = os.getenv("WITH_CUDA")
13+
if env_with_cuda is not None:
14+
if env_with_cuda not in ("0", "1"):
15+
raise ValueError(
16+
"Invalid flag with WITH_CUDA environment variable. Expected '0' or '1'"
17+
)
18+
use_cuda = env_with_cuda == "1"
1919
else:
2020
use_cuda = torch.cuda._is_compiled()
2121

0 commit comments

Comments
 (0)