Commit Graph

26 Commits

Author SHA1 Message Date
Daniel Mensinger 43302d3296 interpreter: Introduce BooleanHolder for the bool primitive 2021-09-01 19:17:01 +02:00
Daniel Mensinger 86eda3c812 interpreter: Simplify Disabler logic 2021-09-01 19:17:01 +02:00
Daniel Mensinger 8d92e6d865 interpreter: Add IntegerHolder 2021-08-31 23:01:21 +02:00
Daniel Mensinger 86f70c873a interpreter: Introduce operators support for InterpreterObjects 2021-08-31 23:01:21 +02:00
Daniel Mensinger a6c9a151d3 interpreter: Make comparisons of different types a hard error 2021-08-31 23:01:21 +02:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
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-31 16:28:54 -04:00
Xavier Claessens f8cfd91d71 Simplify get_callee_args 2021-08-30 14:00:54 -04:00
Eli Schwartz 2a7125928e
use even more informative error message for invoking meson in a subdir
Follow-up on commit 5a7b8d86d0

Sometimes, we find a parent meson.build which is also malformed, and we
shouldn't suggest that maybe the user meant to use that, if it isn't a
valid project() either. Do a rough and dirty check to see if the very
first line is a project() declaration, and if not, don't try to be
clever and suggest using it.

The "invalid source tree" error suffices here, since we're not
absolutely sure meson can be successfully run in that parent directory
and actually advising people about the wrong location is a lot more
confusing than just saying "please figure this out yourself, here is
what to look for".

Granted, we miss cases where project() comes after blank lines and/or
comments, but doing a full AST parse here is excessively overkill and
probably too painful to do, and we don't need to be *that* clever. So
let's be content with merely going above and beyond the call of duty.
2021-08-22 12:12:26 -04:00
Eli Schwartz 5a7b8d86d0 use a more informative error message for invoking meson in a subdir
Explicitly mention that the project definition is invalid, and clarify
that project is `project()` -- a function.

Also try to walk the directory tree upward, and if there are parent
meson.build files, just say this isn't the project root, and "maybe you
meant to run meson there instead?"

This won't catch calls to subdir('foo/bar') but we can't be perfect,
only better than before and catch the *majority* of such cases, and
hopefully it's a lot more clear if meson protests that the project is
"invalid, there is no project() function", where the user should look
for a potential solution.

Fixes #3426
2021-08-22 12:49:11 +03:00
Tristan Partin 1dc13e9951 Add unset_variable()
This should be useful for helping to control variable scope within
Meson. CMake has something similar for controlling scope.
2021-08-16 14:05:13 -04:00
Daniel Mensinger 5c87167a34 interpreter: Fix list contains for Holders (fixes #9020 #9047) 2021-08-09 09:40:35 -04:00
Eli Schwartz bd6f46e723 condense lines 2021-07-05 17:55:04 +03:00
Eli Schwartz dd31891c1f more f-strings too complex to be caught by pyupgrade 2021-07-05 17:55:04 +03:00
Daniel Mensinger 971a0b1775 fix: get_variable default variables are not ObjectHolders (fixes #8936) 2021-07-02 17:14:44 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Daniel Mensinger 8f7343831b refactor: Refactor BothLibraries logic
This commit introduces a new type of `HoldableObject`: The
`SecondLevelHolder`. The primary purpose of this class is
to handle cases where two (or more) `HoldableObject`s are
stored at the same time (with one default object). The
best (and currently only) example here is the `BothLibraries`
class.
2021-06-26 12:49:35 +02:00
Daniel Mensinger 0358445b6e
fix: dicts and list need _holderify for fallback 2021-06-20 00:26:06 +02:00
Daniel Mensinger f1ac7db2e6
fix: Fix set_variable not holderifying (fixes #8904) 2021-06-20 00:26:02 +02:00
Daniel Mensinger c2c7f7c9d7 holders: Ensure that InterpreterBase is the sole instance for (un)holderifying 2021-06-18 23:48:33 +02:00
Daniel Mensinger d601227cb2 interpreter: Add FileHolder and remove specical case for File 2021-06-18 23:48:33 +02:00
Daniel Mensinger 7be172fe16 interpreter: Meson does not have floats --> remove them 2021-06-18 23:48:33 +02:00
Daniel Mensinger e686545fce interpreter: Split decorators from interpreterbase.py 2021-06-11 10:42:18 +02:00
Daniel Mensinger fc0397b309 interpreter: Split Disabler from interpreterbase.py 2021-06-11 10:42:18 +02:00
Daniel Mensinger 687eebee29 interpreter: Split base objects and helpers from interpreterbase.py 2021-06-11 10:42:18 +02:00
Daniel Mensinger 2e3550db14 interpreter: Split exception calsses from interpreterbase.py 2021-06-11 10:42:18 +02:00
Daniel Mensinger ad584f022d interpreter: Move interpreterbase.py into a new package 2021-06-11 10:42:18 +02:00