summaryrefslogtreecommitdiff
path: root/mesonbuild/optinterpreter.py
Commit message (Collapse)AuthorAgeFilesLines
* optinterpreter: Fix builtin option names not being reserved anymoreXavier Claessens2021-10-141-18/+2
|
* optinterpreter: Downgrade error to deprecationXavier Claessens2021-10-131-1/+1
|
* optinterpreter: Add deprecated kwargXavier Claessens2021-10-091-0/+4
| | | | | | | | | It can be either: - boolean: the option is completely deprecated. - list: some choices are deprecated. - dict: some choices are deprecated and replaced by another. Fixes: #7444
* optinterpreter: Refactor to use typed_pos_args() and typed_kwargs()Xavier Claessens2021-10-091-121/+99
|
* optinterpreter: Add support for dictionariesXavier Claessens2021-10-091-0/+7
|
* fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger2021-06-291-1/+1
|
* various python neatness cleanupsEli Schwartz2021-03-041-1/+1
| | | | | | | | | | | | | | | | All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
* Use a single coredata dictionary for optionsDylan Baker2021-01-041-4/+3
| | | | | | | This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
* optinterpreter: organize the validation of arguments to be more readableDylan Baker2020-11-201-10/+13
|
* optinterpreter: use PEP8 compliant namesDylan Baker2020-11-201-10/+10
|
* optinterpreter: fix value being set in loopDylan Baker2020-11-201-1/+1
| | | | | | | This value shouldn't be set in the loop, it's probably been making things slow, but also creates the potential that if choices is an empty list that value would be unbound. While that's exteremly unlikly to happen in practice, it is showing up as a warning from pylance.
* Add type annotations to optinterpreterDylan Baker2020-11-201-19/+33
|
* pylint: turn on bad-indentation errorDylan Baker2020-09-221-1/+1
| | | | and fix all of the bad indentation
* typing: more fixesDaniel Mensinger2020-09-081-6/+5
|
* Capitalize some constants in coredataJohn Ericson2020-08-041-1/+1
| | | | | I've been getting confused between them and similarly-named other things, so I figured it was high time to clean this up.
* opts: Add FeatureNew for '-' and 'not' introduced in 0.54.1Daniel Mensinger2020-05-261-0/+2
|
* opts: Allow string concatenation (fixes #7199)Daniel Mensinger2020-05-261-0/+7
|
* optinterpreter: Enable and update FeatureNew to use_singleDylan Baker2020-05-141-7/+5
| | | | | With the version information fixed we can use a FeatureNew inside the optinterpreter, so let's do it.
* opts: Allow `-` and `not` in meson_options.txt (fixes #6948)Daniel Mensinger2020-04-111-0/+10
|
* types: Annotate mparser.pyDaniel Mensinger2020-03-021-2/+2
| | | | | | 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-2/+3
| | | | | | | | | | | | | | | 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.
* Refactor UserIntegerOption to work with BuiltinOption.Jussi Pakkanen2020-02-121-3/+2
|
* types: import typing as T (fixes #6333)Daniel Mensinger2020-01-081-2/+2
|
* No need to reserve build_ because we use build. instead.Jussi Pakkanen2019-07-151-1/+1
|
* Reserve build_ prefix in option names.Jussi Pakkanen2019-05-201-1/+1
|
* UserOption no longer has a name field.John Ericson2019-05-151-19/+15
| | | | | | | This avoids the duplication where the option is stored in a dict at its name, and also contains its own name. In general, the maxim in programming is things shouldn't know their own name, so removed the name field just leaving the option's position in the dictionary as its name.
* optinterpreter: Add a log argument to is_invalid_nameDylan Baker2019-04-051-3/+4
| | | | | | Since we're adding arguments that use the cross_ prefix but are valid we don't want to print "warning invalid argument name!", as that will confuse people by virtue of being wrong.
* optinterpreter: Add type annotations to is_invalid_nameDylan Baker2019-04-051-1/+1
|
* coredata: remove get_builtin_optionsDylan Baker2019-04-041-1/+1
| | | | | | | This returns a list out of th keys of a dict. In both cases of use remaining though it's used for checking membership, checking for list membership, lists are O(n) lookup, while dicts are O(1), so removing the abstraction reduces typing and improves performance.
* Reserve cross_ option prefix for Meson.Jussi Pakkanen2019-03-191-0/+4
|
* UserFeatureOption: Default to 'auto' when no value specifiedXavier Claessens2018-07-251-1/+1
| | | | Closes #3938.
* FeatureNew: Make all checks subproject-specificNirbheek Chauhan2018-07-021-4/+8
| | | | | | | | | | | | 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()
* Add UserFeatureOption typeXavier Claessens2018-06-181-0/+8
| | | | | | | | | | | This is a special type of option to be passed to most 'required' keyword arguments. It adds a 3rd state to the traditional boolean value to cause those methods to always return not-found even if the dependency could be found. Since integrators doesn't want enabled features to be a surprise there is a global option "auto_features" to enable or disable all automatic features.
* Convert args.projectoptions into a dictXavier Claessens2018-06-061-44/+1
| | | | | | | | | | | | | | | | | This simplifies a lot of code, and centralize "key=value" parsing in a single place. Unknown command line options becomes an hard error instead of merely printing warning message. It has been warning it would become an hard error for a while now. This has exceptions though, any unknown option starting with "<lang>_" or "b_" are ignored because they depend on which languages gets added and which compiler gets selected. Also any option for unknown subproject are ignored because they depend on which subproject actually gets built. Also write more command line parsing tests. "19 bad command line options" is removed because bad cmd line option became hard error and it's covered with new tests in "30 command line".
* optinterpreter: Remove duplicated list of languagesXavier Claessens2018-06-061-13/+2
| | | | | | It is important to keep the list of languages up to date in optinterpreter, otherwise we could have conflicting options when adding new languages.
* Add 0.45.0 featuresSalamandar2018-06-011-0/+4
|
* Add 0.44.0 featuresSalamandar2018-06-011-1/+2
|
* options: s/yiel/yield/ typoThibault Saunier2018-03-201-1/+1
| | | | Making the option unusable with Invalid kwargs for option use_orc: "yield"
* Fix subproject prefix handling when checking subproject option validity.Hemmo Nieminen2018-02-161-8/+25
|
* User options can "yield to" a user option of the same name in superproject. ↵Jussi Pakkanen2018-02-081-11/+26
| | | | Closes ##2853.
* Expose integer options to build option files.Jussi Pakkanen2018-02-071-0/+11
|
* Warn on unknown command line argumentsDylan Baker2017-12-191-0/+9
| | | | | | | I have a tendency to typo things. Humans in general are bad at spotting spelling mistakes, computers are not. This patches prints the bad options and provides the generic meson "This will be a hard error someday" message.
* Renamed UserStringArrayOption to UserArrayOption for short.Jussi Pakkanen2017-12-071-1/+1
|
* String arguments can permit arbitrary string valuesJussi Pakkanen2017-12-031-9/+11
| | | | by leaving out the choices keyword.
* Add new array type optionDylan Baker2017-11-291-0/+16
| | | | | | | This exposes the already existing UserStringArrayOption class through the meson_options.txt. The intention is to provide a way for projects to take list/array type arguments and validate that all of the elements in that array are valid without using complex looping constructrs.
* coredata: Remove parse_string() methodXavier Claessens2017-11-061-1/+1
| | | | | | | set_value() already does a better job at parsing strings, such as accepting "True" for a boolean. This fixes issue #2544
* options: Add a permitted_kwargs functionDylan Baker2017-10-041-3/+24
| | | | | | | | | | I've typo'd "value" for the last time, options needs a kwargs validator. This validator is slightly different than the one used by the main parser, since it operates on a much simpler representation than the other one does, and they are not interchangeable. This also changes the optinterpreter to use pop on 'type' and 'description' so that they're not passed to the validator as kwargs.
* Add option to limit maximum number of concurrent link processes.Jussi Pakkanen2017-08-051-11/+12
|
* Allow option values to contain ':'Nirbheek Chauhan2017-04-041-3/+4
| | | | | | | Instead, check that option keys don't contain ':'. Also change the failing option test to look for this. Closes https://github.com/mesonbuild/meson/issues/1454