Commit Graph

13239 Commits

Author SHA1 Message Date
Xavier Claessens b9e382835e wrap: Small simplification 2022-09-28 00:17:42 -04:00
Xavier Claessens b314d1f7c1 wrap: Set self.directory only once
It can wait until after parsing the wrap file to set it.
2022-09-28 00:17:42 -04:00
Xavier Claessens 2a262d2936 Automatically tag systemtap files 2022-09-28 00:13:49 -04:00
Xavier Claessens a010274d4b Automaticall tag installed tests
It is common, at least in GNOME projects, to install tests. Files goes
into various locations, including:
- /usr/lib/x86_64-linux-gnu/installed-tests
- /usr/share/installed-tests
- /usr/libexec/installed-tests

It is safe to assume that everything that goes into a "installed-tests"
subdir should be tagged as "tests" by default.
2022-09-28 00:13:49 -04:00
Jan Tojnar c8d5f93cb0 gnome/yelp: fix `xml:lang` attributes
itstool detects a language code from the mo file’s basename,
so when 26c1869a14
changed the file name to be prefixed with project name,
values like “my-project-xx” ended up in the `xml:lang` attribute
of the generated page files, instead of the expected
IETF BCP 47 language tag.

Let’s fix it by passing a locale code to itstool explicitly.
2022-09-27 22:04:45 +03:00
Xavier Claessens 195aae6a84 mconf: Do not print None for empty choices 2022-09-27 11:15:51 -04:00
Xavier Claessens 4fce954f97 mconf: Use pager only when printing configuration
Fixes: #10845
2022-09-27 11:15:51 -04:00
Xavier Claessens e1db50d4d9 compilers: Cleanup a bit languages/suffixes lists
Use set where order does not matter, fix is_source() to really mean only
source suffixes.
2022-09-27 11:15:07 -04:00
Tristan Partin 838367ca60 Fix mypy lint
Unused "type:ignore"
2022-09-27 11:14:19 -04:00
Xavier Claessens fa254229b7 ninjabackend: Fix get_target_generated_sources() return type
Type annotation, documentation string, and implementation were doing 3
different things. Change implementation to match type annotation which
makes the most sense because it match what get_target_sources() does.

All callers only use keys from the returned dictionary any way, but
that's going to change in next commits.
2022-09-26 15:39:06 -04:00
Eli Schwartz 462759dd33
mtest: implement a maxfail option
This allows early exit of the project tests once a certain number of
failures are detected. For example `meson test --maxfail=1` will abort
as soon as a single test fails.

Currently running tests are marked as failed via INTERRUPT.

Resolves #9352
2022-09-23 16:10:32 -04:00
Xavier Claessens bed5b31079 mlog: disable usage of global for log_pager 2022-09-23 11:40:53 -04:00
Christoph Reiter b5710ac4f4 CI: don't set BOOST_ROOT to an empty string
This was initially added in eb76ba7031 to avoid picking
it up from azure/gha images.

Looks like it is no longer set for some time now though:
https://github.com/actions/runner-images/pull/540
so should no longer be needed.

The empty string makes some meson tests fail which expect a path.
A recent msys2-runtime change now lets empty env vars through to child processes
whereas before they would get filtered out, which is why this worked before.
2022-09-23 11:13:11 -04:00
Christoph Reiter efc6e40e2a Revert "CI: Add a temporary workaround for broken MSYS2 Python path separator behaviour"
This reverts commit 3fd2459a74.

The underlying issue has been fixed and deployed:
https://github.com/msys2-contrib/cpython-mingw/pull/107
2022-09-23 11:13:11 -04:00
Dylan Baker f5283dd63f pylint: enable global-statement
This does force a number of uses of `# pylint: disable` comments, but it
also finds a couple of useless global uses and one place (in the
previous commit) that an easy refactor removes the use of global. Global
is a code smell, so forcing adding a comment to disable helps force
developers to really consider if what they're doing is a good idea.
2022-09-22 18:17:43 -04:00
Dylan Baker 3ef332e89a pylint: enable global-variable-not-assigned
The `global` statement is only needed to assign to global variables, not
read or mutate them. So calling `global.mutate()` is fine, but not
`var = foo`, which would otherwise shadow `var`.
2022-09-22 18:17:43 -04:00
Dylan Baker 1917b9253e modules/gnome: make_native_glib_version an instance var
This removes the need for the use of the global statement. I've also
updated the test that overrides this to use mock.patch instead of hand
monkey patching.
2022-09-22 18:17:43 -04:00
Eli Schwartz 30b1774628 compilers: unify fortran sanity check with its parent Clike handling
We *mostly* just need to do the same thing. Plug in one utility method
to make sanity_check_impl find the right compile args, and plug in
DEVNULL to the test run. It's that simple.

This solves a few inconsistencies. The main one is that fortran never
logged the sanity checks to the Meson debug log, making it hard to
debug.

There's also some interesting quirks we built up in the dedicated
fortran handling. For example:

- in commit 5b109c9ad2 we added cwd to
  building the fortran executable, with a wordy comment about how the
  compiler has defects. But the clike base has always done that on
  general principle anyway, so we would never have had that bug in the
  first place.

- in commit d6be7822a0 we added special
  deletion of an old "bad existing exe file" just for fortran. Looking
  at the PR discussion for this odd requirement, it turns out that the
  real problem is mixing WSL and native Windows without deleting the
  build directory. This is apparently fortran specific simply because
  "contemporary Windows 10 Fortran users" switch between the two?

  The actual problem is that this never used .exe as the output name, so
  Windows thinks you want to run something other than the thing you
  asked to run, because it's not even a Window executable. But... the
  common clike handling could have fixed that without needing special
  cases.
2022-09-22 18:15:25 -04:00
Eli Schwartz 332968da1b use simpler subprocess.run interface instead of manual Popen
This code dates back to 2012 and probably has no specific reason...
2022-09-22 18:15:25 -04:00
Eli Schwartz 0d354588ca compilers: make sanity checks log commands using join_args
It is more correct to join commands with a command joiner than a
whitespace joiner.
2022-09-22 18:15:25 -04:00
Eli Schwartz 29ac7dd088
clean up message for OSError errorhandler
Currently it repeats the text of the exception, which appeared
immediately above. And strerror is already part of args, so that was
then doubled. `str(e)` formats this much better anyway.

While we are at it, point out that it is probably a build environment
issue, rather than just saying "this is probably not a meson bug". The
former comes across a bit more as constructive advice rather than just
"idk but it's not our fault".
2022-09-22 15:24:58 -04:00
Eli Schwartz 389b2f6785
fix regression in logging runpython errors
In commit fa044e011d we caught OSError and
started emitting a special error message disclaiming that it probably
isn't Meson's fault, and skipping the generic "This is a meson bug and
should be reported" handler.

But, we no longer did this after verifying that the command *isn't*
runpython, so arbitrary scripts that raised OSError would start saying
stuff about Meson, which was wrong.

Start checking for runpython first.
2022-09-22 15:24:57 -04:00
Eli Schwartz 28103614ef
refactor errorhandler for deduplication of logic
Mostly just move a comment around back to where it's more relevant, and
handle MESON_FORCE_TRACEBACK once instead of twice.
2022-09-22 15:24:56 -04:00
Eli Schwartz d364985365
fix regression in handling errors during reconfigure
In commit 9ed5cfda15 we refactored
startup to be a bit faster and import less. But this had the side effect
of moving out of our errorhandler. Refactor this so it can be easily
used elsewhere.
2022-09-22 15:23:39 -04:00
Christoph Reiter 3fd2459a74 CI: Add a temporary workaround for broken MSYS2 Python path separator behaviour
"MSYSTEM= python ..." no longer works because of some changes in the MSYS2 runtime

Until this is fixed in either MinGW Python or the MSYS2 runtime this should revert
things to the previous behaviour to get the CI green again.
2022-09-22 13:32:12 -04:00
Xavier Claessens f4f8a39060 Add release notes snippet for new mconf behaviour 2022-09-22 11:29:03 -04:00
Xavier Claessens d202697182 mconf: Add --no-pager option 2022-09-22 11:29:03 -04:00
Xavier Claessens b3dc99e6da mconf: Print options with colors 2022-09-22 11:29:03 -04:00
Xavier Claessens 5a98c915c5 mconf: Substract the 3 space separators between columns 2022-09-22 11:29:03 -04:00
Xavier Claessens 5d6368e562 mconf: Do not wrap choices manually
We already use textwrap.wrap() for that and it will correctly split on
spaces.
2022-09-22 11:29:03 -04:00
Xavier Claessens c8b57f1b57 mconf: There is always 4 columns 2022-09-22 11:29:03 -04:00
Xavier Claessens 59d561d4c1 mlog: Add support for pager
It is useful to redirect some outputs, such as "meson configure" to a
pager (e.h. less). This is similar to most git commands.
2022-09-22 11:29:03 -04:00
Xavier Claessens 3111ce6aae mconf: Use mlog.log() instead of print()
This will allow using colors and redirect print into a pager.
2022-09-22 11:29:03 -04:00
Xavier Claessens 31a6633e62 mdevenv: powershell <7.0 is EOL, prefer using pwsh.exe
If neither pwsh.exe nor powershell.exe works, fallback to cmd.exe. This
script could be failing because of virus scanner.
2022-09-21 18:32:51 -04:00
Xavier Claessens bb4c8c07f8 Fix cmd_or_ps.ps1 script with pwsh7
gwmi command does not exist any more and is replaced by Get-CimInstance.
See https://github.com/PowerShell/PowerShell/issues/4766.

While at it, use a do..while loop to avoid duplicated lines.

Fixes: #10820
2022-09-21 18:32:51 -04:00
Vili Väinölä 496dce0666 Fix including headers from another drive on VS backend
Include paths to different drives as absolute paths

fixes #8329
2022-09-20 18:32:36 -04:00
Eli Schwartz eb69fed2f6
python module: allow specifying the pure kwarg in the installation object
Fixes #10523
2022-09-19 21:13:37 -04:00
Dylan Baker b8e53ed5ea pylint: enable use-dict-literal 2022-09-19 20:57:52 -04:00
Dylan Baker 798b6c5624 pylint: enable use-list-literal 2022-09-19 20:57:52 -04:00
Dylan Baker 4da14918cd pylint: enable consider-using-in 2022-09-19 20:57:52 -04:00
Dylan Baker 6f7ea0cc28 pylint: enable use-sequence-for-iteration
This found a couple of places where we *don't* want to use set(), and
want to use list() instead.
2022-09-19 20:57:52 -04:00
Dylan Baker 188c552dcf pylint: enable use-maxsplit-arg
This finds a bunch of places where we can do more efficient string
splitting.
2022-09-19 20:57:52 -04:00
Dylan Baker b11cf2f371 pylint: enable consider-using-dict-items
Which found a couple of places where we could write better code.
2022-09-19 20:57:52 -04:00
Dylan Baker 6d12d7623f pylint: move from allow-list to deny-list
This makes it much easier to see what we're ignoring, as well as
allowing pylint to enforce any lints that currently pass but aren't in
the allow list automatically.
2022-09-19 20:57:52 -04:00
Eli Schwartz edc3e26369
fix odd mypy issue in unreachable code
This used to be fine, until imports were removed from this file. Now a
function annotated as T.NoReturn doesn't actually tell mypy that it
cannot return, though, so we manually do it.
2022-09-19 15:19:01 -04:00
Eli Schwartz 8277a1aba8
simplify type annotation 2022-09-19 15:19:00 -04:00
Eli Schwartz ab20eb5bbc
compilers: avoid importing compilers upfront for detect
We no longer need these upfront at all, since we now import the ones we
need for the language we are detecting, at the time of actual detection.

This avoids importing 28 files, consisting of just under 9,000 lines of
code, at interpreter startup. Now, it is only imported depending on
which languages are invoked by add_languages, which may not even be
anything. And even if we do end up importing a fair chunk of it for
C/C++ projects, spreading the import cost around the interpreter runtime
helps responsiveness.
2022-09-19 15:19:00 -04:00
Eli Schwartz cc5ef6478f
compilers: perform targeted imports for detect
Only import the ones we need for the language we are detecting, once we
actually detect that language.

This will allow finally dropping the main imports of these files in a
followup commit.
2022-09-19 15:19:00 -04:00
Eli Schwartz f6f876481f
compilers: use more direct checks for what kind of compiler we have
Instead of comparing against specific compiler classes, check the
logical compiler id or language etc.

In a couple cases, we seem to be missing a couple things by being a bit
too strict about the exact class type.
2022-09-19 15:19:00 -04:00
Eli Schwartz 775b67c5c1
compilers/detect: rename potentially conflicting name
Preparation for future commit.
2022-09-19 15:19:00 -04:00