| Age | Commit message (Collapse) | Author |
|
This avoids creating a dictionary every time an arithmetic operator
is evaluated.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Add error checks for cases in which the write target is unknown
and ensure all error cases indeed abort the execution to avoid
internal crash.
Resolves #13502.
Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
|
|
We can't modify dict-valued kwargs (#14739) but this lets us at least read
them.
|
|
The `default-options delete` and `kwargs delete` subcommands required
key/value pairs, where the key was deleted and the specified value was
ignored. This matches the JSON script mode interface but is unpleasant
as a CLI. Have the CLI `delete` commands accept a list of keys instead.
We can make this change because the UI is documented to be unstable.
However, to allow scripts to work with both old and new Meson, ignore
even-numbered arguments if they're all equal to the empty string.
Fixes: #13234
|
|
Many rewriter subcommands expect key/value pairs as adjacent arguments.
If the last value is missing, show a user-friendly error instead of a
backtrace.
For: #13234
|
|
|
|
Fixes: e81acbd606 ("Use a single coredata dictionary for options")
|
|
The project ID must be "/" and cannot be an arbitrary string.
|
|
Without this commit, the static introspection tool crashes when
introspecting systemd since certain values are `UnknownValue`
which was unexpected.
(I tested sytemd's commit hash fefcb935cd.)
|
|
Change the semantics of IntrospectionBuildTarget.source_nodes
and IntrospectionBuildTarget.extra_files .
The rewriter and the static introspection tool used to be very broken,
now it is *less* broken, hence we add some tests in this commit.
Fixes #11763
|
|
De-duplicate some code by extracting the common code into the new
`rm_src_or_extra` function.
|
|
|
|
`resolve_node` is simply a half-broken, worse implementation of
`node_to_runtime_value` that we recently introduced.
In the example below, the static introspection tool/rewriter now
understands that the name of the executable is foo instead of bar:
```
var = 'foo'
name = var
var = 'bar'
executable(name, 'foo.c')
```
|
|
Replace `AstInterpreter.reverse_assignment` with
`AstInterpreter.all_assignment_nodes`.
This does not give us an immediate advantage but
will be useful in future commits.
|
|
Replace the variable tracking of `AstInterpreter.assignments`
with a slightly better variable tracking called
`AstInterpreter.cur_assignments`.
We now have a class `UnknownValue` for more explicit handling
of situations that are too complex/impossible.
|
|
|
|
To improve type-safety and readability we replace a
dictionary with a new class `IntrospectionDependency`.
|
|
To improve type-safety and readability we replace a
dictionary with a new class `IntrospectionBuildTarget`.
|
|
Send the info to stdout, where it belongs.
|
|
|
|
this will allow transforming string types in the formater
|
|
Alterations to kwargs come in two flavors:
1. Remove/replace values (delete/set)
2. Modify values (add/remove)
Only for the second flavor do we care about the type of any existing
value.
|
|
An oddity: sys.stdout is statically defined as type TextIO instead of
TextIOWrapper, and thus doesn't have a .reconfigure method. This is
because they expect people to override sys.stdout with other objects,
which we do not do. Instead, assume it is always correct.
There are two final errors due to metaprogramming:
```
mesonbuild/mesonmain.py:196:13: error: Returning Any from function declared to return "int" [no-any-return]
mesonbuild/mesonmain.py:225:9: error: Returning Any from function declared to return "int" [no-any-return]
```
|
|
The add_arguments function is always called with a formatter in
mesonmain.py, and if it were not, then it would be incorrect when
calling argparse itself -- because formatter_class cannot be None, and
defaults to its own builtin one. This violates None-safety.
|
|
This replaces all of the Apache blurbs at the start of each file with an
`# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing
uses to be consistent in capitalization, and to be placed above any
copyright notices.
This removes nearly 3000 lines of boilerplate from the project (only
python files), which no developer cares to look at.
SPDX is in common use, particularly in the Linux kernel, and is the
recommended format for Meson's own `project(license: )` field
|
|
|
|
line argument code
|
|
|
|
|
|
|
|
|
|
use separate Node for multiline strings
|
|
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
Which adds the `use-set-for-membership` check. It's generally faster in
python to use a set with the `in` keyword, because it's a hash check
instead of a linear walk, this is especially true with strings, where
it's actually O(n^2), one loop over the container, and an inner loop of
the strings (as string comparison works by checking that `a[n] == b[n]`,
in a loop).
Also, I'm tired of complaining about this in reviews, let the tools do
it for me :)
|
|
|
|
|
|
|
|
Add ability to mutate a target's `extra_files` list through the
rewriter.
The logic is copied from sources add/rm, but changes the `extra_files`
kwarg instead of the sources positional argument.
Has additional logic to handle creating the `extra_files` list if it
doesn't exist.
|
|
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.
|
|
Which is really useful for catching parens used with keywords like
assert. Don't use parens with assert, it's bad.
|
|
|
|
performed by running "pyupgrade --py36-plus" and committing the results
|
|
All changes were created by running
"pyupgrade --py3-only --keep-percent-format"
and committing the results. I have not touched string formatting for
now.
- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
|
|
See https://stackoverflow.com/questions/54258996/git-bash-string-parameter-with-at-start-is-being-expanded-to-a-file-path
|
|
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
|
|
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.
this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
|