Commit Graph

139 Commits

Author SHA1 Message Date
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Xavier Claessens c6b512e64d mconf: Fix printing options when there is no compiler/project options
Closes: #6087
2019-10-22 22:32:34 +03:00
Xavier Claessens 88e77e69bc mconf: Group all options per subproject and align all groups
Also hide value of yielding subproject options to make it clear the
value must be set on the main project.
2019-10-18 00:49:27 +03:00
Daniel Mensinger 47bdea5040 mconf: Fix meson configure crash (fixes #5909) 2019-09-13 15:44:02 +03:00
Jussi Pakkanen 8a4aceef43 Do not print build and host settings when compiling natively. 2019-08-06 21:34:15 +03:00
John Ericson af2d7af998 Per machine do 'build.' and '' option prefixes
See the docs/ changes for details.
2019-06-05 23:05:34 -04:00
Dylan Baker 146e97e974 Use dependency cache 2019-05-20 10:05:36 -07:00
Dylan Baker d941ca1b19 mconf: Don't change the type of coredata.deps
Which is an OrderedDict, but mconf changes to a plain dict. This will
work fine with Python 3.7+, but not with 3.5 and 3.6
2019-05-16 11:12:17 -07:00
Daniel Mensinger cacc585b44 ast: fix #5376 2019-05-13 02:48:35 +03:00
Daniel Mensinger ea1ad718aa mconf: Limit the line length of the choices column 2019-02-17 20:19:34 +02:00
Jussi Pakkanen 82e4cb7731
Merge pull request #4743 from dcbaker/native-file-extended
Extend native files to store install path information
2019-02-12 20:04:23 +02:00
Jussi Pakkanen a32f31fdfa
Merge pull request #4826 from mensinda/confDefOpts
mconf: Use introspection to print the project default options (fixes #2543)
2019-02-12 20:00:34 +02:00
Dylan Baker 5b896ed70b allow setting directory locations in a native file
This allows the person running configure (either a developer, user, or
distro maintainer) to keep a configuration of where various kinds of
files should end up.
2019-02-11 12:50:32 -08:00
Daniel Mensinger 71d174bcbe
Fixed some code issues 2019-02-05 11:18:57 +01:00
John Ericson 19f81d3e33 Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.

Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so

 - The logic is cross-agnostic, i.e. there are no conditions affected by
   `is_cross_build()`.

 - Compiler args for both the build and host machines can always be
   controlled by the command line.

 - Compiler args for both machines can always be controlled separately.
2019-02-02 13:59:14 -05:00
Daniel Mensinger 90bc125d29
mconf: Use introspection to print the project default options (fixes #2543) 2019-01-25 12:21:32 +01:00
Jussi Pakkanen 3bf2ca483e
Merge pull request #4732 from mensinda/introMesonInfo2
mintro: Added `meson-info.json` introspection information about the latest meson run
2019-01-07 23:10:22 +02:00
Nicolas Schneider 3232f780d8 use same code for printing options in mconf and msetup
Also, options are now responsible for providing a suitable printable
representation of their value instead of handling this at the caller.
2019-01-06 19:41:24 -05:00
Daniel Mensinger ab32f1fe00 Added meson-info.json 2019-01-06 22:03:29 +01:00
Jussi Pakkanen a34ac74cf9
Merge pull request #4547 from mensinda/introIncDirs
mintro: Save introspection to disk and --targets modifications
2019-01-06 22:47:25 +02:00
Nicolas Schneider 735e138382 fix meson configure exception when install_umask is not an int 2019-01-06 22:35:04 +02:00
Daniel Mensinger d4ac832bf6
Split the monolithic introspection file into chunks 2019-01-06 12:19:29 +01:00
Daniel Mensinger b91c5aad85
Update intro dump on meson configure 2019-01-06 12:19:29 +01:00
Daniel Mensinger 1759fc8f45
Sorted arrays alphabetically 2018-11-24 10:57:22 +01:00
Xavier Claessens 43101489cd Recover when coredata cannot be loaded
Write command line options into a separate file to be able to
reconfigure from scatch in the case coredata cannot be loaded. The most
common case is when we are reconfiguring with a newer meson version.

This means that we should try as much as possible to maintain backward
compatibility for the cmd_line.txt file format.

The main difference with a normal reconfigure is it will use new
default options values and will read again environment variables like
CFLAGS, etc.
2018-11-06 16:37:13 -05:00
Xavier Claessens 37067a53c4 Use a single ArgumentParser for all subcommands
This has the adventage that "meson --help" shows a list of all commands,
making them discoverable. This also reduce the manual parsing of
arguments to the strict minimum needed for backward compatibility.
2018-10-04 09:40:21 -04:00
Xavier Claessens 1e6d72eb5a Remove useless __main__ in files that cannot be executed 2018-08-22 15:15:54 -04:00
Xavier Claessens 9350b9aa7b mconf: Take only one optional builddir arg that defaults to '.' 2018-06-06 20:02:37 +00:00
Xavier Claessens 75e501ceb8 coredata: Stop setting default option values as argparse attribute
All options are now the projectoptions list, regardless of how they got
defined in the command line.

This also delays setting builtin option values until the main project()
default options are parsed to simplify the code. This is possible
because we already delayed setting the backend after parsing main
project() in a previous commit.
2018-06-06 20:02:37 +00:00
Xavier Claessens 8afbfe227b mconf: Special case UserUmaskOption to print value in octal notation 2018-06-06 20:02:37 +00:00
Xavier Claessens 75cce9e157 mconf: Reduce code duplication and avoid missing builtin options
This ensure all option groups are printed the same way. Also ensure that
we cannot miss some builtin options by taking the list of all builtin
options and excluding only directories/testing options.
2018-06-06 20:02:37 +00:00
Xavier Claessens 04c5c53e3c mconf: Fix print when choices is a string instead of list 2018-06-06 20:02:37 +00:00
Xavier Claessens da29e48d13 mconf: Set prefix first because other options depends on it 2018-06-06 20:02:37 +00:00
Xavier Claessens 8fb72510c3 Move to coredata some methods handling options
Those methods only use coredata object, so better just move them as a
coredata method.
2018-06-06 20:02:37 +00:00
Xavier Claessens 3e6dc8fb71 mconf: Small tweaks when printing configuration 2018-06-06 20:02:37 +00:00
Xavier Claessens aa879b7f0c Fix issues found by flake8 2018-06-06 20:02:37 +00:00
Xavier Claessens b7d442150d Move <lang>_args to coredata.compiler_options 2018-06-06 20:02:37 +00:00
Xavier Claessens 24f1b96dde Fix setting c_args and friends from command line
When passing more than one -Dc_args it should override the value
instead of appending. This is how all other options works.

Value should be split on spaces using shlex just like it does with
CFLAGS environment variable.

Fixes #3473.
2018-05-01 12:09:45 +00:00
Xavier Claessens 570c108635 Fix --warnlevel being renamed to --warning-level in latest release 2018-04-27 11:09:14 -04:00
Xavier Claessens cb5ad2f211 Remove duplicated definition of -D cmdline arg 2018-04-26 22:46:40 -04:00
Filipe Brandenburger 170776d626 Add install_umask to list of options of `meson configure`
Tested:

  $ ./meson.py configure --help
  [...]
    --install-umask INSTALL_UMASK
                          Default umask to apply on permissions of installed
                          files (default: 022).
2018-04-25 14:11:06 -07:00
Dylan Baker 1c48cc08e0 mconf: accept -- options like `meson` does
I'm not really happy about this to be honest, I don't like having both
-- and -D options, I think it's stupid to have two ways to do exactly
the same thing, especially since we then have to validate that someone
hasn't passed the argument both ways.

However, other people want this, so here it is.

Fixes #969
2018-04-17 11:32:26 -07:00
Jussi Pakkanen 9b2e533d87 Always build parser objects anew to avoid leaking old data. 2018-03-27 00:39:45 +03:00
Jukka Laurila 52c50da6c7 Refactor: Add log.error and log.exception to reduce code duplication. 2018-03-10 18:04:52 +02:00
Sander Sweers 3a0ab6a2bc mconf: Make it pep8 compliant 2018-03-04 19:56:53 +01:00
Sander Sweers 9bafde953a mconf: make print_aligned static 2018-03-04 19:54:50 +01:00
Sander Sweers 9d31c751b6 mconf: Do not store dict keys for no reason
If a dict is empty it will evaluate to False
2018-03-04 19:54:50 +01:00
Sander Sweers 84d382f963 mconf: User newline instead of printing empty string 2018-03-04 19:54:50 +01:00
Sander Sweers f805f8e109 mconf: Replace usage of keys() on dicts with direct call by sorted
Calling sorted or list on a dictionary will return the keys.
2018-03-04 19:54:50 +01:00
Sander Sweers 41b5983823 Re-implement function print_aligned
It is now more readable, more pythonic and fixes #3149
2018-03-04 19:54:50 +01:00
Sander Sweers ae90b6586f mconf: Do not turn opt.choices into a string
It is inconsistent with other option groups. It also breaks
print_aligned as it handles lists.
2018-03-04 19:54:50 +01:00
Hemmo Nieminen 7fb8e518b2 Harmonize data pickling.
Try to be more consistent on using save() and load() methods to pickle
data.
2018-03-01 01:06:51 +02:00
Eric Engestrom da2343fb5e mconf: print choices of base options
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-11-27 20:54:03 +02:00
Josh Soref 4a572434a0 spelling: when 2017-11-26 17:28:33 +00:00
Eric Engestrom 5f7f5cdb05 Print correct command in help message
Taking mconf for instance:
before:
  $ meson configure --help
  usage: meson [-h] [-D SETS] [--clearcache] [directory [directory ...]]
after:
  $ meson configure --help
  usage: meson configure [-h] [-D SETS] [--clearcache] [directory [directory ...]]
2017-11-09 21:12:34 +02:00
Jussi Pakkanen a800c96f99 Add option to limit maximum number of concurrent link processes. 2017-08-05 00:24:59 +03:00
Elliott Sales de Andrade ea636fcd51 Remove unused variables. 2017-05-17 04:41:54 -04:00
Elliott Sales de Andrade faf114299b Remove unnecessary __init__ methods. 2017-05-17 03:54:49 -04:00
Yasushi SHOJI abd12b69ea mesonconf: reorder output columns
mesonconf prints build dir information in the order of

  'Option' 'Description' 'Current Value' and, optionally, 'Possible Value'.

The Description tends to be longer and push the following values far
right, sometimes way far than fits in the full screen size of a
terminal on a FullHD monitor.

Experienced users know which options they want to change without
looking at the description string however they need to check the
current values for sure.

This patch moves the description to the last column.  Now mesonconf
prints options in the following order:

  'Option' 'Current Value' 'Possible Value' 'Description'

To implement this, mainly print_aligned() is modified.  The second
argument of the function is changed from

 - array of array of string to
 - array of dict with 'name', 'descr', 'value', and 'choices,

which maps to 'option', 'description', 'current value' and 'possible
values', respectively.

Since the position of the possible values are moved before its
description, the presence and the length of it affects header as well
as the following description.  Thus, we cal curate it before printing
the header.

To avoid re-calculation, we keep string version of the values and
flattened version of the possible values _in the given array_, which
means that now the print_aligned() function modify the the given
array.  The current callers do not use the passing array.  So there
should be no bad effects.
2017-05-15 22:02:06 +03:00
Dylan Baker a8173630ea Don't use len() to test emptiness vs not emptiness
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.
2017-05-02 21:57:26 +03:00
Jussi Pakkanen fa0382f1f9 Add option to mesonconf to wipe cached data. 2017-01-23 21:01:34 +02:00
Mike Sinkovsky 969be1f679 cleanup: Remove redundant parentheses 2017-01-18 21:22:47 +02:00
Mike Sinkovsky 77515ee541 style: [E303] too many blank lines (2) 2017-01-11 12:33:27 -05:00
Igor Gnatenko dd36847c4b style: fix E202 violations
E202: whitespace before ']'

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-02 19:09:47 +01:00
Igor Gnatenko c13160034f style: fix E201 violations
E201: whitespace after '['

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-02 19:08:16 +01:00
Igor Gnatenko f0bc5568a7 style: fix E703 violations
E703: statement ends with a semicolon

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 969dc7e995 style: fix E124 violations
E124: closing bracket does not match visual indentation

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 116da33cdd style: fix E128 violations
E128: continuation line under-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 2017d8578a style: fix E226 violations
E226: missing whitespace around arithmetic operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 139e020ede tree-wide: use proper 'not in' notation
Let's be more pythonic and 'not is' seems really weird.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 21:48:35 +01:00
Igor Gnatenko 5bf22c5678 add support for $sharedstatedir
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 00:08:45 +01:00
Igor Gnatenko 2962d3a66b add support for $infodir
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 00:01:27 +01:00
Igor Gnatenko 380b362fa4 add support for $sbindir
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 00:01:23 +01:00
Igor Gnatenko c9818c02ec add builtin support for localstatedir
Reported-by: Richard Hughes <richard@hughsie.com>
Closes: https://github.com/mesonbuild/meson/issues/1142
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-12-06 20:27:02 +02:00
Jussi Pakkanen e0034fd6a5 A few sysconf fixes. 2016-11-02 12:11:47 -07:00
Jussi Pakkanen 1f4cce86ad Remove shebangs on files that are not runnable and add execute bits to those that are. 2016-10-07 21:10:33 +03:00
Elliott Sales de Andrade 4c71695e41 Use context manager for file I/O.
There are a few cases where a context manager cannot be used, such as
the logger.
2016-08-27 18:29:55 -04:00
Jussi Pakkanen 7694321276 Renamed compile&link args and made them accessible from get_option. 2016-05-28 21:56:41 +03:00
Hemmo Nieminen 3f3fcace3d mconf: Include testing related options when printing build configuration. 2016-04-04 02:52:30 +03:00
Hemmo Nieminen af6f4c9b9c coredata: Centralize builtin option descriptions and definitions. 2016-04-04 02:52:30 +03:00
Hemmo Nieminen 336904b553 Move MesonException from coredata to mesonlib. 2016-04-01 00:52:45 +03:00
Jussi Pakkanen d87eb7d290 Merge branch 'base_options'. 2016-03-20 22:04:24 +02:00
Jussi Pakkanen a405f7a499 Grab base options from the command line. 2016-03-20 20:43:32 +02:00
Jussi Pakkanen 0c63f75aaf Converted coverage into a base option. 2016-03-20 19:16:49 +02:00
Nirbheek Chauhan 11f63105d0 New builtin option: libexecdir for installation of helper executables 2016-03-17 16:17:06 +05:30
Jussi Pakkanen 19046fd854 Added new base options and some sample opts for gcc. 2016-03-16 21:55:03 +02:00
Martin Ejdestig 6a90d5d587 Print value of werror in mesonconf 2016-02-22 19:45:34 +01:00
Jussi Pakkanen 3abd5305c2 Default to cwd in mesonconf. Closes #400. 2016-02-20 00:02:44 +02:00
Jussi Pakkanen 23b98cd6e6 Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir. 2016-01-16 17:35:29 +02:00