aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mlog.py
AgeCommit message (Collapse)AuthorFilesLines
2022-03-23mlog: add support for italic/emphasized text in AnsiTextHemmo Nieminen1-0/+3
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz1-1/+1
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2021-12-30fix type annotations for mlog nestingEli Schwartz1-1/+1
In commit 8cd4d0b2832666f19660b9006040e5ff7e5d4576 we added a feature that took True/False but said it took str.
2021-10-27Revert "mark a couple of typing-only imports as noqa, to appease pyflakes"Eli Schwartz1-3/+1
This reverts commit 6cc1b8441c0cf7428e52bdf1cd541ea830a4eb83. The latest version of pyflakes learned to detect that correctly.
2021-10-27fix various flake8 whitespace errorsEli Schwartz1-1/+1
2021-10-26fix lgtm.com "Use of the return value of a procedure"Eli Schwartz1-2/+3
we return _log even though this entire family of functions returns None, because a side effect of returning is that the other version of the function is not run. We can do that more obviously, using an else clause that doesn't attach meaning to return values.
2021-09-29Revert "mtest: fix test output issues (in console)"Paolo Bonzini1-3/+0
This reverts commit 5fcb0e6525e2044e0f82bda488a51350e0f7f29f. The commit is a massive change that should have been split in separate pieces, and it also removes a few features: * in verbose mode, subtests are not printed as they happen * in non-verbose mode the progress report does not include the number of subtests that have been run * in non-parallel mode, output is batched rather than printed as it happens Furthermore, none of these changes are not documented in the release notes. Revert so that each proposal can be tested, evaluated and documented individually.
2021-09-25mtest: fix test output issues (in console)Hemmo Nieminen1-0/+3
This change set aims to fix various "issues" seen with the current implementation. The changes can be summarized with the following list: * Replace emojis and spinners with multiline status displaying the name and running time of each currently running test. * The test output (especially in verbose mode or when multiple failing tests' output gets printed out) can get confusing. Try to make the output easier to read and grasp. Most notable change here is the addition of the test number to the beginning of each printed line. * Print exit details (i.e. exit code) of the test in verbose mode. * Try to make the verbose "live" output from tests to match the look and feel of otherwise produced (verbose) test output.
2021-09-24mlog: fix annotationDylan Baker1-1/+1
2021-09-14mark a couple of typing-only imports as noqa, to appease pyflakesEli Schwartz1-1/+3
Since it cannot resolve `import typing as T` in order to figure out that T.* is doing annotation-worthy stuff. Since T.cast('Foo') is not actually using Foo except in an annotation context (due to being a string) it requires extra work to resolve, and the only thing that would currently work is actually using 'typing.cast'. However, we have decided to not use it except as T... Since this import is only imported during mypy it's not so bad to noqa it.
2021-09-07summary: fix dependenciesPaolo Bonzini1-2/+2
Dependencies are currently printed as [<mesonbuild.mlog.AnsiDecorator object at 0x7faa85aeac70>, ' ', <mesonbuild.mlog.AnsiDecorator object at 0x7faa85aeab50>] This was introduced in commit adb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6, due to an incorrect type annotation on the AnsiText constructor. Fix both the annotation and the usage. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger1-1/+1
2021-06-05typing: mlog use StringProtocolDaniel Mensinger1-2/+11
2021-06-03typing: mlog: Simplify some typing with a TV_ variablesDaniel Mensinger1-13/+15
2021-03-22mlog: Do not print 'subproject|' for the message 'Executing subproject'Xavier Claessens1-3/+4
It already contains the full callstack and it's more visible when it's standing on its own line.
2021-03-22mlog: Do not print 'subproject|' on empty linesXavier Claessens1-1/+5
2021-03-22mlog: Add a space after 'subproject|'Xavier Claessens1-1/+1
2021-03-22logs: Prepend current subproject name to all messagesXavier Claessens1-6/+6
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-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-4/+4
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz1-2/+2
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-01-21interpreter: accept external programs and dependencies for summaryPaolo Bonzini1-0/+12
2021-01-21mlog: add __len__ to AnsiDecoratorPaolo Bonzini1-0/+3
2021-01-21mlog: add __str__ method to AnsiDecoratorPaolo Bonzini1-0/+3
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.
2020-12-16mlog: make mlog helper take once keyword argumentDylan Baker1-5/+10
We really want to have this in the log method as well. Fixes: #8002
2020-11-20use real pathlib moduleDylan Baker1-1/+1
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-18mtest: cleanup and fix print_statsPaolo Bonzini1-1/+4
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-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-09-08typing: Add run_mypy.py for easier mypy invocationDaniel Mensinger1-1/+1
2020-09-02Add a notice about Python 3.5 supportNirbheek Chauhan1-2/+7
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-07-05Don't make unactionable warnings fatalNirbheek Chauhan1-2/+2
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-04-30Make colourize_console() a functionJon Turney1-6/+23
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-21switch python2 %s for python3 .formatMichael1-1/+1
2020-03-22Add property to disable compiler sanity checks during cross compilation.Jussi Pakkanen1-1/+1
2020-03-15fix conversion of hasattr to getattrDylan Baker1-1/+1
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-05mesonbuild/mesonlib: Add type annotationsDylan Baker1-1/+1
2020-03-01Merge pull request #6692 from xclaesse/summary-warningsJussi Pakkanen1-0/+4
Summary improvements
2020-03-01Merge pull request #6627 from jon-turney/cwd-relative-file-locationsJussi Pakkanen1-4/+12
Consistently report file locations relative to cwd
2020-02-29mlog: fix remaining mypy errors and add to mypy checkDylan Baker1-9/+9
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-28Rename 'subdir' -> 'filename' in location objectsJon Turney1-2/+1
2020-02-28Display filename cwd relative in warning locationJon Turney1-2/+2
Format the filename relative to cwd in a warning location.
2020-02-28Store filename in node locationJon Turney1-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).
2020-02-28Fix typos in comments about type annotationsJon Turney1-2/+2
2020-02-28Remove unused MesonException.get_msg_with_context()Jon Turney1-1/+10
After that, the only remaining user of get_error_location_string() is mlog, so move that there.
2020-02-26summary: Add more info in Subprojects sectionXavier Claessens1-0/+4
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-16Split console colourization into a separate functionNirbheek Chauhan1-7/+9
Use it instead of making a direct call to mlog._windows_ansi().
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger1-39/+28
2019-12-13mlog: Add a log_once functionDylan Baker1-10/+38
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-13mlog: remove incorrect uses of global keywordDylan Baker1-2/+0
global is only needed to allow replacement of global values, they're always in scope to read.
2019-12-05lgtm: Fix Module imported with `import` and `import from`Daniel Mensinger1-3/+2
2019-11-19ci: Add CI command to include text files in the CI logDaniel Mensinger1-0/+10