Commit Graph

111 Commits

Author SHA1 Message Date
Eli Schwartz 1bb2523e58
remove f from f-string that has no formatting 2021-10-04 16:29:31 -04:00
Xavier Claessens d5917c1b87 coredata: Invalidate deps cache when changing wrap_mode option
Fixes: #8858
2021-06-11 09:40:21 -04:00
Dylan Baker d3003ebb41 mconf: line wrap columns nicely
I've picked 160 characters as a default because anything less than that
looks terrible and has awful wrapping going on. However, this respects
the $COLUNNS environment variable if set, and otherwise will query the
terminal to determine the size.

This is all achieved through an application of shtuil.get_terminal_size,
textwrap, print formatters, and iteration.

Fixes #6965
2021-04-20 20:14:33 -07:00
Dylan Baker cd8c334788 mconf: cleanup up and sort imports 2021-04-20 13:38:13 -07:00
Dylan Baker 10c19e1206 mconf: print core options for subprojects
Looking in the right dictionary is pretty useful, actually.
2021-04-20 13:25:08 -07:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Eli Schwartz 4340bf34fa
various python neatness cleanups
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
2021-03-04 17:11:26 -05:00
Dylan Baker d5238baa45 mconf: only print correct options in the correct sections
A predicate in two comprehensions was dropped, in what looks like a
rebase error on my part. With the predicate added things work correctly.

Fixes: #8344
2021-02-17 14:46:48 +02:00
Jussi Pakkanen 8133a7b9a4 Keep buildtype the same even if user changes debug and/or optimization. 2021-01-19 20:25:55 +00:00
Dylan Baker e81acbd606 Use a single coredata dictionary for options
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).
2021-01-04 12:20:58 -08:00
Dylan Baker 71db6b04a3 use OptionKey for builtin and base options
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.

this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
2021-01-04 12:20:40 -08:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata
needs to itself include. putting it in mesonlib makes more sense
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker 7142c92285 use OptionKey for backend_options 2021-01-04 12:15:41 -08:00
Dylan Baker e2ef6930ff use OptionKey for coredata.user_options 2021-01-04 12:15:41 -08:00
Dylan Baker b37f0cce2c movve insert_build_prefix to mconf
that's the only place it's used anyway.
2021-01-04 12:15:41 -08:00
Dylan Baker b25a423a64 use the OptionKey type for command line and machine files 2021-01-04 12:15:41 -08:00
Xavier Claessens 7902d2032d Refactor handling of machine file options
It is much easier to not try to parse options into complicated
structures until we actually collected all options: machine files,
command line, project()'s default_options, environment.
2020-10-16 17:42:24 -04:00
Daniel Mensinger 23818fc5a3
typing: more fixes 2020-09-08 20:15:58 +02:00
Dylan Baker af763e093a mconf/mintro: use authoritative list of options from coredata
This splits the directory options and non-directory options into two
dicts, and then merges them later to maintain API.
2020-08-01 22:00:06 -07:00
Xavier Claessens e191cbf6e9 mconf: Fix regression when printing all options
This is a regression introduced by #5489
2020-06-18 17:39:43 +03:00
John Ericson 278c294aa4 Compiler options per lang
A current rather untyped storage of options is one of the things that
contributes to the options code being so complex. This takes a small
step in synching down by storing the compiler options in dicts per
language.

Future work might be replacing the langauge strings with an enum, and
defaultdict with a custom struct, just like `PerMachine` and
`MachineChoice`.
2020-04-20 23:23:15 +03:00
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