summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase.py
Commit message (Collapse)AuthorAgeFilesLines
* Allow CustomTarget's to be indexedDylan Baker2017-09-271-4/+6
| | | | | | | | | | | This allows a CustomTarget to be indexed, and the resulting indexed value (a CustomTargetIndex type), to be used as a source in other targets. This will confer a dependency on the original target, but only inserts the source file returning by index the original target's outputs. This can allow a CustomTarget that creates both a header and a code file to have it's outputs split, for example. Fixes #1470
* str.split() can now take a positional argumentNirbheek Chauhan2017-09-121-8/+19
| | | | | | | All the specified characters in the specified argument will be stripped. If unspecified, the old behaviour is used. Includes tests.
* Printing unknown kwarg error message no longer crashes the parser.Jussi Pakkanen2017-08-141-4/+10
|
* Store current line number so it can be printed in warning messages. Closes ↵Jussi Pakkanen2017-08-141-1/+5
| | | | #2181.
* Merge pull request #2017 from mesonbuild/fix2012Jussi Pakkanen2017-07-021-0/+1
|\ | | | | Do not pickle interpreter objects by accident
| * Make Interpreter object unpicklable as it was being pickled by accident in ↵Jussi Pakkanen2017-07-011-0/+1
| | | | | | | | copies of kwargs.
* | Improve "Passed invalid keyword argument" warning.Jehan2017-07-021-1/+1
|/ | | | | | | | | I got this warning on a build: > WARNING: Passed invalid keyword argument preset. This will become a hard error in the future. I had to grep in meson code to understand that "preset" was the name of the invalid argument. This is not obvious at all depending on the argument name (here it looked like it was about argument presets). Let's make it clearer by putting it in quotes.
* Fixed issues raised in review.Jussi Pakkanen2017-06-261-1/+1
|
* Moved func_ methods from base class to Interpreter.Jussi Pakkanen2017-06-261-47/+0
|
* Decorator to check for permitted kwargs.Jussi Pakkanen2017-06-261-0/+13
|
* Don't allow non-equality comparisons across types.Elliott Sales de Andrade2017-05-171-0/+5
|
* Only allow equality comparisons for non-elementary types.Elliott Sales de Andrade2017-05-171-0/+4
|
* Remove extra casts on InterpreterBase.evaluate_statement.Elliott Sales de Andrade2017-05-171-39/+5
| | | | | The result of this method is always a "native" object, and code coverage (plus a manual inspection) shows that this conversion is never done.
* Don't use len() to test emptiness vs not emptinessDylan Baker2017-05-021-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Meson has a common pattern of using 'if len(foo) == 0:' or 'if len(foo) != 0:', however, this is a common anti-pattern in python. Instead tests for emptiness/non-emptiness should be done with a simple 'if foo:' or 'if not foo:' Consider the following: >>> import timeit >>> timeit.timeit('if len([]) == 0: pass') 0.10730923599840025 >>> timeit.timeit('if not []: pass') 0.030033907998586074 >>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass') 0.1154778649979562 >>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass") 0.08259823200205574 >>> timeit.timeit('if len("") == 0: pass') 0.089759664999292 >>> timeit.timeit('if not "": pass') 0.02340641999762738 >>> timeit.timeit('if len("foo") == 0: pass') 0.08848102600313723 >>> timeit.timeit('if not "foo": pass') 0.04032287199879647 And for the one additional case of 'if len(foo.strip()) == 0', which can be replaced with 'if not foo.isspace()' >>> timeit.timeit('if len(" ".strip()) == 0: pass') 0.15294511600222904 >>> timeit.timeit('if " ".isspace(): pass') 0.09413968399894657 >>> timeit.timeit('if len(" abc".strip()) == 0: pass') 0.2023209120015963 >>> timeit.timeit('if " abc".isspace(): pass') 0.09571301700270851 In other words, it's always a win to not use len(), when you don't actually want to check the length.
* Fix an uninitialized variable access error.Hemmo Nieminen2017-02-021-0/+2
| | | | | | | | | | | | | | | | | To reproduce, one could write: foo = files('foo.c') foo[0].path() and get: Traceback (most recent call last): [snip] File "/home/trhd/Projects/meson/mesonbuild/interpreterbase.py", line 398, in method_call raise InvalidArguments('Variable "%s" is not callable.' % object_name) UnboundLocalError: local variable 'object_name' referenced before assignment Fix this by handling file objects separately.
* interpreter: Implement array.get(index, fallback)Nirbheek Chauhan2017-01-261-2/+14
| | | | | | | If the index is out of range, the fallback value is used. Includes a test. Closes #1337
* Better error message when using = rather than : for defining keywords.Jussi Pakkanen2017-01-231-2/+8
|
* cleanup: Remove redundant parenthesesMike Sinkovsky2017-01-181-2/+2
|
* style: [E303] too many blank lines (2)Mike Sinkovsky2017-01-111-1/+0
|
* style: [E712] comparison to True should be 'if cond is True:' or 'if cond:'Mike Sinkovsky2017-01-111-3/+3
|
* style: fix E225 violationsIgor Gnatenko2017-01-011-1/+1
| | | | | | E225: missing whitespace around operator Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* tree-wide: remove blank lines at EOFIgor Gnatenko2016-12-191-1/+0
| | | | Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Test targets with only generated and prebuilt objectsNirbheek Chauhan2016-12-131-1/+1
|
* Store subdir information for each node so we can remove files set in other ↵Jussi Pakkanen2016-12-041-1/+1
| | | | subdirectories.
* Moved more stuff, can now parse all of common tests.Jussi Pakkanen2016-11-191-1/+286
|
* Implement a bunch of functions.Jussi Pakkanen2016-11-191-0/+102
|
* Moved functions to base enough to get the base sample project parsed.Jussi Pakkanen2016-11-191-4/+199
|
* Embark on a journey to create a rewrite tool.Jussi Pakkanen2016-11-191-0/+54