summaryrefslogtreecommitdiff
path: root/mesonbuild/rewriter.py
AgeCommit message (Collapse)Author
2023-11-16Remove shebang from rewriter.pyMarcel Telka
2023-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott
line argument code
2023-09-11parser: simplify other node constructorsCharles Brunet
2023-09-11parser: simplify Assignment and PlusAssignment nodesCharles Brunet
2023-09-11parser: add SymbolNode to preserve operatorsCharles Brunet
2023-09-11parser: use IdNode for function name and assignment nameCharles Brunet
2023-09-11parser: preserve escape chars in stringsCharles Brunet
use separate Node for multiline strings
2023-04-11fix various spelling issuesJosh Soref
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-03-14rewriter: fix indentation of kwargsCharles Brunet
2023-03-14rewriter: add missing command aliasesCharles Brunet
2023-03-14rewriter: activate vsenvCharles Brunet
2023-02-01simplify instantiation of builtin type using builtins instead of functionsEli Schwartz
2022-11-30pylint: enable the set_membership pluginDylan Baker
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 :)
2022-09-19pylint: enable consider-using-inDylan Baker
2022-06-01ast: rename module constant to match PEP8 styleDylan Baker
2022-05-23move various imports into TYPE_CHECKING blocks for neatnessEli Schwartz
2021-12-15rewriter: create {add,rm}_extra_files commandsCeleste Wouters
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.
2021-08-31pylint: turn on superflous-parensDylan Baker
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.
2021-08-31pylint: turn on superfluous parens warningDylan Baker
Which is really useful for catching parens used with keywords like assert. Don't use parens with assert, it's bad.
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz
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
2021-01-12Allow '//' as project function id due to git bash path conversion.Luke Elliott
See https://stackoverflow.com/questions/54258996/git-bash-string-parameter-with-at-start-is-being-expanded-to-a-file-path
2021-01-04Use a single coredata dictionary for optionsDylan Baker
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).
2021-01-04use OptionKey for builtin and base optionsDylan Baker
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.
2021-01-04use OptionKey for compiler_optionsDylan Baker
2021-01-04use OptionKey for backend_optionsDylan Baker
2021-01-04use OptionKey for coredata.user_optionsDylan Baker
2020-11-05rewrite: fix modified member spellingMarc-André Lureau
2020-11-05rewrite: fix function spellingMarc-André Lureau
2020-04-20Compiler options per langJohn Ericson
A current rather untyped storage of options is one of the things that contributes to the options code being so complex. This takes a small step in synching down by storing the compiler options in dicts per language. Future work might be replacing the langauge strings with an enum, and defaultdict with a custom struct, just like `PerMachine` and `MachineChoice`.
2020-03-02review: Initial fixupDaniel Mensinger
2020-03-02types: Annotate ast/interpreter.pyDaniel Mensinger
2020-03-02types: Annotate the AST visitorsDaniel Mensinger
2020-03-02types: Annotate mparser.pyDaniel Mensinger
This also fixes that the keys in ArgumentNode.kwargs are all of the type BaseNode now. Before this commit, it was possible that both strings and Nodes where used as keys.
2020-02-28Rename 'subdir' -> 'filename' in location objectsJon Turney
2020-02-28Update rewriter for filename in node locationJon Turney
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger
2019-12-05lgtm: ignore all safe `__init__ method calls overridden method` warningsDaniel Mensinger
2019-12-05lgtm: Fix unused variableDaniel Mensinger
2019-11-06Fix typos found by codespellWolfgang Stöggl
- Typos were found by codespell v1.16.0
2019-06-05Per machine do 'build.' and '' option prefixesJohn Ericson
See the docs/ changes for details.
2019-06-05rewriter: Fix that default_options would not set the correct idDaniel Mensinger
Currently default_options uses "" for the kwarks id, however this is incorect and it must be "/". Additionally, this error won't be ignored in the future with "--skip" (this is why the tests were passing and this wasn't detected earlier).
2019-04-25rewriter: optimize the list_to_dict functionDylan Baker
This uses an iterator instead of walking a list, which is roughly twice as fast. This also does away with the pre-check on whether the list is valid for converting to a dict, and instead handles the case of an uneven number by catching another exception. This is preferable since it's a fatal error anyway, so avoiding it in the non-fatal case is preferable.
2019-04-21rewriter: fix error messageDaniel Mensinger
2019-03-04rewriter: Renamed _src -> _sourcesDaniel Mensinger
2019-03-04rewriter: Make sure variable names are validDaniel Mensinger
2019-03-04rewriter: Require '/' for the project IDDaniel Mensinger
2019-03-04rewriter: Abort on error by defaultDaniel Mensinger
2019-03-04rewriter: Changed line sort keyDaniel Mensinger