Commit Graph

82 Commits

Author SHA1 Message Date
James Hilliard b21fd95f73 Add is_disabler function
This is useful if one needs to check if a variable is a disabler.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2019-08-12 01:05:45 +03:00
Marc-André Lureau 3811101434 meson: handle nested disabler
Fixes #5659
2019-07-23 08:46:26 -07:00
Daniel Mensinger 5ec79185a0
Address code review 2019-04-29 12:23:13 +02:00
Daniel Mensinger 2b5831f94f
Fix flake8-bugbear warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger 75b7a856cd
ast: support elementary object methods 2019-04-23 09:10:47 +02:00
Paolo Bonzini 7a02b76e70 interpreterbase: protect string division with FeatureNew
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-03-18 10:51:44 -07:00
Michael Hirsch, Ph.D 4e31ca3abe correct naming to CudaCompiler, pep8 2019-01-29 22:06:11 +02:00
Xavier Claessens 4b4f642e6a InterpreterBase: Fix extracting the node in all method/function calls
Closes: #4813.
2019-01-22 16:12:15 -05:00
Xavier Claessens 90d1f38d8e Interpreter: Set self.current_node during method/function calls
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-22 12:33:12 -05:00
Xavier Claessens 83766b3687 Fix flake8 errors 2019-01-16 11:16:46 -05:00
Jussi Pakkanen 95c620db67 Error out if kwargs dict contains a kwargs entry.
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.
2018-12-07 21:35:26 +02:00
Jussi Pakkanen 58b838a80b Can specify keyword arguments with a dict. 2018-12-04 23:44:17 +02:00
Jussi Pakkanen 23ed0e1857 Make string division do path joining. 2018-11-02 21:02:25 +02:00
Xavier Claessens 61348da069 Add 'disabler' argument to functions returning not-found objects
When dependency(), find_library(), find_program(), or
python.find_installation() return a not-found object and disabler is
true, they return a Disabler object instead.
2018-10-23 22:09:55 +03:00
Xavier Claessens a816e1c1fa Interpreter: Add 'continue' and 'break' keywords
Closes: #3601
2018-10-04 20:14:37 -04:00
Xavier Claessens fa2e096aa0 Interpreter: Add "in" and "not in" operators
Closes: #3600
2018-10-04 20:14:37 -04:00
Xavier Claessens 4f088365e4 interpreter: Add support for dict addition 2018-08-14 23:46:42 +03:00
Nirbheek Chauhan f80c11e7ee Clarify the FeatureNew summary message
Fixes https://github.com/mesonbuild/meson/issues/3858
2018-08-11 09:15:05 -07:00
Nirbheek Chauhan 43ececb036 Skip FeatureNew checks when project() has not been parsed
Fixes https://github.com/mesonbuild/meson/issues/3944
2018-08-11 09:15:05 -07:00
Nirbheek Chauhan 2093d45a4e Print a more usable message when a subproject fails to configure
Instead of just printing the message in the exception, if it's
a MesonException, also print the file and the line number. If it's an
unknown exception, print the entire traceback so that we can pin-point
what the Meson bug causing it is.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan 4fb00ee1d8 Add new method: mlog.deprecation()
Instead of constructing it manually, use a helper.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan a1d9adba09 FeatureNew: Make all checks subproject-specific
We now pass the current subproject to every FeatureNew and
FeatureDeprecated call. This requires a bunch of rework to:

1. Ensure that we have access to the subproject in the list of
   arguments when used as a decorator (see _get_callee_args).
2. Pass the subproject to .use() when it's called manually.
3. We also can't do feature checks for new features in
   meson_options.txt because that's parsed before we know the
   meson_version from project()
2018-07-02 19:52:53 +05:30
Nirbheek Chauhan cd1d53ee75 FeatureNew: Declare functions as class methods explicitly 2018-07-02 07:05:08 +00:00
Nirbheek Chauhan 18cd3bd31a FeatureNew: Minor code cleanup, no changes
Early return reduces indentation level and makes the code easier to
read.
2018-07-02 07:05:08 +00:00
Nirbheek Chauhan 817dcaa23b Remove permittedSnippetKwargs, snippets are not special
All we needed to do was change _get_callee_args() to also support
snippets.
2018-07-02 07:05:08 +00:00
Salamandar df1970d3ad Various bug fixes for FeatureNew
* Use _get_callee_args to unwrap function call arguments, needed for
  module functions.

* Move some FeatureNewKwargs from build.py to interpreter.py

* Print a summary for featurenew only if conflicts were found. The
  summary now only prints conflicting features.

* Report and store featurenew/featuredeprecated only once

* Fix version comparison: use le/ge and resize arrays to not fail on
  '0.47.0>=0.47'

Closes https://github.com/mesonbuild/meson/issues/3660
2018-07-02 07:05:08 +00:00
Xavier Claessens 2d3bfa0778 Interpreter: Fix subdir_done() to exit from inside if/foreach blocks
Closes: #3700.
2018-06-07 12:56:27 +00:00
Nirbheek Chauhan dff1d8eccf FeatureNew: Print WARNING instead of ERROR
ERROR is reserved for non-zero exit codes. People will probably get
confused.
2018-06-05 15:57:57 +00:00
Salamandar c5e85e59cc Add 0.47.0 features 2018-06-01 14:23:24 +02:00
Salamandar 00c4cf7d45 Add Feature{New,Deprecated}Kwargs decorators 2018-06-01 14:23:24 +02:00
Salamandar dd91f96867 Move target_version from coredata to mesonlib 2018-06-01 14:23:24 +02:00
Salamandar b9c37e4fd2 Add set instead of list for used features lits 2018-06-01 14:23:24 +02:00
Salamandar 4978dc0124 Cleanup : have more common code between FeatureNew and FeatureDeprecated 2018-06-01 14:23:24 +02:00
Salamandar 806ab181f2 Split function wrapper from a use() method 2018-06-01 14:23:24 +02:00
Salamandar ae19fec952 Add version_compare_condition_with_{min,max} for specific comparison utils.
Split FeatureNew and FeatureDeprecated
Implement features report to be printed in some 'dev mode'
2018-06-01 14:23:24 +02:00
Salamandar ee2f8a0416 Add basic code for feature version detection:
* store target version
* Add empty method decorator
2018-06-01 14:23:24 +02:00
Mathieu Duponchelle 10e7566ed8 dict: fix CI issues 2018-05-21 00:19:31 +02:00
Mathieu Duponchelle 195c356f91 dict: address review comments 2018-05-20 22:36:18 +02:00
Kyrylo Shpytsya 09dc48d941 Add methods to the dict builtin
Adds "has_key" and "get".

Adapted and updated by Mathieu Duponchelle <mathieu@centricular.com>
2018-05-20 21:19:44 +02:00
Mathieu Duponchelle ecb8838082 Add new built-in type, dict
For now dicts are immutable, and do not expose any methods,
they however support "native" syntax such as [] lookup,
and foreach iterating, and can be printed.
2018-05-20 21:19:44 +02:00
Mathieu Duponchelle f1c92d7c9c Interpreter: don't flatten the arguments of various methods
this fixes eg set_variable('foo', ['bar', 'baz']), which
was previously erroring out complaining about the number
of arguments.

Closes #1481
2018-05-04 15:24:21 +00:00
Xavier Claessens 10a9bdad96 interpreter: Verify permitted kwargs on all methods 2018-04-26 00:01:48 +03:00
behlec 37d379ebe5 Allow meson build file to exit early. (#2808) 2018-03-29 21:29:45 +03:00
Jussi Pakkanen 9ecb75670f
Merge pull request #3127 from bluetech/method-permitted-kwargs 2018-03-13 21:16:30 +02:00
Jon Turney 390333a18d Fix remaining flake8 report
$ flake8
./mesonbuild/interpreterbase.py:411:13: F821 undefined name 'set_variable'

This looks like an actual bug which would affect disabler use :)
2018-03-03 21:37:20 +00:00
Ran Benita 4d8e4654cb Warn if non-permitted keyword arguments are given to compiler methods
This can help future generations avoid mistakes like this:
edb1c66239

To avoid breaking builds, this is currently just an error. After
sufficient time has passed this can hopefully become a hard error,
similarly to the already-existing `permittedKwargs` warnings.
2018-02-23 04:35:15 +02:00
Jon Turney 7297e9f7a3 Add source location to warning for comparing different types 2018-02-15 12:53:46 +00:00
Jon Turney 56286fd2b8 Fix test cases/failing/52 inconsistent comparison
Since PR #2884, this is failing with an exception

Keep the behaviour we have had since PR #1810 (0.41.0), that ordering
comparisons of different types fail with an InterpreterException.

Also warn about equality comparisons of different types, which will one day
become an error, as per PR #2884.
2018-02-15 12:51:25 +00:00
Jussi Pakkanen 6cd7372e26 Comparing objects of different type prints a warning. Closes #2870. 2018-02-01 22:56:58 +02:00
Jon Turney 6a1a56ab57 Report warning/error locations in a format IDEs may already know how to parse
Examples:

meson.build:2:0: ERROR: Dependency is both required and not-found
meson.build:4: WARNING: Keyword argument "link_with" defined multiple times.

These are already matched by the default compilation-error-regexp-alist in
emacs.

Also:
Don't start 'red' markup until after the \n before an error
Unabsorb full-stop at end of warning with location from mlog.warning()
Update warning_location test
2018-01-30 06:48:22 +11:00