Commit Graph

12134 Commits

Author SHA1 Message Date
Daniel Mensinger 99aae9b4df
cmake: Move generator expression evaluation to the end of the traceparser 2022-01-23 13:22:47 +01:00
andy5995 baff6bccac Subprojects.md:add link to is_subproject() 2022-01-23 01:40:23 -05:00
Eli Schwartz 603244b059
fix broken version annotations for the new itstool_join feature
It was not added in 0.61.0 as that was already released.
2022-01-22 22:11:32 -05:00
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
Eli Schwartz 2a99252604
python module: only find a pkg-config dependency from the found python
If the found python returns None from sysconfig.get_config_var('LIBPC')
then we cannot (and don't) set PKG_CONFIG_LIBDIR from it. In fact, we
can virtually guarantee we won't find a PkgConfigDependency either,
because any python that doesn't have a LIBPC is presumably not installed
to the system pkg-config directory (maybe it's an isolated relocatable
install, maybe it just doesn't have pkg-config support for who knows
what reason).

Trying to find one anyway using pkg-config's builtin search paths can
unexpectedly succeed, though, by finding a completely unrelated python
installation installed to a system location, which isn't the one we are
actually building for.

Instead, return early so that we use the system dependency class
fallback.

While we are at it, add back the debug messages from #3989 which got
removed.
2022-01-20 23:50:04 -05:00
Dylan Baker acef5a9762 modules/gnome: make some methods static
Since they don't use the instance or class state, they should be static
methods.
2022-01-18 21:58:24 -05:00
Dylan Baker 9b04257847 run_mypy: add gnome module 2022-01-18 21:58:24 -05:00
Dylan Baker d96bc73b99 modules/gnome: fix remaining typing errors
Which is one incorrect type annotation, and a couple of instances of
concatenating lists of unlike types. List being invariant is super
annoying.
2022-01-18 21:58:24 -05:00
Dylan Baker 99c835b2b9 modules/gnome: fix annotation to type that isn't defined 2022-01-18 21:58:24 -05:00
Dylan Baker 26722f8e44 modules/gnome: fix _get_build_args type annotations 2022-01-18 21:58:24 -05:00
Dylan Baker 0dd720a014 modules/gnome: fix _make_typelib_target types 2022-01-18 21:58:24 -05:00
Dylan Baker 68e684d51f modules/gnome: Fix typing with _get_dependencies_flags and
_get_gir_target_deps

The typing issues with these are tightly intertwined, so it didn't
really make sense to solve them independently
2022-01-18 21:58:24 -05:00
Dylan Baker 214ce0dc8b build: Fix return types of a couple of methods
These don't return `Target`, they return `BuildTarget | CustomTarget |
CustomTargetIndex`
2022-01-18 21:58:24 -05:00
Dylan Baker a848dd3cce modules/gnome: fix issues with _make_gir_target 2022-01-18 21:58:24 -05:00
Dylan Baker fcf78ceb7b modules/gnome: fix declared type of list 2022-01-18 21:58:24 -05:00
Dylan Baker f85629e374 modules/gnome: use T.Sequence instead of T.List
Which is pretty much necessary to make anything involving unions of
lists work
2022-01-18 21:58:24 -05:00
Dylan Baker cd6e2c85a7 modules/gnome: use itertools.chain instead of list concatenation
This is better as it avoids building unnecessary lists, and two fixes
the typing issue from concatenating lists of different types.
2022-01-18 21:58:24 -05:00
Dylan Baker 216435b2ae dependencies: fix libraries and whole_libraries types
gnome points out that CustomTargets can be linked with, so we should
allow that.
2022-01-18 21:58:24 -05:00
Dylan Baker 41fe51b36e modules/gnome: ignore the return type of _get_dep
This is hard to fix, and it's really doing something bad anyway. But we
know it's right, so just tell mypy to not worry about it.
2022-01-18 21:58:24 -05:00
Dylan Baker 4048c71d6d modules/gnome: fix type annotations and issues with _gather_typelib_includes_and_update_depends
There is the problem of the annotations themselves, then there is
the problem with depends being mutated. The mutation side effect is a
problem in itself, but there's also the problem that we really want to
use Sequence, which isn't mutable.
2022-01-18 21:58:24 -05:00
Dylan Baker dacba7a83d modules/gnome: define and annotate all instance variables in the initializer 2022-01-18 21:58:24 -05:00
Dylan Baker ce5f56f266 build: Fix annotations to RunTarget and AliasTarget
RunTargets and AliasTargets may depend on RunTargets, so annotate them
that way. The Gnome module relies on this internally.
2022-01-18 21:58:24 -05:00
Dylan Baker 9c7ddf59fe interpreterobjects: deprecated passing a number to configuration_data.set10
This is currently allowed, and is used in at least a few projects. It
was not intended to work or documented, but it does and since it is in
use a full deprecation period must be used. A warning has also been
added for values < 0, which have surprising behavior.
2022-01-18 17:53:29 -05:00
Dylan Baker bf3fa728fa interpreterobjects: remove no-flattening from configuraiton_data.get
It's no longer required because we don't allow arrays as fallbacks
anymore.
2022-01-18 17:53:29 -05:00
Dylan Baker f16956a951 interpreterobjects: don't allow keyword arguments in configuration_data.keys
Which do nothing, and shouldn't be allowed.
2022-01-18 17:53:29 -05:00
Dylan Baker 5074e2d3b5 interpreter: replace ConfigurationDataObject with ConfigurationDataHolder
This is much cleaner, and more in line with the way we handle
interpreter objects in modern meson practice
2022-01-18 17:53:29 -05:00
Dylan Baker 23af9e4c1a build: move configuration_data initial value handling to build.ConfigurationData
It really belongs here, not in the interpreter
2022-01-18 17:53:29 -05:00
Dylan Baker 5c979eb21f interpreterobjects: clean up ConfigurationData initializer 2022-01-18 17:53:29 -05:00
Dylan Baker 574525673f interpreterobjects: use typed_* for configuration_data.set*
This removes the ability to use ConfigurationData as a dict, but
restricting the inputs to `str | int | bool`. This may be a little too
soon for this, and we may want to wait on that part, it's only bee 8
months since we started warning about this.
2022-01-18 17:53:29 -05:00
Dylan Baker 7641bfd0ce interpreterobjects: use typed_* with configuration_data.merge_from 2022-01-18 17:53:29 -05:00
Dylan Baker f7cbe89a13 interpreterobjects: use typed_* with configuration_data.get_unquoted 2022-01-18 17:53:29 -05:00
Dylan Baker baa9ecb1c4 interpreterobjects: use typed_args for configuration_data.get 2022-01-18 17:53:29 -05:00
Dylan Baker 65558445ae interpreterobjects: use typed_pos_args and noKwargs for configuration.data.has 2022-01-18 17:53:29 -05:00
Dylan Baker 1ff2abcd9c interpreterobjects: use typed_kwargs for dependency.get_variable 2022-01-18 17:53:29 -05:00
Dylan Baker 1751dc4701 interpreterobjects: use typed_kwargs for dependency.get_pkgconfig_variable 2022-01-18 17:53:29 -05:00
Dylan Baker 6b272973e0 dependencies: don't pass kwargs from get_pkgconfig_variable
This is a layering violation, we're relying on the way the interpreter
handles keyword arguments. Instead, pass them as free variables,
destructuring in the interpreter
2022-01-18 17:53:29 -05:00
Dylan Baker ab9c0c1735 interpreterobjects: use typed_kwargs for FeatureOption.require 2022-01-18 17:53:29 -05:00
Dylan Baker 55055c3e0e interpreterobjects: use typed_pos_args for FeatureOpotion 2022-01-18 17:53:29 -05:00
Dylan Baker 6ad772cb37 interpreterobjects: use typed_pos_args for dependency.as_system_method 2022-01-18 17:53:29 -05:00
Dylan Baker 7537ec3299 interpreterobjects: use typed_pos_args for dependency.get_configtool_variable 2022-01-18 17:53:29 -05:00
Dylan Baker 0fa3436645 interpreterobjects: use typed_pos_args for dependency.get_pkgconfig_variable 2022-01-18 17:53:29 -05:00
Dylan Baker 482ab09a95 interpreterobjects: consistently use dependency. for error messages
We currently use a mixture of dependency, Dependency, and dep
2022-01-18 17:53:29 -05:00
Eli Schwartz 4b9ec4f6d5 wraps: implement exponential backoff for downloading files
Implementation modeled after mesonlib.windows_proof_rmtree().

Implements the other half of #9688
2022-01-18 16:47:05 +02:00
Eli Schwartz 7deeb293b6 wraps: on failure to apply a patch, delete the subproject directory
This code path is only called on initial download of a subproject, but
if we raise an error and abort while downloading/applying a patch
overlay we still have the upstream sources extracted... which appears to
be a subproject, then turns out to be broken due to missing meson.build

Partially implements #9688
2022-01-18 16:47:05 +02:00
andy5995 5c7f3b5bb8 index.md:add link to GitHub Discussions section 2022-01-17 09:21:03 -05:00
Nirbheek Chauhan faf79f4539 Add a test for the --vsenv meson setup option
The tests and the unittests both unconditionally call setup_vsenv()
because all tests are run using the backend commands directly: ninja,
msbuild, etc.

There's no way to undo this vs env setup, so the only way to test that
--vsenv works is by:

1. Removing all paths in PATH that provide ninja
2. Changing setup_vsenv(force=True) to forcibly set-up a new vsenv
   when MESON_FORCE_VSENV_FOR_UNITTEST is set
3. Mock-patching build_command, test_command, install_command to use
   `meson` instead of `ninja`
4. Asserting that 'Activating VS' is in the output for all commands
5. Ensure that compilation works because ninja is picked up from the
   vs env.

I manually checked that this test actually does fail when the previous
commit is reverted.
2022-01-16 23:42:19 +05:30
Nirbheek Chauhan 1cda222a1a install: Setup VS env if we did that during setup
Otherwise we might not find a ninja that was picked up from the Visual
Studio installation.

```
$ meson setup _build
...
Activating VS 15.9.40
...
Found ninja-1.8.2 at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.EXE"
$ meson compile -C _build
Activating VS 15.9.40
...
$ meson install -C _build
Can't find ninja, can't rebuild test.
```

Fixes https://github.com/mesonbuild/meson/issues/9774
2022-01-16 23:42:19 +05:30
Andy Alt d9dee508ae Subprojects.md:add single quotes around subproject and variable name 2022-01-16 02:04:37 +05:30
Eli Schwartz 96d0005744 gnome.genmarshal: restore the ability to pass sources as Files objects
It used to support:
- a single string
- an array of anything

And as long as CustomTarget supported it too, everything worked fine.
So, a `files('foo')` worked but a `files('foo')[0]` did not, which is
silly... and it's not exactly terrible to use files() here, the input is
literally a list of source files.

Fixes building gnome-terminal
Fixes #9827

Test updated by Nirbheek Chauhan <nirbheek@centricular.com>
2022-01-15 23:50:14 +05:30