Daniel Mensinger
8d92e6d865
interpreter: Add IntegerHolder
3 years ago
Dylan Baker
4d7031437c
pylint: turn on superflous-parens
...
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
3 years ago
Dylan Baker
1fc3d8608d
pylint: enable unnecessary-not check
...
This finds things like
```python
if not x == 1:
```
which should be
```python
if x != 1:
```
3 years ago
Dylan Baker
81f5cee218
interpreter: rename EnvironmentVariablesObject -> EnvironmentVariablesHolder
...
This is more consistent with other Holder classes
3 years ago
Dylan Baker
43f942be34
interpreterobjects: Use typed_kwargs for EnvironmentVariablesObject
3 years ago
Dylan Baker
3731e1d8f3
make EnvironmentVariablesObject a proper holder
...
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.
3 years ago
Dylan Baker
d6a1f85248
Allow EnvironmentVariablesObject to be passed an EnvironmentVariables instance
3 years ago
Dylan Baker
940fc372db
interperter/kwargs: narrow type checking
...
Since the convertor has been added env, we are now only going to be an
EnvironmentVariables object, nothing else.
3 years ago
Dylan Baker
d87b3c7b3f
interpreter/type_checking: Add convertor to env keyword argument
...
This does the conversion to an EnvironmentVariables, so that the
receiver always gets a EnvironmentVariables object and not a list, dict,
or string
3 years ago
Dylan Baker
75d2ec9a40
interpreter/type_checking: add a validator to env
...
Let's start moving the validation out of the interpreter object
3 years ago
Dylan Baker
ec59cbdf61
interpreter: move 'env' to type_checking
3 years ago
Xavier Claessens
ab773ff9e8
Simplify condition in can_run_host_binaries()
3 years ago
Dylan Baker
b4bc8464e6
Try to fix NoneType
...
Because mypy doesn't like the type alias.
3 years ago
Dylan Baker
11fbaf29d8
interpreter: fix cases of `KwargInfo(..., T, default=None)`
...
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
3 years ago
Dylan Baker
3f5d80b8bb
interpreter: fix name of typed_kwargs for `test()`
...
There was a copy-n-paste error here, and it was benchmark instead.
3 years ago
Dylan Baker
aa895b383c
interpreter: Add a helper for checking constrained inputs
...
This is quite valuable for enum-like inputs, where only a certain set
of values is allowed.
3 years ago
Rihards Skuja
4523e9d288
interpreter: fix IndexError when specifying dependency 'include_type'
...
Exception is thrown when dependency name is empty and when its
'include_type' differs from the default one.
Regression from b6d754a40c
.
3 years ago
Tristan Partin
959e1bb2e3
Add typed_kwargs to add_languages()
3 years ago
Xavier Claessens
e646130ef1
interpreter: Fix dependency(..., static: true) fallback
...
It should build the fallback subprject with default_library=static and
override the dependency for both static=True and static kwarg not given.
Fixes : #8050 .
3 years ago
Eli Schwartz
db04a3f5f2
Fix incomplete guidance on solving sandbox violations
...
We recommend people use declare_dependency and access it via
dependency() in a parent project. But this requires a wrap file (or to
use override_dependency and an explicit subproject call).
Let's actually mention that.
Fixes #9146
3 years ago
Dylan Baker
abababfb93
interpreterobjects: fix Test annotations
3 years ago
Dylan Baker
35dbf7e6d4
interpreter: fix overload for `source_strings_to_files`
3 years ago
Xavier Claessens
8c5aa031b5
Add install tags
...
Fixes : #7007 .
3 years ago
Dylan Baker
272674e792
interpreter/compiler: make helper methods protected
3 years ago
Dylan Baker
b30dddd4e5
interpreter/compiler: Add type checking for the Compiler object
...
This adds a full set of `typed_pos_args` and `typed_kwarg` decorations,
as well as fixing all of the typing errors reported by mypy.
3 years ago
Dylan Baker
bcb5400e34
interpreter/compiler: Add type annotations to TryRunResultHolder
3 years ago
Dylan Baker
7dda90f1bf
interpreter/compiler: remove unittest_args method
...
It's not documented, and it's been marked deprecated for who knows how
long.
3 years ago
Dylan Baker
32d3b5c9e2
interpreter/compiler: Replace permittedKwargs({}) with noKwargs
...
The former isn't really correct, as it wants a set and is getting a
dict, the other is also conceptually clearer I think.
3 years ago
Dylan Baker
a1fb3199c8
interpreterobjects: Add TypedDict annoations for `extract_search_dirs`
...
This allows for more accurate type checking
3 years ago
Dylan Baker
aca2192471
interpreter: fix `source_strings_to_files` annotations
...
It's missing a required overload declaration
3 years ago
Tristan Partin
1dc13e9951
Add unset_variable()
...
This should be useful for helping to control variable scope within
Meson. CMake has something similar for controlling scope.
3 years ago
Xavier Claessens
a2f110ff77
interpreter: Fix holder_map not being updated when subproject fails
...
Fixes : #9038
3 years ago
Jussi Pakkanen
3340d373fb
Revert "interpreter: Fix holder_map not being updated when subproject fails"
...
This reverts commit 566383c727
.
3 years ago
Xavier Claessens
27b319526c
interpreter: Fix spurious warning in configure_data()
...
This is a regression when porting to typed_pos_args().
3 years ago
Xavier Claessens
5462ea921f
interpreter: Fix missing subsubproject summary when subproject fails
...
In the case main->subp->subsubp, if subsubp succeed to configure but
subp subsequentially fails, subsubp is still being built but its summary
was missing.
3 years ago
Xavier Claessens
566383c727
interpreter: Fix holder_map not being updated when subproject fails
...
Fixes : #9038
3 years ago
Xavier Claessens
943596abbb
Fix --force-fallack-for with --wrap-mode=nofallback
...
Fixes : #9065
3 years ago
Felix Schwarz
53ce1610a6
fix spelling error in user output ("depencency" -> "dependency")
3 years ago
Dylan Baker
f4a1da0145
interpreterbase/decorators: use a named function for lowering strings
...
Mypy gets confused by the lambda, so we might as well just use a named
function.
3 years ago
Dylan Baker
2307cbd2ac
interpreter/typing: Add some type annotations
...
We really need PEP464 to annotate many fo thse correctly, but until then
we can manually annotate many of them to fix typing issues.
3 years ago
Dylan Baker
d1b52b913f
interpreter: split keyword definitions out of the interpreter
3 years ago
Xavier Claessens
0183954ea1
Fix meson.version().version_compare() regression in subproject
3 years ago
Dylan Baker
a881e849b5
modules/python: simplify a number of interfaces
...
Including not calling back into `Interpreter.func_*`, which is not a
good idea both from a type saftey and perforamance point of view.
Instead there's now a shared _impl method
3 years ago
Dylan Baker
f459c0e918
interpreter: remove stringArgs uses
...
It's only used now on a files that always raises an exception anyway,
might as well just not do any checking and reduces the uses of that
function
3 years ago
Dylan Baker
52c68ca6fe
interpreter: use typed_pos_args for files
3 years ago
Dylan Baker
011f13bcdc
interpreter: use typed_pos_args for add_langauges
3 years ago
Dylan Baker
011b58d75f
interpreter: use typed_pos_args for project
3 years ago
Dylan Baker
015e44014a
interpreter: use typed_pos_args for subdir
3 years ago
Dylan Baker
3f6afa2693
interpreter: use typed_pos_args for assert
3 years ago
Dylan Baker
2486938011
interpreter: use typed_pos_args for subproject
3 years ago