aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreterobjects.py
AgeCommit message (Collapse)AuthorFilesLines
2021-10-30Typo fixes (CustomTaget -> CustomTarget)rusty-snake1-1/+1
2021-10-10Fix typos discovered by codespellChristian Clauss1-2/+2
2021-10-08add install_emptydir functionEli Schwartz1-0/+3
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 Schwartz1-1/+1
2021-09-25Remove helpers.check_stringlist()Daniel Mensinger1-10/+13
2021-09-01interpreter: Remove permissive from _unholderDaniel Mensinger1-3/+3
2021-08-31pylint: enable unnecessary-not checkDylan Baker1-1/+1
This finds things like ```python if not x == 1: ``` which should be ```python if x != 1: ```
2021-08-30interpreter: rename EnvironmentVariablesObject -> EnvironmentVariablesHolderDylan Baker1-3/+3
This is more consistent with other Holder classes
2021-08-30interpreterobjects: Use typed_kwargs for EnvironmentVariablesObjectDylan Baker1-24/+19
2021-08-30make EnvironmentVariablesObject a proper holderDylan Baker1-30/+14
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 Baker1-1/+3
2021-08-27interpreter: fix cases of `KwargInfo(..., T, default=None)`Dylan Baker1-1/+2
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 Baker1-3/+6
2021-08-16interpreterobjects: Add TypedDict annoations for `extract_search_dirs`Dylan Baker1-1/+1
This allows for more accurate type checking
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz1-2/+2
2021-07-05pyupgradeEli Schwartz1-1/+1
2021-07-02Flatten test suite valueTristan Partin1-2/+2
This behavior is more inline with the rest of Meson
2021-07-02fix: get_variable default variables are not ObjectHolders (fixes #8936)Daniel Mensinger1-2/+2
2021-06-26refactor: Refactor BothLibraries logicDaniel Mensinger1-2/+4
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 Mensinger1-1/+2
2021-06-21fix: Ensure that build targets have all methods from ExternalProgramDaniel Mensinger1-8/+17
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 Mensinger1-287/+261
2021-06-18holders: Introduce BothLibrariesDaniel Mensinger1-63/+58
2021-06-18holders: Ensure that InterpreterBase is the sole instance for (un)holderifyingDaniel Mensinger1-10/+9
2021-06-18holders: Move get_version from directly to ExternalProgramDaniel Mensinger1-21/+0
2021-06-18holders: Introduce HoldableObjectDaniel Mensinger1-1/+1
2021-06-18interpreter: Add FileHolder and remove specical case for FileDaniel Mensinger1-0/+4
2021-06-18interpreter: Add a new MesonInterpreterObject for non-elementary objectsDaniel Mensinger1-5/+5
2021-06-18interpreter: Refactor ObjectHolder to extend InterpreterObjectDaniel Mensinger1-59/+37
2021-06-18typing: Import missing classes in interpreterobjects.pyDaniel Mensinger1-0/+2
2021-06-15interpreterobjects: Clean up GeneratedListHolderDylan Baker1-8/+3
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 Baker1-16/+25
2021-06-15interpreter|build: use typed_pos_args and unholder in the interpreterDylan Baker1-27/+29
For generator.process_files. Just cleaner and nicer
2021-06-15interpreter: use typed_kwargs for func_generatorDylan Baker1-1/+0
Do the type checking in a nice tidy way
2021-06-15interpreter: Do not create Generator in GeneratorHolderDylan Baker1-3/+4
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 Baker1-2/+11
2021-06-08Merge pull request #8512 from bonzini/feature-methodsJussi Pakkanen1-4/+46
Utility methods for feature objects
2021-06-08interpreter: add feature.disable_auto_if()Paolo Bonzini1-0/+9
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 Bonzini1-2/+25
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 Baker1-1/+1
2021-05-31interpreter: wrap access to Feature valuePaolo Bonzini1-4/+8
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 Bonzini1-0/+6
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 Claessens1-6/+1
This fix calling random internal methods from meson.build as long as they were not prefixed by underscore.
2021-05-28modules: Stop using InterpreterObjectXavier Claessens1-0/+7
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 Claessens1-14/+7
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 Claessens1-1/+3
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 Claessens1-0/+999