aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2022-03-01allow dependency checks to bubble up feature warnings to the interpreterEli Schwartz2-0/+8
It would be too difficult and probably a layering violation to give an interpreter handle to the inner guts of every dependency. What we can do instead is let every dependency track: - the Feature checks it can produce, - the version attribute for when it was implemented while leaving the interpreter in charge of actually emitting them.
2022-03-01clean up FeatureCheck signature to move location to use timeEli Schwartz3-17/+15
The point of a .use() function is because we don't always have the information we need to use a feature check, so we allow creating the feature and then storing it for later use. When implementing location checks, although it is optional, actually using it violated that design. Move the location out of the init method for FeatureCheck itself. It remains compatible with all cases of .single_use(), but fix the rest up.
2022-03-01remove useless kwarg that was never usedEli Schwartz1-2/+1
I am not sure why it ever got added. It looks superficially similar to FeatureCheck itself, but doesn't need to.
2022-02-28Allow setting method/separator in environment() and meson.add_devenv()Xavier Claessens5-26/+61
2022-02-28devenv: Do not prepend empty list to PATH and LD_LIBRARY_PATHXavier Claessens1-7/+9
2022-02-28devenv: Add --dump optionXavier Claessens2-11/+28
It prints all envorinmente variables that have been modified. Can be used by shell scripts that wish to setup their environment themself.
2022-02-28devenv: Setup GDB auto-load scriptsXavier Claessens1-2/+50
When the project instals GDB helper scripts, copy them into meson-private directory with the right tree layout and write a .gdbinit script to load them automatically.
2022-02-28devenv: Source bash completion scriptsXavier Claessens2-15/+39
2022-02-28devenv: Set PYTHONPATH where we install python modulesXavier Claessens1-6/+44
2022-02-28Add API for modules that wants to define their devenvXavier Claessens3-2/+15
2022-02-28modules: Make ExtensionModule inherit from NewExtensionModuleXavier Claessens1-22/+7
It reduces duplicated code.
2022-02-28backends: Cache creation of install dataXavier Claessens1-0/+1
It is created twice for ninja and for introspection.
2022-02-28Cache the result of python.find_installation()Xavier Claessens1-29/+34
This avoids running sanity checks everytime find_installation() is called.
2022-02-28Add missing install_tag kwarg to install_emptydir()Christian Wendt1-2/+3
2022-02-28Change jar() default install dirTristan Partin2-0/+7
The previous install dir seemed incorrect when looking at various Linux distributions.
2022-02-27wraptool: report name of wrap in status message for "not in wrapdb"Eli Schwartz1-1/+1
2022-02-27wraptool: be forgiving of local wrap filesEli Schwartz1-9/+22
Do not traceback when trying to update a wrap that isn't a [wrap-file], just report the problem. Do not traceback on perfectly valid WrapDB wraps that don't have a patch_url because they have upstream meson.build, instead try to parse the version from the source tarball filename.
2022-02-27sourceset module: fix minor regression in making sourcesets immutableEli Schwartz1-1/+1
In commit c0be7e05b070d85b38c79088df882970a5cd0279 the setting of merged sourcesets as immutable in a loop accidentally got dedented, and only applied to the last loop iteration.
2022-02-27Merge pull request #10004 from bonzini/mtest-tap-stderrJussi Pakkanen1-8/+9
mtest: print stderr of TAP/Rust tests in verbose/non-parallel mode
2022-02-27modules/wayland: Add unstable_wayland moduleMark Bolhuis2-2/+124
2022-02-27cmake: configure_package_config_file can now take a dictAndrea Pappacoda1-2/+5
2022-02-27cmake: typed_kwargs for configure_package_config_fileAndrea Pappacoda1-24/+26
2022-02-23run_mypy: add sourceset moduleDylan Baker1-3/+3
2022-02-23modules/sourceset: Fix remaining typing issuesDylan Baker1-30/+45
2022-02-23mesonlib: allow check_dirent_issues to take an iterableDylan Baker1-2/+2
There's no reason it needs a concrete list, any iterable is fine. This does mean that we need to explicitly check for `str | bytes` in the listify pass, as `str` and `bytes` are both iterable.
2022-02-23modules/sourceset: use typed_kwargs for all functionsDylan Baker1-45/+97
removing permittedKwargs usage
2022-02-23modules/sourceset: Use typed_pos_argsDylan Baker1-13/+27
2022-02-23modules/sourceset: add a few super easy type annotationsDylan Baker1-13/+20
2022-02-23modules/sourceset: sort importsDylan Baker1-3/+4
2022-02-22python module: add option to specify a python environment to install toEli Schwartz2-0/+23
The default behavior of installing relative to prefix may be unexpected, and is definitely wrong in many cases. Give users control in order to specify that yes, they actually want to install to a venv. This is particularly useful for projects that use meson as a build system for a python module, where *all* files shall be installed into the python site-packages.
2022-02-22modules: add ModuleState API to check whether an option was user-specifiedEli Schwartz1-0/+7
Needed to check exclusivity of module options.
2022-02-20mtest: refactor common condition into a property of TestRunPaolo Bonzini1-6/+8
For a test to be displayed to stdout without buffering, it has to be 1) in verbose mode 2) not executed in parallel with others 3) not parsed, i.e. not TAP or Rust. Include these three conditions in a new property of stdout and use it in the three places where it matters: when printing the initial and final delimiters of the output, and when deciding the console mode to use. Suggested-by: Jussi Pakkanen <jpakkane@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-20devenv: support bash under MSYS2 by defaultChristoph Reiter1-4/+6
Currently it tries to run "cmd" by default in a MSYS2 bash. Passing "bash" doesn't work since that defaults to WSL and one has to pass an absolute path to bash instead, and even then one misses out on the PS1 override. In case $SHELL is set and the contained path exists prefer it even if we are on Windows. To make the PS1 override work we can't use Unix paths in Python since we might be on Windows, so move the .bashrc check into the temporary bash script itself. This makes "meson devenv" work the same under MSYS2 as on Linux.
2022-02-20mtest: raise informative error message when test program doesn't existEli Schwartz1-2/+5
If --no-rebuild is used, the test program might not exist, spawning a FileNotFoundError inside a long traceback rooted in subprocess.Popen trying to run that test program. Current versions of Meson even say it's an "unhandled python exception". But we can do one better and actually tell the user what is wrong, why, and what to do to fix it. And we can do so before getting waist deep in partially running tests. Fixes #10006
2022-02-20mtest: print stderr of TAP/Rust tests in verbose/non-parallel modePaolo Bonzini1-3/+2
Verbose, non-parallel tests generally print their output as they run, rather than after they finish. This however is not the case if stdout of the test is parsed as is the case for TAP and Rust tests. In this case, the output during the run is the list of the subtests, but stderr still has to be printed after the test finishes.
2022-02-17intl dependency: include header when checking for libc builtinEli Schwartz1-1/+2
This header is required anyway. And the compile test for linking to libc with the gettext symbol, can succeed when we try to use the literal symbol name without includes, but fail later during project build, because actually including libintl.h might redefine the function to match a forked symbol. This happens when GNU libintl is installed as a standalone library on systems that have a less fully-featured gettext implementation. So, by including the header in has_function, we can ensure that we test against the default resolved header. In the event that the symbol which is #define'd by the header is 'libintl_gettext', linking will fail against libc even when a builtin gettext does exist, and we will fall back to the intl dependency that provides -lintl (and which is needed to properly use the default header). Of course, even that probably won't work. has_function(prefix: '...') is useless to check the difference between builtins and external library functions. It has code to detect "builtins" that misfires in some cases (previously seen with iconv_open). Instead compile an open-coded test file that this intl dependency implementation fully controls, that doesn't get up to imaginative edge cases like trying to find `__builtin_gettext`. It's the only way to be sure. Fixes compiling against the intl dependency on e.g. Alpine Linux when the libintl package is installed.
2022-02-16flake8: fix various whitespace errors with badly aligned codeEli Schwartz8-27/+28
2022-02-16flake8: do not use bare exceptionsEli Schwartz2-2/+2
In one case, we actually specifically want to catch IndexError only. In the other case, excepting Exception rather than BaseException is quite fine.
2022-02-16fix malformed warning to print the way it was meant to printEli Schwartz1-9/+5
Given a meson.build with the contents: ``` t = ' ' ``` We want to warn that this is bad. So we emitted this warning: ``` WARNING: Newline character in a string detected, use ''' (three single quotes) for multiline strings instead. This will become a hard error in a future Meson release. t = ' 4 4 ``` The line contents and the offset are printed as gibberish after a big whitespace run. These are elsewhere often passed to ParseException, which pretty-prints this, but newlines aren't an exception, merely a warning, and mlog.warning doesn't accept numeric strings as anything more meaningful than something to print as text. Fix this (by wrapping it in a ParseException) to properly print: ``` meson.build:4: WARNING: Newline character in a string detected, use ''' (three single quotes) for multiline strings instead. This will become a hard error in a future Meson release. t = ' ^ ```
2022-02-16fix a couple misuses of textwrap.dedentEli Schwartz2-4/+4
A backslash-escape of the last newline before a run of whitespace leading to the indented string ending and function termination `)` does not actually escape the entire line and make it do nothing. In fact what it does is cause all that whitespace to be part of the preceding line, and get printed. Meanwhile the textwrap.dedent documentation states that lines with only whitespace get normalized. When you *don't* mess with that final line, dedent actually does the right thing and makes the output message end with a single newline after the important text.
2022-02-16fix missing f-string preventing variable formattingEli Schwartz1-1/+1
Detected by flake8 which reported that `e` was an unused variable.
2022-02-16flake8: remove some redundant separatorsEli Schwartz3-3/+3
2022-02-16flake8: fix wrong numbers of blank line separatorsEli Schwartz4-2/+4
2022-02-16flake8: fix typoed whitespace surrounding tokensEli Schwartz4-5/+5
2022-02-16flake8: use plain strings instead of f-strings when no variables usedEli Schwartz2-2/+2
2022-02-15fine-tune the logic for reporting context on tracebacksEli Schwartz1-11/+13
Do not report a MesonBugException if the command is `runpython`, because that is 100% other people's code, not ours. It's only used as an alternative to sys.executable for reporting a path to python, in the event of a Windows MSI install. While we are at it, refactor the logic for PermissionError to be a bit more unified (and sadly use isinstance instead of except, but it is what it is).
2022-02-15pkgconfig module: allow custom variables to reference builtin directoriesEli Schwartz1-11/+46
Automatically generate additional variables and write them into the generated pkg-config file. This means projects no longer need to manually define the ones they use, which is annoying for dataonly usages (it used to forbid setting the base library-relevant "reserved" ones, and now allows it only for dataonly. But it's bloat to manualy list them anyway). It also fixes a regression in commit 248e6cf4736ef9ec636228da66c28f9be03aa74f which caused libdir to not be set, and to be unsettable, if the pkg-config file has no libraries but uses the ${libdir} expansion in a custom variable. This could be considered likely a case for dataonly, but it's not guaranteed.
2022-02-14shared module: Allow linking on AndroidNirbheek Chauhan2-4/+9
Android requires shared modules that use symbols from other shared modules to be linked before they can be dlopen()ed in the correct order. Not doing so leads to a missing symbol error: https://github.com/android/ndk/issues/201 We need to always allow linking for this. Also add a soname, although it's not confirmed that it's needed, and it doesn't really hurt if it isn't needed.
2022-02-14comment out broken Feature checks that fail mypyEli Schwartz1-3/+10
We currently cannot make this work because inside dependency() we don't know the current subproject. We would also like the optional but extremely useful location node, but we don't have that either... Convert the broken code to a FIXME for visibility.
2022-02-14FeatureNew: add mypy type annotations for subproject argEli Schwartz9-12/+28
Use a derived type when passing `subproject` around, so that mypy knows it's actually a SubProject, not a str. This means that passing anything other than a handle to the interpreter state's subproject attribute becomes a type violation, specifically when the order of the *four* different str arguments is typoed.