aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast/interpreter.py
AgeCommit message (Collapse)AuthorFilesLines
2022-10-03pylint: enable unnecessary-comprehensionDylan Baker1-2/+2
2022-07-03move various unused typing-only imports into type-checking blocksEli Schwartz1-10/+12
2022-07-03sort imports for neatnessEli Schwartz1-3/+4
2022-05-03interpreter: new function add_project_dependencies()Paolo Bonzini1-0/+1
This function can be used to add fundamental dependencies such as glib to all build products in one fell swoop. This can be useful whenever, due to a project's coding conventions, it is not really possible to compile any source file without including the dependency. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-30Add new debug() functionMarvin Scholz1-0/+1
Adds a new debug() function that can be used in the meson.build to log messages to the meson-log.txt that will not be printed to stdout when configuring the project.
2022-03-13Merge pull request #9339 from dcbaker/submit/structured_sourcesJussi Pakkanen1-0/+1
Structured Sources
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz1-6/+8
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-03-07interpreter: add an implementation for structured_sourcesDylan Baker1-0/+1
2021-12-01add install_symlink functionPablo Correa Gómez1-0/+1
Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward #9557
2021-10-08add install_emptydir functionEli Schwartz1-0/+1
This replaces the absolute hack of using ``` install_subdir('nonexisting', install_dir: 'share') ``` which requires you to make sure you don't accidentally or deliberately have a completely different directory with the same name in your source tree that is full of files you don't want installed. It also avoids splitting the name in two and listing them in the wrong order. You can also set the install mode of each directory component by listing them one at a time in order, and in fact create nested structures at all. Fixes #1604 Properly fixes #2904
2021-10-06interpreter: Holderify arrays and dictsDaniel Mensinger1-5/+14
This is the final refactoring for extracting the bultin object logic out of Interpreterbase. I decided to do both arrays and dicts in one go since splitting it would have been a lot more confusing.
2021-09-25interpreter: Introduce StringHolderDaniel Mensinger1-1/+2
Another commit in my quest to rid InterpreterBase from all higher level object processing logic. Additionally, there is a a logic change here, since `str.join` now uses varargs and can now accept more than one argument (and supports list flattening).
2021-09-01interpreter: Introduce BooleanHolder for the bool primitiveDaniel Mensinger1-1/+2
2021-08-31interpreter: Add IntegerHolderDaniel Mensinger1-1/+2
2021-08-31pylint: turn on superflous-parensDylan Baker1-6/+6
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-16Add unset_variable()Tristan Partin1-0/+1
This should be useful for helping to control variable scope within Meson. CMake has something similar for controlling scope.
2021-07-25ast: Add dummy "support" for fstrings in the ast packageDaniel Mensinger1-0/+4
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger1-1/+1
2021-06-18holders: Fix the remaining code to respect the holder changesDaniel Mensinger1-0/+9
2021-06-18interpreter: Add a new MesonInterpreterObject for non-elementary objectsDaniel Mensinger1-10/+20
2021-03-16Add range() functionXavier Claessens1-0/+1
Fixes: #5026.
2021-03-06Refactor subdir visitation to track files instead of dirs.Jussi Pakkanen1-6/+7
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-2/+2
performed by running "pyupgrade --py36-plus" and committing the results
2020-09-08typing: fixup for #7708Daniel Mensinger1-1/+5
2020-09-08typing: refactor dict handlingDaniel Mensinger1-8/+8
2020-09-08IntrospectInterpreter: allow dictionaries with nonconstant keysPaolo Bonzini1-0/+10
Something like {a: foo} currently stymies the IntrospectionInterpreter and breaks introspection of the source directory. The fix is just to walk the keys and return a dummy dictionary. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-05-23ast: Handle NotNodeDaniel Mensinger1-0/+5
2020-03-19interpreterbase: Add warning when built-in object method has no kwargsXavier Claessens1-5/+6
2020-03-06ast: Implement dummy evaluate_notstatementDaniel Mensinger1-0/+5
2020-03-06ast: Do not resolve dict keysXavier Claessens1-1/+1
Fixes: #6748
2020-03-02types: Remove redundant __init__() -> None annotationDaniel Mensinger1-1/+1
2020-03-02review: Initial fixupDaniel Mensinger1-5/+5
2020-03-02types: Annotate ast/introspection.pyDaniel Mensinger1-12/+4
2020-03-02types: (partially) annotate interpreterbase.pyDaniel Mensinger1-13/+21
This commit annotates most of interpreterbase.py. However, there are stil the @wraps missing, since I am unsure what the types are supposed to be here.
2020-03-02types: Annotate ast/interpreter.pyDaniel Mensinger1-38/+46
2020-03-02types: Annotate the AST visitorsDaniel Mensinger1-3/+3
2020-03-02types: Annotate mparser.pyDaniel Mensinger1-1/+9
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-28Store filename in node locationJon Turney1-1/+1
Warnings have a location node object (with subdir and lineno attributes), which is passed as a location: kwarg to mlog.warning() and formatted in _log_error(). Re-purpose the subdir attribute (path relative to the source root dir, with an implied filename of 'meson.build'), which is stored into the node by parser(), to contain a pathname. (Properly I should rename 'subdir' -> 'file' everywhere, but that's a lot of churn just to see if this works) Notes: The warning location node may also have a colno attribute, which is currently ignored by _log_error(). We can't currently issue warnings with locations in meson_options.txt because the filename isn't part of the location (as it's assumed to be 'meson.build).
2020-02-28Adjust all the other places MesonException file attribute is setJon Turney1-1/+1
A MesonException has file, lineno and colno attributes, which get formatted as a location in mlog.exception(). The file attribute got changed from a path relative to the root source directory to a pathname (absolute or relative to cwd) in one place in commit b8fbbf59. Adjust all the other places the file attribute is set to match. Also: Setting MesonException.file seems to be missing in the case where Parser returned a non-CodeBlockNode object. Fortunately, that looks like it's unreachable, but add it just in case.
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger1-5/+5
2019-12-12Add a summary() function for configuration summarizationXavier Claessens1-0/+1
Based on patch from Dylan Baker. Fixes #757
2019-11-06Fix typos found by codespellWolfgang Stöggl1-1/+1
- Typos were found by codespell v1.16.0
2019-09-04mintro: Fix resolving nodes in kwargs (fixes #5884)Daniel Mensinger1-42/+66
2019-08-12Add is_disabler functionJames Hilliard1-0/+1
This is useful if one needs to check if a variable is a disabler. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2019-07-31mintro: Fix crash related to the sources kwarg (fixes #5741)Daniel Mensinger1-1/+1
2019-07-10Add alias_target() functionXavier Claessens1-0/+1
2019-05-13ast: fix #5376Daniel Mensinger1-2/+8
2019-04-23ast: Address code reviewDaniel Mensinger1-3/+7
2019-04-23make flake8 happyDaniel Mensinger1-1/+0
2019-04-23ast: Make sure to avoid infinite recursionsDaniel Mensinger1-9/+9