Improvements to FooConfigOption#495
Merged
Merged
Conversation
Needed for dlmalloc
We can't pass Optional[] as the parameter since it can't be used as a callable, we have to pass the actual type instead.
Needed to replace the calls to add_config_option.
This adds OptionalEnumConfigOption to the declarative options framework, permitting Enum option declarations that do not require an initial default value and default to None. This mirrors the existing OptionalIntConfigOption, OptionalStringConfigOption, and OptionalPathConfigOption classes.
…iptors This implements generic option mixin registration by dynamically injecting option dictionaries on parent mixin classes. The metaclass is updated to merge base class options from all parents to correctly support multiple inheritance hierarchies, and it now prunes any descriptors that are overridden as static non-descriptor values in subclasses. This also adds a comprehensive unit test in tests/test_project_helpers.py verifying correct option resolution and inheritance across mixins and subclasses.
This introduces a declarative extra_condition callback parameter to the PerProjectConfigOption constructor. Subclasses option registry (MRO walk in the ProjectSubclassDefinitionHook.__init__ metaclass) evaluates this condition at class creation time and prunes the option if the condition evaluates to False on the class. Instead we just populate the class member with a descriptor that returns the default value.
Checks if an option is inherited as a ConfigOptionHandle from a concrete parent class, and registers it target-specifically on the subclass if it has not been registered directly yet. This fixes a bug where subclass target classes of concrete parent target classes did not register any of their parent classes' options. For example, BuildCheriAllianceQEMU (cheri-std093-qemu) inherits 'targets' option from BuildQEMU (qemu), and we must register it specifically so it resolves to the custom default_targets list. Also adds a test in test_project_helpers.py to verify option registration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows using them instead of cls.setup_config_options() (#493 )