Commit Graph

1036 Commits

Author SHA1 Message Date
Eli Schwartz 9daaece785
flake8: fix various whitespace errors with badly aligned code 2022-02-16 23:00:31 -05:00
Eli Schwartz 6240920c21
pkgconfig module: allow custom variables to reference builtin directories
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
248e6cf473 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-15 16:50:41 -05:00
Andrea Pappacoda 316cf3a717 cmake: add arch_independent kwarg
CMake's write_basic_package_version_file has supported since version 3.14
an ARCH_INDEPENDENT option that makes it skip its architecture check in
the Version file.

With this patch Meson now supports it as well, and the change is also
compatible with older CMake versions, as they will simply ignore the
option.

This also slightly changes the contents of the generated Version file
when arch_independent is not set: previously, the if() needed to skip
the arch check was always filled with an empty string, while CMake puts
"FALSE" (or "TRUE") in it. Now, that if() will always be filled with
either "False" or "True", better matching CMake's behaviour.
2022-02-01 23:48:17 -05:00
Andrea Pappacoda a755750cae cmake: typed_kwargs for write_basic_package_version_file 2022-02-01 23:48:17 -05:00
Andrea Pappacoda 248e6cf473 pkgconfig: set libdir only if used
This should address some concerns outlined in
https://github.com/yhirose/cpp-httplib/pull/1182
2022-02-01 12:23:06 -08:00
Dylan Baker 029652ecb5 modules/gnome: remove unnecessary type check
This should have been removed when typed_kwargs was added
2022-01-28 15:53:20 -05:00
Dylan Baker 457fb53ea4 gnome: genmarshal: If the source includes the header, depend on it
Otherwise we're racing between the header generation and the source
generation.
2022-01-28 15:53:20 -05:00
Dylan Baker 11f9638035 build: replace kwargs in CustomTarget initializer
Because we don't want to pass the Interpreter kwargs into the build
layer. This turned out to be a mega commit, as there's really on elegant
way to make this change in an incremental way. On the nice side, mypy
made this change super easy, as nearly all of the calls to
`CustomTarget` are fully type checked!

It also turns out that we're not handling install_tags in custom_target
correctly, since we're not converting the boolean values into Optional
values!
2022-01-28 15:53:20 -05:00
Dylan Baker 5d31735c1e modules/gnome: Allow gdbus_annotations to take an empty list again
This was allows up to 0.61.0 (including with the initial type
annotations), but was accidentally broken by fixes for other bugs in
0.61.1.

Fixes: #9883
2022-01-27 17:22:41 -05:00
Eli Schwartz 3990dc6d64 flake8: fix indentation style 2022-01-27 10:48:01 -08:00
Eli Schwartz cf3a1d31f8 fix some flake8 violations for unused imports
And one undefined T.cast name in a file that isn't yet mypy-ready
anyway.
2022-01-27 10:48:01 -08:00
Eli Schwartz d73e81c77b
Popen_safe and wrappers can accept os.PathLike for cwd
Do not require users to convert it to a string first. This is a waste of
time and effort for exactly the same results.
2022-01-26 22:08:09 -05:00
Bilal Elmoussaoui dd4e712024 gnome: Fix gtk4 pkgconfig name 2022-01-26 21:31:20 -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 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 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 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 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 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
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
Eli Schwartz bda11fe25d gome.gdbus_codegen: fix annotations argument for multiple annotations, harder
The original attempted fix only allowed configuration to succeed, but
not building. It was modeled based on the gdbus-codegen documentation,
which states:

  --annotate WHAT KEY VALUE WHAT KEY VALUE WHAT KEY VALUE
                        Add annotation (may be used several times)

which clearly indicates that gdbus-codegen accepts an --annotate flag
that is followed by a multiple of 3 values, despite this not actually
working.

The manpage actually contradicts the --help text:

   --annotate ELEMENT KEY VALUE
       Used to inject D-Bus annotations into the given XML files. []

... and gives examples that use multiple --annotate flags each with 3
arguments.

To better understand what meson is supposed to do here, we should look
at ef52e60936, which ported to
typed_kwargs. There is actually a big chunk of code to handle
annotations that got completely dropped, leading with a comment (that
did not get dropped): "they are a list of lists of strings..."

Reimplement this logic inside a validator/converter for the annotations
kwarg container:

- do not listify, we don't accept `annotations: ''` and listify is
  supposed to be for when either x or list[x] is valid

- go back to checking for a list of exactly 3 values

- allow a list of the aforementioned, in the traditionally expected
  form:

  [
    ['foo1', 'foo2', 'foo3'],
    ['bar1', 'bar2', 'bar3'],
  ]

- pass one --annotate flag per 3-value-list

And add some better error reporting for the cause of errors when
processing lists of lists.
2022-01-12 18:55:25 -08:00
Eli Schwartz 71540d1841 fix typo in error message 2022-01-11 22:28:00 -08:00
Eli Schwartz 63593a5528 gnome.gdbus_codegen: allow File objects as XML file
As soon as we check for args[1] we declare it is of type FileOrString,
and the additional ones specified in the `sources` kwarg explicitly
allow this. It makes no sense to not accept it as the posarg too.

Fixes building tracker-miners.
2022-01-11 22:28:00 -08:00
Eli Schwartz bcfb4d0f46 gnome.gtkdoc: fix passing file arguments as a configured file
Fixes gtk3 build, which uses typesfile.

All these arguments are processed by a function that explicitly handles
both str and File, and converts them to absolute paths. They clearly
need to handle File objects.
2022-01-11 22:28:00 -08:00
Eli Schwartz 704e9802c9 gome.gdbus_codegen: fix annotations argument for multiple annotations
Per the gdbus-codegen documentation, this "may be used several times",
and it is:
- a valid use case
- used that way in the wild

Fixes building at least geoclue2, gdm.
2022-01-11 22:28:00 -08:00
Eli Schwartz 81fbcd1df4
fix broken module tests which caused gtkdoc-check to traceback on assert
Regression in commit 566c2c9a9c.

The interpreter details are a bit of black magic. Functions expect
tuples, but they receive lists and then the type-checking decorators
convert those to tuples.

So, directly manhandling a self._interpreter.func_*() but passing it the
tuple it nominally expected, actually explodes in your face by way of
failing an assert, then dumping 'ERROR: Unhandled python exception'.

Fixes use of gnome.gtkdoc(..., check: true), for example when building
glib.
2022-01-10 23:06:51 -05:00
Michal Vasilek 9952446a2a gnome: fix typo in vapigen option metadatadir
This typo was introduced in 9ef36fa80b and
can cause a build failure, because --metadatdir is not a valid vapigen
option.
2022-01-10 15:30:53 -08:00
Eli Schwartz f67994476d remove the RPM module
It is unmaintained, broken (frequently for long periods of time) and not
really required for any meson functionality. Its purpose is to be used
as a one-shot tool for creating a distro package recipe, and then
deleted from your meson.build files.

Due to its fragile dependency on coredata implementation details, we
cannot assume it will reliably work, or continue to work, without
someone who is actively willing to take responsibility for it.

Even if that were to happen, this might be better off as an external
script that parses introspection data.

Closes #9764
Closes #9763
2022-01-10 20:21:40 +02: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 688b4bac76 add FeatureNew decorators for various modules that were lacking them
Going back to 0.38, though some of them are far older. The original
implementation of FeatureNew only added backdated feature checks that
far, anyway.
2021-12-31 12:03:57 +02:00
Xavier Claessens 95a4c6a62a pkgconfig: Fix linking to a custom target
When generating pkgconfig file for a library that links to an
uninstalled static library built by custom_target() Meson was crashing
when trying to access some attributes that does not exist on that class.

Also fix is_internal() implementation, it only really make sense on a
CustomTargetIndex or if CustomTarget has only a single output.
2021-12-22 08:04:08 +05:30
Eli Schwartz ee0baa97cd modules: use find_program implementation to find programs
Do not use ExternalProgram as that is too low-level and doesn't handle
e.g. machine file overrides.

Fixes #9733
2021-12-21 12:17:10 +01:00
Eli Schwartz 6be258137e
modules: let the proxy state find_program do silent lookups 2021-12-20 16:03:43 -05:00
Dylan Baker 3656b8c6d4 modules/gnome: use T.Sequence instead of T.List
because List is invariant, and that's not what we want.
2021-12-20 16:03:19 -05:00
Dylan Baker 1410d2e9c5 modules/gnome: use typed_kwargs for mkenum
This is the last function that doesn't use typed_kwargs. This now uses
the same shared path as the mkenums_simple
2021-12-20 16:03:19 -05:00
Dylan Baker 7e833d1484 modules/gnome: don't call through mkenums for mkenums_simple
It's just a bad idea, but especially once we start adding type
annotations to both of them.
2021-12-20 16:03:19 -05:00
Dylan Baker 4d8c91134c gnome: use typed_kwargs for mkenums_simple
the simple_version still goes through the big version of this function,
but at last we have type checking
2021-12-20 16:03:19 -05:00