Commit Graph

390 Commits

Author SHA1 Message Date
Jussi Pakkanen 4316b71017
Merge pull request #9742 from ximion/wip/itstool
i18n: Add support for joining XML localization via itstool
2022-01-22 01:01:29 +02:00
Matthias Klumpp 02fb0c3f8b i18n: Add support for joining XML localization via itstool 2022-01-21 22:26:17 +01:00
Pablo Correa Gómez 26c1869a14
modules/gnome: replace yelphelper with run and custom targets
This is basically a rewrite of the gnome.yelp target to remove the
ad-hoc script, which generates multiple issues, including meson
not knowing which files were installed.

Closes #7653
Closes #9539
Closes #6916
Closes #2775
Closes #7034
Closes #1052

Related #9105
Related #1601
2022-01-02 00:34:53 -05:00
Eli Schwartz 5b7d4f8bd3
rename exe_runner to exe_wrapper everywhere
I don't understand the purpose of this confusing API naming split.
2021-12-05 11:39:20 -05:00
Xavier Claessens 364d951b34 Share common code between clang tidy and format 2021-11-14 22:07:17 +02:00
Zbigniew Jędrzejewski-Szmek 7a5eb6f9aa depfixer: always print the file name in messages
The messages are not useful unless we know what file they are about.
2021-11-09 10:50:59 +01:00
Zbigniew Jędrzejewski-Szmek c2f1d91b8a depfixer: convert unused printing code to debugging functions
When installing with 'meson install --quiet' I'd get the following output:
This file does not have an rpath.
This file does not have a runpath.

(It turns out that of the couple hundred of binaries that are installed,
this message was generated for /usr/lib/systemd/boot/efi/linuxx64.elf.stub.)

There doesn't seem to be any good reason for this output by default. But those
functions can still be used for debugging. Under a debugger, returning the
string is just as useful as printing it, but more flexible. So let's suppress
printing of anything by default, but keep the extractor functions.

The code was somewhat inconsistent wrt. to when .decode() was done. But it
seems that we'll get can expect a decodable text string in all cases, so
just call .decode() everywhere, because it's nicer to print decoded strings.
2021-11-09 10:50:59 +01:00
Zbigniew Jędrzejewski-Szmek da522efc93 depfixer: f-strings 2021-11-09 10:47:21 +01:00
Eli Schwartz 0f0b1f22d2
coverage generator: obey the documentation and only generate supported outputs
We say:

> If version 4.2 or higher of the first is found, targets coverage-text,
> coverage-xml, coverage-sonarqube and coverage-html are generated.

But this is totally untrue. Make it true, by actually checking (and
not generating broken coverage commands when older versions of gcovr are
found).

Fixes #9505
2021-11-01 18:57:14 -04:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Xavier Claessens 32b7cbd4a7 clangformat: Only format files tracked by git by default 2021-10-10 14:13:35 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -04:00
Eli Schwartz e8a85fa8a2
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only"

and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted

Also catch a few creeping cases of new code added using older styles.
2021-10-04 16:29:30 -04:00
Dylan Baker e4f4b76ddb scripts/meson_exe: narrow type annotation
Not just a `dict`, but a `dict[str, str]`
2021-09-24 09:44:40 -07:00
Dylan Baker 0a5e96aafe scripts/meson_exe: close fd if we open it 2021-09-24 09:44:40 -07:00
Eli Schwartz 6c23b4c6fc
unused variable -- open() does not need "as f" 2021-09-14 15:50:29 -04:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
2021-08-31 16:28:54 -04:00
Xavier Claessens 12e5bfbc1c external-project: Add support for WAF build system
Fixes: #7638
2021-08-20 09:12:20 -04:00
Dylan Baker 035df5369e backends/ninja: write depscan input files to json
Currently, we write each file to the command line, but this can result in
situations where the number of files passed exceeds OS imposed command
line limits. For compilers, we solve this with response files. For
depscan I've chosen to use a JSON list instead. JSON has several
advantages in that it's standardized, there's a built-in python module
for it, and it's familiar. I've also chosen to always use the JSON file
instead of having a heuristic to decide between JSON and not JSON,
while there may be a small performance trade off here, keeping the
implementation simple with only one path is wort it.

Fixes #9129
2021-08-18 11:58:45 -07:00
Eli Schwartz 487d45c1e5
i18n: use real build/install targets for gmo files
Don't just create a .PHONY target which runs a script that magically
generates files ninja doesn't know about. It results in untracked files,
and `meson install` has to run additional commands instead of copying
over files, and then cannot track them to uninstall them later.

I'm not even really sure why it was originally done via a proxy script,
most likely bad legacy design. This is after all one of the oldest
modules...

One side effect of this is that meson doesn't know how to rename
build.CustomTarget files on install (only data files are supported?),
and every file needs to be installed as "domainname.mo" so it must be
named that in-tree too. To prevent clashes, every locale gets its own
locale-specific subdirectory.

Once we are doing that anyway, we can output them to the actual
structure required by the gettext family of functions, and
bindtextdomain() can therefore point to this location if desired. This
might be useful for running localized programs from the build tree.
2021-08-09 18:25:17 -04:00
Alois Wohlschlager 40d5a38d1b Escape path in exclude filter passed to gcovr
Gcovr interprets exclude filters, as passed to the -e option, as
regexes. Since we want to exclude a raw path, the argument must be
escaped.
2021-08-04 20:31:35 +02:00
Weston Schmidt 2e30b5a1e2 Add support for gcovr --sonarqube report
Sonarcloud.io only can read the sonarqube based report that gcovr can
produce.  This change enables support for this output in meson and
ninja.

Signed-off-by: Weston Schmidt <Weston_Schmidt@alumni.purdue.edu>
2021-07-23 22:15:00 +03:00
Eli Schwartz 88bd4e6e10 use modern set syntax
In one place, we reintroduced old set syntax after having initially
cleaned it up everywhere via commit 4340bf34fa
2021-07-05 17:55:04 +03:00
Simon Ser 1f3adc4dbe Add feed arg to custom_target() 2021-06-29 20:54:13 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Jussi Pakkanen 83581f7fc1 Do not delete workdir in case scan-build fails. 2021-06-02 21:23:51 +03:00
Jussi Pakkanen b2687e86c8 Do not accidentally format files when only checking if they are formatted. 2021-05-01 23:34:14 +03:00
Jussi Pakkanen 6f76fce904 Xcode: regenerato project file when build conf changes. 2021-04-19 17:59:40 +03:00
Aleksandr Mezin 692f673312 scripts/meson_exe: fix stdout and stderr decoding
1. use `locale.getpreferredencoding()` to get encoding name.

`bytes.decode()` assumes `encoding='utf-8'` by default. It is incorrect on my
Windows setup, and causes `UnicodeDecodeError`.

2. use `errors='replace'`.

`bytes.decode()` assumes `errors='strict'` by default. Meson shouldn't crash
if subprocess outputs some garbage that can't be decoded.

`surrogateescape` doesn't work as expected on Windows. On Linux, default
`errors` for `sys.stdout` is `strict`, so `surrogateescape` can't be used there
too (at least until `sys.stdout` is reconfigured).

Fixes https://github.com/mesonbuild/meson/issues/8480
2021-03-30 18:47:09 +03:00
Hemmo Nieminen 01c6b50a77 depfixer: temporarily modify file permissions
If the installed files don't have suitable file permissions depfixer
will fail to process it. Temporarily lax file permissions to work around
this.
2021-03-24 17:51:57 +02:00
Xavier Claessens 0638e38bfc clangformat: Add clang-format-check target 2021-03-16 21:01:54 -04:00
Xavier Claessens f558689277 clangformat: Add include and ignore files 2021-03-16 21:01:54 -04:00
Xavier Claessens 598e968993 Add `meson devenv` command and meson.add_devenv() 2021-03-16 09:00:50 -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
Eli Schwartz 76df995ba6
raw string literals are next to godliness
Invalid escape sequences are deprecated and will be removed from a
future version of python. Use r"" to define them so they remain
readable.
2021-03-04 17:09:00 -05:00
Xavier Claessens 522392e755 run_target: Add env kwarg
Re-implement it in backend using the same code path as for
custom_target(). This for example handle setting PATH on Windows when
command is an executable.
2021-02-05 17:53:09 -05:00
Jussi Pakkanen c67e0a8a67
Merge pull request #8264 from xclaesse/ep-misc
external_project: misc improvements
2021-01-30 11:30:16 +00:00
Xavier Claessens 0626465ea8 Fix executable as script on Windows
On Windows this would fail because of missing DLL:
```
mylib = library(...)
exe = executable(..., link_with: mylib)
meson.add_install_script(exe)
```

The reason is on Windows we cannot rely on rpath to find libraries from
build directory, they are searched in $PATH. We already have all that
mechanism in place for custom_target() using ExecutableSerialisation
class, so reuse it for install/dist/postconf scripts too.

This has bonus side effect to also use exe_wrapper for those scripts.

Fixes: #8187
2021-01-30 09:51:06 +00:00
Xavier Claessens 46b68d4c83 external_project: Improve logging
Write output of 'make' and 'make install' into log files as well when
not verbose.
2021-01-29 10:01:36 -05:00
Xavier Claessens 633264984b custom_target: Add env kwarg 2021-01-27 09:00:54 -05:00
Jonas Lundholm Bertelsen bd2394e872 Use case-insensitive suffix check for fortran
In Fortran it is common to use capital F in the suffix (eg. '.F90') if
the source file makes use of preprocessor statements. Such files should
probably be treated like all other fortran files by meson.

Case insensitivity for suffixes was already implemented several places
in meson before this. So most likely, the few places changed here were
oversights anyway.
2021-01-20 18:11:02 +01:00
Jussi Pakkanen 4b3d48a8c9
Merge pull request #8192 from dcbaker/submit/minstall-type-annotations
Add type annotations to minstall (and some related cleanups)
2021-01-14 15:17:49 +00:00
Dylan Baker a4e1be4e5b scripts/depfixer: make rpaths_dirs_to_remove a set
It's only used for doing an `if x in container` check, which will be
faster with a set, and the only caller already has a set, so avoid
we can avoid a type conversion as well.
2021-01-13 13:30:06 -08:00
Antonin Décimo 39ede12aa5 Fix misspells
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-13 12:53:10 -05: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
Jussi Pakkanen 2f836e3acc Extend the C++ module scanner to handle Fortran, too. 2020-12-25 23:28:42 +00:00
Alan Coopersmith d6ef5b2024 depfixer: split new rpath into multiple entries for dedup comparisons
Fixes: #8115

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-12-22 20:21:31 +00:00
Jussi Pakkanen f22d54690b Add mypy annotations. 2020-12-13 16:09:50 +02:00