Skip to content

Commit

Permalink
Use lambda for mutable default values
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromNVIDIA committed Apr 30, 2024
1 parent 262fcfd commit 55a4b5f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rapids_build_backend/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

import os
from collections.abc import Callable

from .utils import _get_pyproject

Expand All @@ -18,7 +19,7 @@ class Config:
"disable-cuda-suffix": (False, True),
"matrix-entry": ("", True),
"require-cuda": (True, True),
"requires": ([], False),
"requires": (lambda: [], False),
}

def __init__(self, dirname=".", config_settings=None):
Expand All @@ -33,6 +34,8 @@ def __getattr__(self, name):
config_name = name.replace("_", "-")
if config_name in Config.config_options:
default_value, allows_override = Config.config_options[config_name]
if isinstance(default_value, Callable):
default_value = default_value()

# If overrides are allowed environment variables take precedence over the
# config_settings dict.
Expand Down

0 comments on commit 55a4b5f

Please sign in to comment.