aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase.py
AgeCommit message (Collapse)AuthorFilesLines
2020-11-15stabilize iteration order for dictionariesPaolo Bonzini1-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.
2020-09-28Add meson.project_build/source_root() methodsXavier Claessens1-0/+1
2020-09-08typing: get rid of most T.castDaniel Mensinger1-2/+3
2020-09-08typing: fully annotate mparser.pyDaniel Mensinger1-4/+4
2020-09-08typing: fully annotate mesonlib.pyDaniel Mensinger1-2/+2
2020-09-08typing: completely type interpreterbaseDaniel Mensinger1-64/+68
2020-09-08typing: refactor dict handlingDaniel Mensinger1-17/+20
2020-09-02interpreterbase: Fix typing annotationXavier Claessens1-1/+1
Co-authored-by: Daniel Mensinger <daniel@mensinger-ka.de>
2020-09-02Special case meson.version().version_compare() statementXavier Claessens1-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
2020-08-18prevent disabler() object from overwriting arrays (#7484)Elliot1-4/+2
* prevent disabler object from overwriting arrays fixes #7107 * fix failing test forgot that func() != func(void) in c
2020-07-28Fix typoZbigniew Jędrzejewski-Szmek1-1/+1
2020-07-20string: add substring methodStéphane Cerveau1-0/+14
This method aims to offer a simple way to 'substring' an existing string with start and end values.
2020-05-14use FeatureNew.single_useDylan Baker1-1/+1
This is just slightly cleaner looking
2020-05-14interpreterbase: Proxy extra_message through to feature_check_classDylan Baker1-2/+5
2020-05-14interpreterbase: Add a oneline helper method for Feature(New|Deprecated)Dylan Baker1-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.
2020-05-14interpreterbase: Allow passing an extra message in feature/deprecation warningsDylan Baker1-6/+20
The intended use it to tell people the new thing to do.
2020-05-12interpreterbase: Fix version checking for deprecationDylan Baker1-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.
2020-05-12interpreter: Don't assign duplication and new feature warning to the same ↔Dylan Baker1-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
2020-04-30Allow get_variable to still function when the fallback is a disabler.James Hilliard1-1/+1
2020-03-19interpreterbase: Add warning when built-in object method has no kwargsXavier Claessens1-13/+29
2020-03-15fix conversion of hasattr to getattrDylan Baker1-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.
2020-03-05mesonbuild/mesonlib: Add type annotationsDylan Baker1-1/+1
2020-03-02types: Remove redundant __init__() -> None annotationDaniel Mensinger1-4/+4
2020-03-02types: Use import typing as TDaniel Mensinger1-51/+51
2020-03-02review: Initial fixupDaniel Mensinger1-4/+7
2020-03-02types: (partially) annotate interpreterbase.pyDaniel Mensinger1-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.
2020-03-02types: Annotate ast/interpreter.pyDaniel Mensinger1-2/+2
2020-03-02types: Annotate mparser.pyDaniel Mensinger1-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.
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.
2019-12-04dict: Fully evaluate keysXavier Claessens1-11/+14
The only restriction is keys must be string after evaluation. This fix various inconsistencies.
2019-11-12Fixed issue that the key's value type wasn't checked correctly.fchin1-1/+1
Added two new failing tests.
2019-11-12Adding dictionary entry using string variable as key.franczc1-3/+10
2019-11-06Fix typos found by codespellWolfgang Stöggl1-2/+2
- Typos were found by codespell v1.16.0
2019-10-24Return a disabler when an unknown method is called on a disabler objectJames Hilliard1-2/+5
2019-10-10Merge pull request #6011 from xclaesse/not-disablerJussi Pakkanen1-4/+2
Fix `if not disabler()` case
2019-10-10Make parser errors print relative path to meson.build fileNiklas Claesson1-1/+1
2019-10-08Test disabler in foreach loopsXavier Claessens1-4/+0
The is_disabler() check in evaluate_foreach() was useless because we already checked that items is a list.
2019-10-08Fix `if not disabler()` caseXavier Claessens1-0/+2
Closes: #6010
2019-08-12Add is_disabler functionJames Hilliard1-1/+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-23meson: handle nested disablerMarc-André Lureau1-8/+13
Fixes #5659
2019-04-29Address code reviewDaniel Mensinger1-1/+1
2019-04-29Fix flake8-bugbear warningsDaniel Mensinger1-1/+1
2019-04-23ast: support elementary object methodsDaniel Mensinger1-0/+18
2019-03-18interpreterbase: protect string division with FeatureNewPaolo Bonzini1-7/+18
Meson is not warning if you join paths with / but you are requesting a version older than 0.49.0; fix this before adding more features to the division operator. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-29correct naming to CudaCompiler, pep8Michael Hirsch, Ph.D1-1/+1
2019-01-22InterpreterBase: Fix extracting the node in all method/function callsXavier Claessens1-21/+14
Closes: #4813.
2019-01-22Interpreter: Set self.current_node during method/function callsXavier Claessens1-0/+8
The current node is useful to pass as location kwarg to mlog.warning(). The node is not passed to InterpreterObject method arguments, and it's easier to have it on the object than passing it through argument everywhere.
2019-01-16Fix flake8 errorsXavier Claessens1-1/+0
2018-12-07Error out if kwargs dict contains a kwargs entry.Jussi Pakkanen1-1/+3
Yo dawg! We heard U don't like kwargs in kwargs, so we made it impossible to put kwargs in your kwargs so now you can't kwargs with your kwargs.