Commit Graph

75 Commits

Author SHA1 Message Date
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Daniel Mensinger 27bb5f536a typing: mlog use StringProtocol 2021-06-05 12:35:48 +02:00
Daniel Mensinger f502a38d1c typing: mlog: Simplify some typing with a TV_ variables 2021-06-03 10:23:27 -07:00
Xavier Claessens 8cd4d0b283 mlog: Do not print 'subproject|' for the message 'Executing subproject'
It already contains the full callstack and it's more visible when it's
standing on its own line.
2021-03-22 21:29:14 -04:00
Xavier Claessens 60c2c25d5b mlog: Do not print 'subproject|' on empty lines 2021-03-22 21:29:14 -04:00
Xavier Claessens b33e7bca73 mlog: Add a space after 'subproject|' 2021-03-22 21:29:14 -04:00
Xavier Claessens 3c1ccb923f logs: Prepend current subproject name to all messages
Meson used to prepend '|' for each nested subproject to distinguish in
the logs where a subproject start and ends. It is more useful to print
the current subproject name.

Also print the call stack when starting a new subproject to better see
which subproject chain leads to to.
2021-03-22 21:29:14 -04: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
Paolo Bonzini adb1b2f3f6 interpreter: accept external programs and dependencies for summary 2021-01-21 08:54:35 -05:00
Paolo Bonzini 021068a8b7 mlog: add __len__ to AnsiDecorator 2021-01-21 08:54:35 -05:00
Paolo Bonzini 9ba7b0ebd0 mlog: add __str__ method to AnsiDecorator
Automatically colorize the text when printing the AnsiDecorator, based
on the result of mlog.colorize_console().  This is how AnsiDecorator
is used most of the time anyway.
2021-01-21 08:54:35 -05:00
Dylan Baker a9ff308d27 mlog: make mlog helper take once keyword argument
We really want to have this in the log method as well.

Fixes: #8002
2020-12-16 21:15:09 +00:00
Dylan Baker f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
Paolo Bonzini f1ce78d77f mtest: cleanup and fix print_stats
Avoid calling self.collected_failures.append twice, and avoid
inflated indentation by adding a "plain" decorator to mlog.

Fixes: ba71fde18 ("mtest: collect failures regardless of colorized console", 2020-10-12)
2020-11-18 22:49:41 +02:00
Daniel Mensinger 1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
Daniel Mensinger ce042f318e
typing: Add run_mypy.py for easier mypy invocation 2020-09-08 20:15:56 +02:00
Nirbheek Chauhan 4ad4565ddd Add a notice about Python 3.5 support
This will be printed in bold at the end of interactive meson
sub-commands that won't be parsed by a program. Specifically: setup,
compile, test, and install.

NOTICE: You are using [...]
2020-09-02 10:37:40 +00:00
Nirbheek Chauhan 40319c9634 Don't make unactionable warnings fatal
Some warnings are out of the user's control, such as the RCC QT bug,
or the GNU windres bug, or our informational warning about
auto-disabling of options when -Db_bitcode is enabled.

Such warnings should not be fatal when --fatal-meson-warnings is
passed because there's no action that the user can take to fix it. The
only purpose it serves is to prevent people who use those features
from using --fatal-meson-warnings.
2020-07-05 16:13:00 +03:00
Jon Turney f107f9b396
Make colourize_console() a function
Currently, colourize_console is a constant, set at process
initialization.

To allow the actual stdout to be easily compared with the expected when
running tests, we want to allow colourization to be on for the test
driver, but not for the in-process configure done by run_configure,
which has stdout redirected from a tty to a pipe.

v2:
Cache _colorize_console per file object

v3:
Reset cache on setup_console()
2020-04-30 20:11:31 +01:00
Michael c53b637959 switch python2 %s for python3 .format 2020-04-21 00:16:21 +03:00
Jussi Pakkanen 9e5c881b06 Add property to disable compiler sanity checks during cross compilation. 2020-03-22 23:07:53 +02:00
Dylan Baker 1bb66d1568 fix conversion of hasattr to getattr
getattr() requires a default (return if missing) value or it raises an
AttributeError. In a few cases I changed hasattr to getattr and didn't
set a default value, so those cases could except. This corrects that.
2020-03-15 22:30:19 +02:00
Dylan Baker 1a82880730 mesonbuild/mesonlib: Add type annotations 2020-03-05 09:31:29 -08:00
Jussi Pakkanen 200738a3e6
Merge pull request #6692 from xclaesse/summary-warnings
Summary improvements
2020-03-01 19:30:10 +02:00
Jussi Pakkanen 25cbcb19a9
Merge pull request #6627 from jon-turney/cwd-relative-file-locations
Consistently report file locations relative to cwd
2020-03-01 18:17:41 +02:00
Dylan Baker 74452f2a1c mlog: fix remaining mypy errors and add to mypy check
There were two things mypy was warning about:
1) it doesn't understand hasattr()
2) It was possible for mlog.{error,warning,deprecation} to get passed
   multiple values for the once keyword argument.
2020-02-29 00:55:46 +02:00
Jon Turney c8f8d58273
Rename 'subdir' -> 'filename' in location objects 2020-02-28 11:54:08 +00:00
Jon Turney c3163040ae
Display filename cwd relative in warning location
Format the filename relative to cwd in a warning location.
2020-02-28 11:54:05 +00:00
Jon Turney 346b5c4be7
Store filename in node location
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).
2020-02-28 11:54:04 +00:00
Jon Turney 4895830c28
Fix typos in comments about type annotations 2020-02-28 11:54:03 +00:00
Jon Turney fa928e803b
Remove unused MesonException.get_msg_with_context()
After that, the only remaining user of get_error_location_string() is mlog,
so move that there.
2020-02-28 11:54:03 +00:00
Xavier Claessens 8101b0ddab summary: Add more info in Subprojects section
This adds a warnings counter for subprojects that passed. This is to
encourage developpers to check warnings in the logs and hopefully fix
them. Otherwise they could be hidden in hundreds lines of logs.

This also print the error message for subprojects that did not pass. The
error message is often enough to fix the issue (e.g. missing
dependency) and it's easier than searching in the logs why a subproject
failed.
2020-02-26 14:24:12 -05:00
Nirbheek Chauhan c05b725122 Split console colourization into a separate function
Use it instead of making a direct call to mlog._windows_ansi().
2020-02-16 00:26:08 +05:30
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Dylan Baker 614372aa55 mlog: Add a log_once function
There are a number of cases where we end up spamming users with the same
message over and over again, which is really annoying. This solves that.
2019-12-13 09:57:05 -05:00
Dylan Baker eb30c493f6 mlog: remove incorrect uses of global keyword
global is only needed to allow replacement of global values, they're
always in scope to read.
2019-12-13 09:57:05 -05:00
Daniel Mensinger 286b9f0921 lgtm: Fix Module imported with `import` and `import from` 2019-12-05 00:22:10 +02:00
Daniel Mensinger 9435f11b17
ci: Add CI command to include text files in the CI log 2019-11-19 15:21:13 +01:00
Daniel Mensinger e39d570d3a
mlog: add non bold version of colors 2019-11-14 17:05:18 +01: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
Niklas Claesson b8fbbf5964 Make parser errors print relative path to meson.build file 2019-10-10 00:40:30 +03:00
Michael Hirsch, Ph.D cb7d236696 pythonic file checks 2019-07-11 22:37:25 +03:00
Daniel Mensinger 2b5831f94f
Fix flake8-bugbear warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger e75211d321
Fix builtin variable names 2019-04-29 12:17:40 +02:00
Dylan Baker 891136178d mlog: add type annotations 2019-04-22 13:49:50 -07:00
Daniel Mensinger 5d2f14fce7
rewriter: Quiet logging by default 2019-03-04 13:00:30 +01:00
Xavier Claessens 815f1205a8 do_subproject: Improve log messages and formatting 2019-01-16 11:16:46 -05:00
Daniel Mensinger c033af914a
Disable mlog and don't require build directory for environment 2018-12-29 23:55:45 +01:00
Xavier Claessens 60b58e056f Add 'meson subprojects update' command
This is inspired by gst-build's git-update script.
2018-12-02 08:37:32 -05:00