aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
AgeCommit message (Collapse)AuthorFilesLines
2022-09-01env2mfile: reuse logical lists of interesting facts from meson itselfEli Schwartz1-45/+12
Meson internally knows about many languages and tools, and *FLAGS variables, and which languages to use them for. Instead of duplicating this logic, import it from mesonbuild.* This logic was originally standalone, but now that it is merged into the Meson tree we can have a single source of truth.
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge2-2/+1
2022-07-25ninja depscanner: handle C++ sources named capital CEli Schwartz1-1/+3
In commit 4ca9a16288f51cce99624a2ef595d879acdc02d8 we added unreliable support (it warns you if you try it) for gcc-compatible treatment of uppercase-C files being C++ instead of C. In order to handle it correctly, we needed to evaluate can-compile by special-casing "C" to avoid lowercasing it for comparisons. This didn't cover all cases where we check if "C" is a C++ language file. We also straight-up check the language of a file (rather than working backwards to see if a C++ compiler can compile it) when doing module scanning, and this needs to special-case "C" as well. We also had one case where we only checked lowercase fortran extensions, but not lowercase C++ extensions. While we are at it, use lowercase for C++ as well, except the "C" special case. Fixes #10629
2022-07-16Ignore encoding errors when scanning. Closes #10571.Jussi Pakkanen1-2/+2
In Fortran and C++ all the bits we care about are in ASCII. 8-bit characters can only occur in comments and string literals and we don't parse those.
2022-06-26Fix destdir_joinAkihiko Odaki1-3/+3
The old implementation assumed a path is of Windows iff the second character is a colon. However, that is not always true. First, a colon can be included in a non-Windows path. For example, it is totally fine to have a directory named ':' on Linux 5.17.0 tmpfs. Second, a Windows path may start with \\ for UNC or extended length. Use pathlib to handle all of these cases.
2022-06-17always run external projects multi-threaded if possibleStaz M1-4/+3
The check for if the project supports the -j flag was needlessly complex. We support two types of project: - waf, always supports -j - make, if GNU, supports -j We never checked waf, and the make check assumed that the entire command, rather than just the last component, was "make". It also neglects "gmake". Since any possible build command *may* support -j, always run the --version check. Detect either build command in the output.
2022-06-17always set DESTDIR via the environment for external projectsStaz M1-4/+1
It doesn't matter whether it is make or not, because make, too, supports setting it via the env. This reduces the use of special cases in the code.
2022-06-17Improve WINEPATH reductionXavier Claessens1-1/+2
- Remove duplicated code in mdevenv.py - Change the limit to 1024 instead of 2048 which is what has been tested. - Skip shortening if it is already short enough. - Skip shortening with wine >= 6.4 which does not seems to have that limitation any more. - Downgrade exception to warning in the case WINEPATH cannot be shortened under 1024 chars, it is possible that it will still work.
2022-06-14devenv: Add support for PowerShell 7 on WindowsSeungha Yang1-1/+1
Checks "pwsh.exe" in addition to "powershell.exe" and "cmd.exe" to support PowerShell 7 on Windows. The Powershell 7 support was added in GStreamer (which is the origin of this script) already via https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2545
2022-06-13flake8: fix various whitespace nitsEli Schwartz1-4/+4
2022-06-10treewide: various cleanups to move imports for mypy into typechecking blocksEli Schwartz1-24/+26
Along the way, add __future__ annotations where lacking.
2022-05-29gettext: explicitly pass source root / subdir as cli argsEli Schwartz1-8/+7
Because this is a wrapper script and we could/should do this, we even have half the infra for it.
2022-05-06coverage: be clever and detect config files for gcovr/lcovEli Schwartz1-13/+28
gcovr will read this file anyway, but if it exists we don't need to assume that the project wishes to exclude subprojects/ -- they can determine that themselves. Fixes #3287 Closes #9761 lcov doesn't read the config file by default, but we can do the smart thing here. Fixes #4628
2022-04-23Fix typo that breaks g++ cross detection on Debian.Jussi Pakkanen1-1/+1
2022-04-21gtkdochelper.py: Use os.pathsep for --path argumentChun-wei Fan1-1/+1
This way, we can ensure that gtk-doc parses the --path argument correctly when passed in from the cmd.exe console, since ':' is normally used to denote that a drive is being used on local paths.
2022-04-20Add NetBSD support in symbolextractor.Thomas Klausner1-0/+2
Choose FreeBSD backend (OpenBSD backend would also work).
2022-04-14simplify destdir_join for readabilityEli Schwartz1-3/+3
We can immediately short-circuit if there is no destdir, as we simply return the prefix unchanged. If there is some kind of destdir and the prefix contains a drive letter, then no matter what we need to remove the drive letter before joining. Technically, if the destdir is a relative path e.g. `destdir\` and `C:\prefix`, we should still install to `destdir\prefix` without the drive letter. But... we also guarantee that destdir is an absolute path (or empty) anyway. And even if we didn't, non-absolute destdir is a broken concept for a variety of complicated reasons. So none of this matters in practice. One way or another, we don't need to actually check whether destdir is an absolute path before cutting off the prefix drive letter.
2022-04-14pyupgrade --py37-plusEli Schwartz1-2/+2
Some more old style code crept in again. Additionally, pyupgrade learned to catch more if/elsed code based on the python version, and delete it.
2022-03-29move a bunch of imports into TYPE_CHECKING blocksEli Schwartz2-7/+14
These are only used for type checking, so don't bother importing them at runtime. Generally add future annotations at the same time, to make sure that existing uses of these imports don't need to be quoted.
2022-03-13Merge pull request #9339 from dcbaker/submit/structured_sourcesJussi Pakkanen1-0/+18
Structured Sources
2022-03-09Add new env2mfile command.Jussi Pakkanen1-0/+368
2022-03-08Revert "Add new env2cross command."Eli Schwartz1-368/+0
This reverts commit e257a870fe5e676c55a2282b0e7fc9be34bba2ac. The PR adding this command had infinitely hanging CI, and now that it is merged to master we cannot get any CI on any PR to succeed.
2022-03-08Add new env2cross command.Jussi Pakkanen1-0/+368
2022-03-07scripts: Add a script to copy files.Dylan Baker1-0/+18
2022-03-06scripts: accept the path of the gettext commands to run as an argumentEli Schwartz3-11/+18
Don't assume itstool, msgfmt et al. are just magically on the path. Normally for commands being processed in build.ninja we'd look up the program in order to run it. Offer the same guarantee for programs being passed through an awkward script wrapper.
2022-01-22Merge pull request #9742 from ximion/wip/itstoolJussi Pakkanen1-0/+82
i18n: Add support for joining XML localization via itstool
2022-01-21i18n: Add support for joining XML localization via itstoolMatthias Klumpp1-0/+82
2022-01-02modules/gnome: replace yelphelper with run and custom targetsPablo Correa Gómez1-133/+0
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
2021-12-05rename exe_runner to exe_wrapper everywhereEli Schwartz1-6/+6
I don't understand the purpose of this confusing API naming split.
2021-11-14Share common code between clang tidy and formatXavier Claessens3-89/+84
2021-11-09depfixer: always print the file name in messagesZbigniew Jędrzejewski-Szmek1-6/+6
The messages are not useful unless we know what file they are about.
2021-11-09depfixer: convert unused printing code to debugging functionsZbigniew Jędrzejewski-Szmek1-31/+23
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-09depfixer: f-stringsZbigniew Jędrzejewski-Szmek1-3/+3
2021-11-01coverage generator: obey the documentation and only generate supported outputsEli Schwartz1-6/+6
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-10-27fix various flake8 whitespace errorsEli Schwartz2-2/+2
2021-10-10Fix typos discovered by codespellChristian Clauss2-2/+2
2021-10-10clangformat: Only format files tracked by git by defaultXavier Claessens1-4/+12
2021-10-04fix extra whitespaceEli Schwartz1-1/+0
discovered via flake8 --select E303
2021-10-04various python neatness cleanupsEli Schwartz3-3/+3
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-09-24scripts/meson_exe: narrow type annotationDylan Baker1-1/+1
Not just a `dict`, but a `dict[str, str]`
2021-09-24scripts/meson_exe: close fd if we open itDylan Baker1-0/+3
2021-09-14unused variable -- open() does not need "as f"Eli Schwartz1-1/+1
2021-08-31pylint: turn on superflous-parensDylan Baker3-6/+6
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-20external-project: Add support for WAF build systemXavier Claessens1-11/+21
Fixes: #7638
2021-08-18backends/ninja: write depscan input files to jsonDylan Baker1-4/+6
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-09i18n: use real build/install targets for gmo filesEli Schwartz1-32/+0
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-04Escape path in exclude filter passed to gcovrAlois Wohlschlager1-5/+5
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-07-23Add support for gcovr --sonarqube reportWeston Schmidt1-0/+14
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-05use modern set syntaxEli Schwartz1-1/+1
In one place, we reintroduced old set syntax after having initially cleaned it up everywhere via commit 4340bf34faca7eed8076ba4c388fbe15355f2183
2021-06-29Add feed arg to custom_target()Simon Ser1-3/+8