aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
AgeCommit message (Collapse)AuthorFilesLines
2022-11-12Add CMake to cross file.Jussi Pakkanen1-4/+30
Original patch by Helmut Grohne. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023744
2022-11-12Fix ppc64 detection in Debian.Jussi Pakkanen1-1/+3
Original patch by Helmut Grohne. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023744
2022-11-03depfixer: handle darwin dependencies with non-ASCII pathsEli Schwartz1-4/+4
I assume there's no real reason this cannot happen, perhaps if the meson source directory has one. So we should use Popen_safe for safety reasons.
2022-10-24Add yasm as fallback for nasm languageXavier Claessens1-0/+22
2022-10-03pylint: enable unspecified-encodingDylan Baker1-1/+1
2022-09-28Move classes used by scripts to their own moduleXavier Claessens2-3/+14
Those classes are used by wrapper scripts and we should not have to import the rest of mesonlib, build.py, and all their dependencies for that. This renames mesonlib/ directory to utils/ and add a mesonlib.py module that imports everything from utils/ to not have to change `import mesonlib` everywhere. It allows to import utils.core without importing the rest of mesonlib.
2022-09-22pylint: enable global-statementDylan Baker3-5/+2
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-22pylint: enable global-variable-not-assignedDylan Baker1-1/+0
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-21Fix cmd_or_ps.ps1 script with pwsh7Xavier Claessens1-12/+7
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-19pylint: enable use-maxsplit-argDylan Baker1-1/+1
This finds a bunch of places where we can do more efficient string splitting.
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]`