summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase.py
Commit message (Collapse)AuthorAgeFilesLines
* Add range() functionXavier Claessens2021-03-161-1/+15
| | | | Fixes: #5026.
* typed_pos_args: Fix typoXavier Claessens2021-03-161-2/+2
|
* Some documentation language adjustments & improved error messagesLaurin-Luis Lehning2021-03-101-1/+2
|
* Add tentative FeatureNew guardLaurin-Luis Lehning2021-03-101-0/+1
|
* Add failing test cases & release snippetLaurin-Luis Lehning2021-03-101-1/+1
|
* Use interpreter exceptions instead of MesonExceptionLaurin-Luis Lehning2021-03-101-2/+2
|
* Switch fstring syntax to @..@ & limit fstring captures to int, str, float ↔Laurin-Luis Lehning2021-03-101-2/+6
| | | | and bool
* Add support for basic format stringsLaurin-Luis Lehning2021-03-101-0/+14
|
* Add str.replace() methodTristan Partin2021-03-091-0/+7
|
* mass rewrite of string formatting to use f-strings everywhereEli Schwartz2021-03-041-20/+20
| | | | performed by running "pyupgrade --py36-plus" and committing the results
* interpreterbase: fix ObjectHolderDylan Baker2021-02-251-3/+3
| | | | | | There are two problems: 1. It doesn't take the generic type as a parameter 2. it sets subpproject to None, but expects to always get a string
* clarify some things in typed_pos_argsDylan Baker2021-02-061-27/+30
| | | | | This uses some variables to simplify some logic, and updates the docstring to be more useful.
* interpreterbase: Add support for optional arguments to typed_pos_argsDylan Baker2021-02-061-2/+38
| | | | | | | | | | | | This allows representing functions like assert(), which take optional positional arguments, which are not variadic. More importnatly you can represent a function like (* means optional, but possitional): ```txt func(str, *int, *str) ``` typed_pos_args will check that all of your types are correct, and if not provide None, which allow simplifying a number of implementation details
* interpreterbase: Add support for variadic arguments to typed_pos_argsDylan Baker2021-02-061-7/+35
| | | | This allows functions like `files()` to be decorated.
* interpreterbase: Add a helper method for typing positional argumentsDylan Baker2021-02-061-0/+55
| | | | | | | | We don't do a very good job of type checking in the interpreter, sometimes we leave it to the mid layers of backends to do that (layering violations) and sometimes we just don't check them at all. When we do check them it's a ton of boilerplate and complicates the code. This should help quite a bit.
* Fix misspellsAntonin Décimo2021-01-131-1/+1
| | | | Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
* stabilize iteration order for dictionariesPaolo Bonzini2020-11-151-2/+2
| | | | | | | | The order of keys in dictionaries cannot be relied upon, because the hash values are randomized by Python. Whenever we iterate on dictionaries and meson.build generates a list during the iteration, the different iteration orders may cause random changes in the command line and cause ninja to rebuild a lot of files unnecessarily.
* Add meson.project_build/source_root() methodsXavier Claessens2020-09-281-0/+1
|
* typing: get rid of most T.castDaniel Mensinger2020-09-081-2/+3
|
* typing: fully annotate mparser.pyDaniel Mensinger2020-09-081-4/+4
|
* typing: fully annotate mesonlib.pyDaniel Mensinger2020-09-081-2/+2
|
* typing: completely type interpreterbaseDaniel Mensinger2020-09-081-64/+68
|
* typing: refactor dict handlingDaniel Mensinger2020-09-081-17/+20
|
* interpreterbase: Fix typing annotationXavier Claessens2020-09-021-1/+1
| | | Co-authored-by: Daniel Mensinger <daniel@mensinger-ka.de>
* Special case meson.version().version_compare() statementXavier Claessens2020-09-021-1/+20
| | | | | | | | | when that statement gets evaluated, the interpreter remembers the version target and if it was part of the evaluation of a `if` condition then the target meson version is temporally overriden within that if-block. Fixes: #7590
* prevent disabler() object from overwriting arrays (#7484)Elliot2020-08-181-4/+2
| | | | | | | | | * prevent disabler object from overwriting arrays fixes #7107 * fix failing test forgot that func() != func(void) in c
* Fix typoZbigniew Jędrzejewski-Szmek2020-07-281-1/+1
|
* string: add substring methodStéphane Cerveau2020-07-201-0/+14
| | | | | This method aims to offer a simple way to 'substring' an existing string with start and end values.
* use FeatureNew.single_useDylan Baker2020-05-141-1/+1
| | | | This is just slightly cleaner looking
* interpreterbase: Proxy extra_message through to feature_check_classDylan Baker2020-05-141-2/+5
|
* interpreterbase: Add a oneline helper method for Feature(New|Deprecated)Dylan Baker2020-05-141-4/+15
| | | | | | This allows us to replace FeatureNew(..).use() with just FeatureNew.single_use(...). It's a lttle cleaner and hides some of the smell.
* interpreterbase: Allow passing an extra message in feature/deprecation warningsDylan Baker2020-05-141-6/+20
| | | | The intended use it to tell people the new thing to do.
* interpreterbase: Fix version checking for deprecationDylan Baker2020-05-121-2/+17
| | | | | | | | | | | | Currently deprecation features use the same logic as new features, but that doesn't work correctly. FeatureNew wants to warn about cases where you claim to support >= 0.40, but use a feature from 0.42; deprecation wants to warn when you claim to support >= 0.50, but use a feature that was replaced in 0.45. To make this work we need to invert the version check in the deprecation function, so that if the deprecation is 0.45, and the supported version is >= 0.50, we get a true not a false.
* interpreter: Don't assign duplication and new feature warning to the same ↔Dylan Baker2020-05-121-3/+12
| | | | | | | | | | variable Currently The Deprecated and New features checkers share an attribute through a base class that should be per class. We need to duplicate this and move it into each of the sublcasses Fixes #7080
* Allow get_variable to still function when the fallback is a disabler.James Hilliard2020-04-301-1/+1
|
* interpreterbase: Add warning when built-in object method has no kwargsXavier Claessens2020-03-191-13/+29
|
* fix conversion of hasattr to getattrDylan Baker2020-03-151-1/+1
| | | | | | getattr() requires a default (return if missing) value or it raises an AttributeError. In a few cases I changed hasattr to getattr and didn't set a default value, so those cases could except. This corrects that.
* mesonbuild/mesonlib: Add type annotationsDylan Baker2020-03-051-1/+1
|
* types: Remove redundant __init__() -> None annotationDaniel Mensinger2020-03-021-4/+4
|
* types: Use import typing as TDaniel Mensinger2020-03-021-51/+51
|
* review: Initial fixupDaniel Mensinger2020-03-021-4/+7
|
* types: (partially) annotate interpreterbase.pyDaniel Mensinger2020-03-021-175/+214
| | | | | | 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.
* types: Annotate ast/interpreter.pyDaniel Mensinger2020-03-021-2/+2
|
* types: Annotate mparser.pyDaniel Mensinger2020-03-021-6/+11
| | | | | | 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.
* Store filename in node locationJon Turney2020-02-281-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).
* Adjust all the other places MesonException file attribute is setJon Turney2020-02-281-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.
* dict: Fully evaluate keysXavier Claessens2019-12-041-11/+14
| | | | | The only restriction is keys must be string after evaluation. This fix various inconsistencies.
* Fixed issue that the key's value type wasn't checked correctly.fchin2019-11-121-1/+1
| | | Added two new failing tests.
* Adding dictionary entry using string variable as key.franczc2019-11-121-3/+10
|
* Fix typos found by codespellWolfgang Stöggl2019-11-061-2/+2
| | | | - Typos were found by codespell v1.16.0