aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2021-06-09typing: Fully annotate run_project_tests.pyDaniel Mensinger2-3/+3
2021-06-09compilers: Fix missing functions in Compiler base classDaniel Mensinger8-16/+21
2021-06-09typing: Rename some variablesDaniel Mensinger8-45/+54
2021-06-09typing: remove unused DependencyTypeDaniel Mensinger2-2/+2
2021-06-09typing: Fully annotate dependenciesDaniel Mensinger5-72/+76
2021-06-08Merge pull request #8512 from bonzini/feature-methodsJussi Pakkanen1-4/+46
Utility methods for feature objects
2021-06-08interpreter: make helper methods protectedDylan Baker1-15/+15
They really aren't meant to be called outside of the interpreter itself, so don't expose them as public
2021-06-08interpreter: Add type annotations for the add_*_arguments helpersDylan Baker1-9/+8
internally these all used a set of shared heleprs, add type annotations for those as well
2021-06-08build: fix type annotations fo project_*_argsDylan Baker1-2/+2
These are Dict[str, Dict[str, List[str]]], unlike global arguments because they must store the information per subproject
2021-06-08interpreter: use typed_kwargs for the add_*_arguments familyDylan Baker2-20/+65
This makes use of the new convertor and validator arguments, so that we can check that the languages passed are in fact vaild, and then convert the native boolean into a MachineChoice internally.
2021-06-08interpreter: use typed_pos_args for add_*_argsDylan Baker1-12/+12
This just replaces stringArgs with the typed_pos_args, and it's better error message.
2021-06-08intperperterbase: Add a convertor keyword argumentDylan Baker1-1/+10
This is meant to allow simple type conversions to happen before the interpreter function is called. This should simplify some cases like the "native" keyword arugment that are booleans in the Meson DSL, but an Enum in the implementation
2021-06-08interpreterbase: Add validator keyword argument to typed_kwargsDylan Baker1-1/+13
This attribute is a callable that returns a string if the value is invalid, otherwise None. This intended for cases like the `install_*` function's `install_mode` paramater, which is either an int or the string "preserve", which allows us to do nice things like: ```python class Kwargs(TypedDict): install_mode: T.Union[int, T.Literal['preserve']] @typed_kwargs( 'foo', KwargInfo('install_mode', ..., validator=lambda x: None if isinstance(x, int) or x == 'preserve' else 'must be the literal "preserve"), ) def install_data(self, node, args, kwargs: 'Kwargs'): ... ``` In this case mypy *knows* that the string is preserve, as do we, and we can simply do tests like: ```python if kwargs['install_mode'] == 'preserve': ... else: # this is an int ```
2021-06-08make all arguments to KwargInfo except name and type keyword onlyDylan Baker1-1/+2
To make them easier to understand in practice
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-07another pyupgrade passEli Schwartz1-3/+3
2021-06-07upgrade percent formatted strings pyupgrade did not catchEli Schwartz3-19/+17
2021-06-07condense linesEli Schwartz4-24/+12
2021-06-07more f-strings everywhereEli Schwartz4-138/+117
pyupgrade didn't catch many .format() methods which were too complex (e.g. multiline or applied to templates rather than string literals)
2021-06-07cython: Add an option for selecting python 3 vs python 2 outputDylan Baker2-5/+34
2021-06-07Add C compiler when using CythonDylan Baker2-3/+4
Since cython transpiles to C.
2021-06-07ninjabackend: generate cython compilation rulesDylan Baker1-0/+61
2021-06-07ninjabackend: cython doesn't use a linkerDylan Baker1-4/+1
2021-06-07compilers: Add cython file suffixesDylan Baker2-0/+3
2021-06-07environment: Add detection logic for cythonDylan Baker1-0/+28
2021-06-07compilers: Expose Cython compilerDylan Baker1-0/+2
2021-06-07hack: compilers/cython: hardcode python 3 not 2Dylan Baker1-1/+2
2021-06-07compilers: Add a cython CompilerDylan Baker1-0/+60
2021-06-07build: Add type annotations for GeneratorDylan Baker1-14/+15
They're not 100% complete, but it's mostly there.
2021-06-06typing: Fully annotate dependencies.frameworkDaniel Mensinger1-14/+19
2021-06-06typing: Fully annotate dependencies.{detect,factory} + some other fixesDaniel Mensinger8-63/+101
2021-06-06typing: Fully annotate dependencies.cmakeDaniel Mensinger1-59/+69
2021-06-06typing: Fully annotate dependencies.platformDaniel Mensinger1-3/+9
2021-06-06typing: Fully annotate dependencies.dubDaniel Mensinger1-18/+31
2021-06-06typing: Fully annotate dependencies.pkgconfigDaniel Mensinger1-26/+33
2021-06-06Merge pull request #8796 from xclaesse/wrapdbv2Jussi Pakkanen3-52/+55
wrap: Port to v2 protocol
2021-06-05typing: Fully annotate dependencies.cudaDaniel Mensinger3-23/+39
2021-06-05typing: mlog use StringProtocolDaniel Mensinger2-2/+14
2021-06-05typing: Fully annotate dependencies.configtoolDaniel Mensinger1-16/+23
2021-06-05typing: Fully annotate dependencies.coarraysDaniel Mensinger1-5/+5
2021-06-04dependencies/detect: Add type annotations to find_external_dependencyDylan Baker1-4/+5
2021-06-04interpreterobjects: Fix type annotation for CustomTargetHolderDylan Baker1-1/+1
2021-06-04build: Add a type annotation to CustomTargetDylan Baker1-1/+1
2021-06-04interpreterbase: Allow safely using mutable default values with typed_kwargsDylan Baker1-2/+13
It's really inconvenient to want a thing that is always a list, but not be able to provide a default value of a list because of mutation. To that end the typed_kwargs method now makes a shallow copy of the default when using a `ContainerTypeInfo` as the type. This mean that using a default of `[]` is perfectly safe.
2021-06-04interpreterbase: fix type annotations for typed_pos_argsDylan Baker1-2/+2
It takes a tuple of any length, for optargs and varargs, not a tuple of length 1
2021-06-04wrap: Port to v2 protocolXavier Claessens3-52/+55
Fixes: #8754.
2021-06-03typing: Fully annotate dependencies.baseDaniel Mensinger1-64/+64
2021-06-03typing: mlog: Simplify some typing with a TV_ variablesDaniel Mensinger1-13/+15
2021-06-03deps: Split dependencies.baseDaniel Mensinger23-1857/+2055
Split the Factory and dependency classes out of the base.py script to improve maintainability.