summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreterobjects.py
AgeCommit message (Collapse)Author
2021-11-01various manual conversion of percent-formatted strings to f-stringsEli Schwartz
2021-10-30Typo fixes (CustomTaget -> CustomTarget)rusty-snake
2021-10-10Fix typos discovered by codespellChristian Clauss
2021-10-08add install_emptydir functionEli Schwartz
This replaces the absolute hack of using ``` install_subdir('nonexisting', install_dir: 'share') ``` which requires you to make sure you don't accidentally or deliberately have a completely different directory with the same name in your source tree that is full of files you don't want installed. It also avoids splitting the name in two and listing them in the wrong order. You can also set the install mode of each directory component by listing them one at a time in order, and in fact create nested structures at all. Fixes #1604 Properly fixes #2904
2021-10-04remove f from f-string that has no formattingEli Schwartz
2021-09-25Remove helpers.check_stringlist()Daniel Mensinger
2021-09-01interpreter: Remove permissive from _unholderDaniel Mensinger
2021-08-31pylint: enable unnecessary-not checkDylan Baker
This finds things like ```python if not x == 1: ``` which should be ```python if x != 1: ```
2021-08-30interpreter: rename EnvironmentVariablesObject -> EnvironmentVariablesHolderDylan Baker
This is more consistent with other Holder classes
2021-08-30interpreterobjects: Use typed_kwargs for EnvironmentVariablesObjectDylan Baker
2021-08-30make EnvironmentVariablesObject a proper holderDylan Baker
Currently, EnvironmentVariablesObject is a strange holder-that's-not-a-holder. This has implicaitons for things that expect to get an EnvironmentVariables object, as we can't automatically unholder it, and instead have to to manually do so. Now we can automatically unholder it, which makes everything much nicer.
2021-08-30Allow EnvironmentVariablesObject to be passed an EnvironmentVariables instanceDylan Baker
2021-08-27interpreter: fix cases of `KwargInfo(..., T, default=None)`Dylan Baker
The correct way to mark these is `KwargInfo(..., (T, type(None)))`. There's also a few cases of `(T, None)` which is invalid, as `None` isn't a type
2021-08-20interpreterobjects: fix Test annotationsDylan Baker
2021-08-16interpreterobjects: Add TypedDict annoations for `extract_search_dirs`Dylan Baker
This allows for more accurate type checking
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz
2021-07-05pyupgradeEli Schwartz
2021-07-02Flatten test suite valueTristan Partin
This behavior is more inline with the rest of Meson
2021-07-02fix: get_variable default variables are not ObjectHolders (fixes #8936)Daniel Mensinger
2021-06-26refactor: Refactor BothLibraries logicDaniel Mensinger
This commit introduces a new type of `HoldableObject`: The `SecondLevelHolder`. The primary purpose of this class is to handle cases where two (or more) `HoldableObject`s are stored at the same time (with one default object). The best (and currently only) example here is the `BothLibraries` class.
2021-06-22fix: Handling BothLibraries objects (fixes #8907)Daniel Mensinger
2021-06-21fix: Ensure that build targets have all methods from ExternalProgramDaniel Mensinger
As a side-effect from #8885 `find_program()` returns now `Executable` objects when `meson.override_find_program` is called with an executable target. To resolve this conflict the missing methods from `ExternalProgram` are added to `BuildTarget`.
2021-06-18holders: Fix the remaining code to respect the holder changesDaniel Mensinger
2021-06-18holders: Introduce BothLibrariesDaniel Mensinger
2021-06-18holders: Ensure that InterpreterBase is the sole instance for (un)holderifyingDaniel Mensinger
2021-06-18holders: Move get_version from directly to ExternalProgramDaniel Mensinger
2021-06-18holders: Introduce HoldableObjectDaniel Mensinger
2021-06-18interpreter: Add FileHolder and remove specical case for FileDaniel Mensinger
2021-06-18interpreter: Add a new MesonInterpreterObject for non-elementary objectsDaniel Mensinger
2021-06-18interpreter: Refactor ObjectHolder to extend InterpreterObjectDaniel Mensinger
2021-06-18typing: Import missing classes in interpreterobjects.pyDaniel Mensinger
2021-06-15interpreterobjects: Clean up GeneratedListHolderDylan Baker
Remove an unused method (that didn't work before this series), and remove the ability to pass a Generator to the GeneratedListHolder, it's never used and it's weird and not the way Meson generally works now. While we're here, finish the type annotations.
2021-06-15interpreterobjects|build: use typed_kwargs for generator.processDylan Baker
2021-06-15interpreter|build: use typed_pos_args and unholder in the interpreterDylan Baker
For generator.process_files. Just cleaner and nicer
2021-06-15interpreter: use typed_kwargs for func_generatorDylan Baker
Do the type checking in a nice tidy way
2021-06-15interpreter: Do not create Generator in GeneratorHolderDylan Baker
This is an odd pattern, not the way most Holders work, and would be problematic if a method wanted to return a Generator.
2021-06-15modules/qt: fully annotate and check qt.has_toolsDylan Baker
2021-06-08Merge pull request #8512 from bonzini/feature-methodsJussi Pakkanen
Utility methods for feature objects
2021-06-08interpreter: add feature.disable_auto_if()Paolo Bonzini
Add a method to downgrade an option to disabled if it is not used. This is useful to avoid unnecessary search for dependencies; for example dep = dependency('dep', required: get_option('feature').disable_auto_if(not foo)) can be used instead of the more verbose and complex if get_option('feature').auto() and not foo then dep = dependency('', required: false) else dep = dependency('dep', required: get_option('feature')) endif or to avoid unnecessary dependency searches: dep1 = dependency('dep1', required: get_option('foo')) # dep2 is only used together with dep1 dep2 = dependency('dep2', required: get_option('foo').disable_auto_if(not dep1.found())) ``` Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-08interpreter: add feature.require()Paolo Bonzini
Add a method to perform a logical AND on a feature object. The method also takes care of raising an error if 'enabled' is ANDed with false. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-04interpreterobjects: Fix type annotation for CustomTargetHolderDylan Baker
2021-05-31interpreter: wrap access to Feature valuePaolo Bonzini
This will allow adding "forced-off" Feature objects in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-31interpreter: add feature.allowed()Paolo Bonzini
This method simplifies the conversion of Feature objects to booleans. Often, one has to use the "not" operator in order to treat "auto" and "enabled" the same way. "allowed()" also works well in conjunction with the require method that is introduced in the next patch. For example, if get_option('foo').require(host_machine.system() == 'windows').allowed() then src += ['foo.c'] config.set10('HAVE_FOO', 1) endif can be used instead of if host_machine.system() != 'windows' if get_option('foo').enabled() error('...') endif endif if not get_option('foo').disabled() then src += ['foo.c'] config.set10('HAVE_FOO', 1) endif Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-28modules: Add methods dict everywhereXavier Claessens
This fix calling random internal methods from meson.build as long as they were not prefixed by underscore.
2021-05-28modules: Stop using InterpreterObjectXavier Claessens
Custom objects returned by modules must be subclass of ModuleObject and have the state argument in its methods. Add MutableModuleObject base class for objects that needs to be deep copied on assignation.
2021-05-28modules: Remove snippet methodsXavier Claessens
The only advantage they have is they have the interpreter in arguments, but it's already available as self.interpreter. We should discourage usage of the interpreter API and rely on ModuleState object instead in the future. This also lift the restriction that a module method cannot add build targets, but that was not enforced for snippet methods anyway (and some modules were doing it) and it's really loose restriction as it should check for many other things if we wanted to make it consistent.
2021-05-13interpreter: flatten environment() initial valuesXavier Claessens
Turns out listify() flattens by default, but stringlistify() cannot flatten... How do I realize this only now? Fixes: #8727
2021-04-01interpreter: Move to its own folder and split itXavier Claessens