diff --git a/rapids_build_backend/config.py b/rapids_build_backend/config.py index 66f82c7..d1a5798 100644 --- a/rapids_build_backend/config.py +++ b/rapids_build_backend/config.py @@ -1,7 +1,7 @@ # Copyright (c) 2024, NVIDIA CORPORATION. import os -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Union from .utils import _get_pyproject @@ -9,13 +9,15 @@ from typing import Callable # config options can be one of these types... - config_val_type = str | bool | None + config_val_type = Union[str, bool, None] # ... or a callable that returns one of those or some other mutable types mutable_config_val_type = list[str] - config_val_callable = Callable[[], config_val_type | mutable_config_val_type] + config_val_callable = Callable[[], Union[config_val_type, mutable_config_val_type]] - config_options_type = dict[str, tuple[config_val_type | config_val_callable, bool]] + config_options_type = dict[ + str, tuple[Union[config_val_type, config_val_callable], bool] + ] class Config: diff --git a/rapids_build_backend/impls.py b/rapids_build_backend/impls.py index c15bc28..d4d8450 100644 --- a/rapids_build_backend/impls.py +++ b/rapids_build_backend/impls.py @@ -7,6 +7,7 @@ from contextlib import contextmanager from functools import lru_cache from importlib import import_module +from typing import Union import rapids_dependency_file_generator import tomli_w @@ -99,7 +100,7 @@ def _get_cuda_suffix(require_cuda=False) -> str: @lru_cache -def _get_git_commit() -> str | None: +def _get_git_commit() -> Union[str, None]: """Get the current git commit. Returns None if git is not in the PATH or if it fails to find the commit.