From 55a4b5f88599fb7e1eb28654b401d977e5ca6a61 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Tue, 30 Apr 2024 10:19:02 -0400 Subject: [PATCH] Use lambda for mutable default values --- rapids_build_backend/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rapids_build_backend/config.py b/rapids_build_backend/config.py index 04e19b7..d8fab43 100644 --- a/rapids_build_backend/config.py +++ b/rapids_build_backend/config.py @@ -1,6 +1,7 @@ # Copyright (c) 2024, NVIDIA CORPORATION. import os +from collections.abc import Callable from .utils import _get_pyproject @@ -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): @@ -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.