aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
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 Baker2-1/+20
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 Baker2-1/+28
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-08run_unittests.py: Use mock for monkey patchingDylan Baker1-22/+20
it's what mock is for afterall
2021-06-08run_unittests.sh: fix Python DeprecationWarningPaolo Bonzini1-1/+1
Fix the following Python error: D:\a\1\s\run_unittests.py:6654: DeprecationWarning: invalid escape sequence \ self.assertEqual(libhello_nolib.get_pkgconfig_variable(escaped_var, {}), hello world) Use a raw string literal.
2021-06-08interpreter: add feature.disable_auto_if()Paolo Bonzini3-0/+24
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 Bonzini6-2/+57
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-07Merge pull request #8706 from dcbaker/wip/2021-04/cython-languageJussi Pakkanen25-33/+480
1st class Cython language support
2021-06-07Fix macpkg generator import path. [skip ci]Jussi Pakkanen1-1/+1
2021-06-07cython: Add an option for selecting python 3 vs python 2 outputDylan Baker2-5/+34
2021-06-07docs: Add cython docsDylan Baker4-10/+65
2021-06-07cython: Add a test for generated filesDylan Baker6-0/+104
2021-06-07cython: add 1 basic testDylan Baker8-2/+107
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 Mensinger2-14/+20
2021-06-06typing: Fully annotate dependencies.{detect,factory} + some other fixesDaniel Mensinger9-63/+104
2021-06-06typing: Fully annotate dependencies.cmakeDaniel Mensinger2-59/+70
2021-06-06typing: Fully annotate dependencies.platformDaniel Mensinger2-3/+10
2021-06-06typing: Fully annotate dependencies.dubDaniel Mensinger2-18/+32
2021-06-06typing: Fully annotate dependencies.pkgconfigDaniel Mensinger2-26/+34
2021-06-06Merge pull request #8796 from xclaesse/wrapdbv2Jussi Pakkanen6-52/+91
wrap: Port to v2 protocol
2021-06-05docs: Generate a table of all wrapdb releasesXavier Claessens3-0/+36
wrapdb CI will trigger Meson's CI to regenerate the list when releases.json is updated.
2021-06-05typing: Fully annotate dependencies.cudaDaniel Mensinger4-23/+40
2021-06-05typing: mlog use StringProtocolDaniel Mensinger2-2/+14
2021-06-05typing: Fully annotate dependencies.configtoolDaniel Mensinger2-16/+24
2021-06-05typing: Fully annotate dependencies.coarraysDaniel Mensinger2-5/+6
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 Baker2-2/+24
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 Mensinger2-64/+65
2021-06-03typing: mlog: Simplify some typing with a TV_ variablesDaniel Mensinger1-13/+15
2021-06-03deps: Split dependencies.baseDaniel Mensinger24-1859/+2059
Split the Factory and dependency classes out of the base.py script to improve maintainability.
2021-06-02add a couple more type annotationsDylan Baker2-2/+2
2021-06-02build: Use ImmutableSetProtocol for lru_cache'd valueDylan Baker1-2/+2
To avoid mutation if possible.