aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/gnome.py
AgeCommit message (Collapse)AuthorFilesLines
2023-01-26gnome: Deduplicate include dirs to generate girThibault Saunier1-3/+3
Ensuring the order is respected
2023-01-10modules/gnome: fix type annotations from `__init__`, which are wrongDylan Baker1-9/+10
Mainly thi sis that `state.find_program()` is annotated incorrectly, it returns `ExternalProgram | Executable | OverrideProgram`, but it's annotated to return only `ExteranlProgram`, and thus a bunch of the annotations in the gnome module are wrong.
2023-01-04add objects keyword argument to declare_dependenciesPaolo Bonzini1-1/+1
2023-01-03modules/gnome: use `mlog.log(once=True)` in a few more placesDylan Baker1-2/+2
It's probably not useful to spam the user with warnings that old versions of software may not behave correctly when the first warning was perfectly valid.
2023-01-03Add fatal=False to many mlog.warnings()Dylan Baker1-3/+5
There are lots of warnings that become fatal, that are simply unfixable by the end user. Things like using old versions of software (because they're using some kind of LTS release), warnings about compilers not supporting certain kinds of checks, or standards being upgraded due to skipped implementations (MSVC has c++98 and c++14, but not c++11). None of these should be fatal, they're informative, and too important to reduce to notices, but not important enough to stop meson if they're printed.
2022-12-11typing: fix some broken Sequence annotationsEli Schwartz1-1/+1
T.Sequence is a questionable concept. The idea is to hammer out generic, maximally forgiving APIs that operate on protocols, which is a fancy way of saying "I don't care if you use tuples or lists". This is rarely needed, actually, and in exchange for this fancy behavior you get free bugs. Specifically, `somestr` is of type `T.Sequence[str]`, and also `somestr[0]` is another string of type you guessed it. It's ~~turtles~~ strings all the way down. It's worth noting that trying to code for "protocols" is a broken concept if the contents have semantic meaning, e.g. it operates on "the install tags of this object" rather than "an iterable that supports efficient element access". The other way to use T.Sequence is "I don't like that T.List is invariant, but also I don't like that T.Tuple makes you specify exact ordering". This sort of works. In fact it probably does work as long as you don't allow str in your sequences, which of course everyone allows anyway. Use of Sequence has cute side effects, such as actually passing lists around, knowing that you are going to get a list and knowing that you need to pass it on as a list, and then having to re-allocate as `list(mylist)` "because the type annotations says it could be a str or tuple". Except it cannot be a str, because if it is then the application is fatally flawed and logic errors occur to disastrous end user effects, and the type annotations: - do not enforce their promises of annotating types - fail to live up to "minimal runtime penalties" due to all the `list()` Shun this broken concept, by hardening the type annotations. As it turns out, we do not actually need any of this covariance or protocol-ism for a list of strings! The whole attempt was a slow, buggy waste of time.
2022-12-07Remove useless EmptyExternalProgramXavier Claessens1-3/+2
It is only used by Environment.get_exe_wrapper() and every callers were handling None already. Type annotation was wrong, it already could return None for the case an exe wrapper is needed but none is provided.
2022-11-30pylint: enable the set_membership pluginDylan Baker1-1/+1
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
2022-10-28gnome: allow generator outputs as gdbus-codegen inputsPaolo Bonzini1-3/+3
GeneratedLists as sources to `gnome.gdbus_codegen` worked until version 0.60 of Meson, but broke in 0.61 because of the conversion to typed_pos_args and typed_kwargs. Reinstate this by adding them to the decorators and annotations. Note that gdbus_codegen desugars to two custom_targets and therefore the generator is invoked twice. This is not optimal, but it should not be an issue and can be changed later. Fixes: 53a187ba2 ("modules/gnome: use typed_pos_args for gdbus_codegen", 2021-11-01) Fixes: ef52e6093 ("modules/gnome: use typed_kwargs for gdbus_codegen", 2021-11-08)
2022-10-28gnome: allow custom targets as gdbus-codegen inputsPaolo Bonzini1-4/+4
Custom targets as sources to `gnome.gdbus_codegen` worked until version 0.60 of Meson, but broke in 0.61 because of the conversion to typed_pos_args and typed_kwargs. Reinstate this by adding custom targets to the decorators and annotations. While generators also used to work, they are a bit tricky because gdbus_codegen desugars to two custom_targets and therefore the generator is invoked twice. This should not be a problem, but be explicit and leave that to a separate commit to highlight the problem. Fixes: 53a187ba2 ("modules/gnome: use typed_pos_args for gdbus_codegen", 2021-11-01) Fixes: ef52e6093 ("modules/gnome: use typed_kwargs for gdbus_codegen", 2021-11-08)
2022-10-04pylint: enable use-a-generatorDylan Baker1-1/+1
This catches some optimization problems, mostly in the use of `all()` and `any()`. Basically writing `any([x == 5 for x in f])` vs `any(x == 5 for x in f)` reduces the performance because the entire concrete list must first be created, then iterated over, while in the second f is iterated and checked element by element.
2022-09-28gnome: add support for update-mime-databasePaolo Borelli1-0/+10
Fixes https://github.com/mesonbuild/meson/issues/10865
2022-09-27gnome/yelp: fix `xml:lang` attributesJan Tojnar1-1/+1
itstool detects a language code from the mo file’s basename, so when https://github.com/mesonbuild/meson/commit/26c1869a142a952ffa23fe566a255b259304a39b changed the file name to be prefixed with project name, values like “my-project-xx” ended up in the `xml:lang` attribute of the generated page files, instead of the expected IETF BCP 47 language tag. Let’s fix it by passing a locale code to itstool explicitly.
2022-09-22modules/gnome: make_native_glib_version an instance varDylan Baker1-9/+6
This removes the need for the use of the global statement. I've also updated the test that overrides this to use mock.patch instead of hand monkey patching.
2022-09-18gnome: Add some missing install_tagXavier Claessens1-0/+6
2022-09-12modules: Fix paths to (sub)project source/build directoriesDavid Ward1-2/+2
The subproject directory name (i.e. 'subprojects') was being added to the path even for the main project.
2022-08-17modules: use module level information about new and deprecationDylan Baker1-1/+4
Instead of using FeatureNew/FeatureDeprecated in the module. The goal here is to be able to handle information about modules in a single place, instead of having to handle it separately. Each module simply defines some metadata, and then the interpreter handles the rest.
2022-08-04typing: simplify type annotations for librariesEli Schwartz1-3/+3
In a bunch of places we need to list various types of libraries including custom_target outputs, and it gets very long. Use a common T.Union for this.
2022-07-06gnome module: Use --quiet to supress printing the link command lineRichard Hughes1-0/+1
This removes one line of stderr output per GObject Introspection file processed, e.g. g-ir-scanner: link: gcc -o Fwupd-2.0 Fwupd-2.0.o -L. -Wl,-rpath...
2022-07-03move various unused typing-only imports into type-checking blocksEli Schwartz1-1/+2
2022-06-19gnome module: fix regression that broke using built xml files as gresourcesEli Schwartz1-1/+8
In commit 3dcc7125833cae138987aa4535c88dbd4dbd960d we moved to typed_pos_args. In the process, we deleted some code to specifically raise an error if you use custom_target or generator outputs, instead leaving it out of the typed pos args. However, that support was specifically supposed to be there. It was only an error in part of an if statement for handling old versions of glib-compile-resources. The specific error it calls out is that we need to manually parse the depfile at configure time, due to an external bug; obviously this is impossible if the gresource is only created at build time. Reinstate the original error message check, and allow built outputs to be used as compile_resources() inputs. Fixes #10367
2022-06-13flake8: fix various whitespace nitsEli Schwartz1-1/+2
2022-06-10wayland: Lookup for wayland-scanner using pkgconfigXavier Claessens1-35/+5
Just like some of glib tools, wayland-scanner can be defined in the pkgconfig dependency variables. Share code between gnome and wayland modules into ModuleState.
2022-06-01interpreter: use a shared KwargInfo for install_dirDylan Baker1-6/+6
CustomTarget allows multiple install dirs, while basically everything else allows only one. So this provides a shared instance for that.
2022-06-01modules/gnome: fix gen_marshall annotationDylan Baker1-1/+1
2022-06-01modules: move gnome targets into gnome moduleDylan Baker1-1/+15
They're not used outside of the gnome module anyway, and they create some annoying potentials for dependency loops
2022-05-25modules/gnome: Fix missing type annotationDylan Baker1-1/+1
2022-05-25modules/gnome: fix some typing issuesDylan Baker1-3/+3
That come to light with some of the changes later in this series, particularly around dependencies.
2022-04-30gnome: Make sure g-ir-scanner can use pkg-config properlyXavier Claessens1-0/+8
We need to setup the environment we pass to g-ir-scanner because it will try to use pkg-config to find dependencies, and that must respect user settings from machine file. Also make it use uninstalled pc files Meson generated in the case dependencies, such as glib, have been built as subproject.
2022-04-27gnome: Use 'doc' install_tag for gnome.yelpFerdinand Thiessen1-4/+6
2022-04-07Revert "wayland: Also lookup scanner in pkgconfig"Eli Schwartz1-3/+19
This reverts commit 7954a4c9cbf8355d8c8ea9b3d98df45d9f96f66e.
2022-04-04wayland: Also lookup scanner in pkgconfigXavier Claessens1-19/+3
This moves generally useful logic from GNOME module's _get_native_binary() into find_program() implementation. We could decide later to expose it as public API.
2022-03-31fix continued breakage in gnome module APIEli Schwartz1-2/+2
In commit 823da3990947a8f4a2152826f0d7229f8a7a0159 we tried to fix disappearing dependencies. Instead, we appended the replacement dependencies to the existing ones. But this, too, was wrong. The function doesn't return new dependencies... it returns a copied list of all the dependencies, then alone of all parts of that API, expects to overwrite the existing variable. (Sadly, part of the internals actually uses the entire list for something.) As a result, we produced a repeatedly growing list, which eventually scaled really badly and e.g. OOMed on gstreamer. Instead, let's just replace the dependencies with the updated copy.
2022-03-29move a bunch of imports into TYPE_CHECKING blocksEli Schwartz1-1/+3
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-29Pass environment down to base Target classXavier Claessens1-4/+21
2022-03-29gnome: Fix gtkdoc when using multiple Apple frameworksJan Tojnar1-30/+48
The `-framework Foundation -framework CoreFoundation` ended up de-duplicated by OrderedSet into `-framework Foundation CoreFoundation`.
2022-03-29gnome: Fix typo in _get_dependencies_flagsJan Tojnar1-1/+1
This was introduced in https://github.com/mesonbuild/meson/commit/823da3990947a8f4a2152826f0d7229f8a7a0159
2022-03-28fix regression in propagating depends in gtkdocEli Schwartz1-6/+11
In commit 68e684d51f1e469e0d9f4b499ffda15146cad98a the function signature was changed, but several places did not adapt. Additionally, we now totally dropped the in-place update of gtkdoc's sole source of dependencies, but didn't propagate them upward to assign the newly collected dependencies anywhere. Fixes building gtkdoc with internal dependencies and failing when specified directly (when building the 'all' target with sufficiently random parallelism, deps may be built on time). Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008382 https://gitlab.gnome.org/GNOME/libmediaart/-/issues/4
2022-03-23gnome module: properly fallback to gtk-update-icon-cacheAntoine Jacoutot1-1/+1
Commit a0cade8f introduced a typo and wrongly check for gtk4-update-icon-cache twice. If gtk4-update-icon-cache (gtk4) is not found, look for gtk-update-icon-cache (gtk3) instead.
2022-03-18gnome module: fix incorrect lookup of nonexistent dependencies in post_installEli Schwartz1-3/+3
While gtk+-3.0 / gtk4 do exist, they have never provided the location of the gtk-update-icon-cache program as a pkgconfig variable. Trying to find one anyway, resulted in two things happening: - a useless dep lookup - a fatal-meson-warnings error and build failure because the get_pkgconfig_variable() in question never existed The desktop-file-utils package is a package solely providing some command line programs, and has never provided a pkg-config file in the first place, so this always logged that the dependency was not found and fell back to normal find_program_impl(), although without fatal-meson-warnings build errors. Fixes #10139
2022-03-13gnome module: fix crash due to misused function while generating gir commandEli Schwartz1-3/+3
In commit 68e684d51f1e469e0d9f4b499ffda15146cad98a the _get_link_args function was modified from returning a list[str] of arguments, to a tuple of both that and a modified copy of the entire target's current/enhanced dependencies (why not just the new ones? I don't know). However, the existing use of the function was not adapted to this change, and tried to turn this entire tuple into a node of the command line. Tuples cannot flatten to lists, and mesonlib.File or HoldableObjects don't make good command line arguments. As a result we errored out with: ERROR: Argument (['-L/path/to/builddir/', '--extra-library=foo'], [<SharedLibrary 25a6634@@foo@sha: foo>, <SharedLibrary 25a6634@@foo@sha: foo>, <SharedLibrary 25a6634@@foo@sha: foo>]) in "command" is invalid Split out the flags and the dependencies and update the former while replacing the latter.
2022-03-13Merge pull request #9339 from dcbaker/submit/structured_sourcesJussi Pakkanen1-8/+8
Structured Sources
2022-03-09fix python traceback when gtkdoc needs an exe_wrapper but doesn't have oneEli Schwartz1-2/+4
In commit c88bfdbefc2f79ac2dfa9bff5847c350de5f5db8 we added support for an exe_wrapper to gtkdoc, which checked twice whether the environment says it is needed, and didn't check at all whether one was provided. The result: File "/usr/lib/python3/dist-packages/mesonbuild/modules/gnome.py", line 1354, in gtkdoc t_args.append('--run=' + ' '.join(state.environment.get_exe_wrapper().get_command())) AttributeError: 'NoneType' object has no attribute 'get_command' Instead, check whether we have a valid exe_wrapper (if we don't need one, then even when one is defined in the cross file, we get an EmptyExternalProgram) and if we do, use it. If we don't have one, but need one, then we revert back to the behavior before commit c88bfdbefc2f79ac2dfa9bff5847c350de5f5db8, which probably means "executing the doc target causes the command to error out with "Exec format error".
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz1-2/+2
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-03-07build: plumb structured sources into BuildTargetsDylan Baker1-8/+8
2022-03-03add D features to InternalDependencyRemi Thebault1-1/+1
2022-02-28Add API for modules that wants to define their devenvXavier Claessens1-1/+3
2022-02-16flake8: fix various whitespace errors with badly aligned codeEli Schwartz1-7/+8
2022-01-28modules/gnome: remove unnecessary type checkDylan Baker1-3/+0
This should have been removed when typed_kwargs was added
2022-01-28gnome: genmarshal: If the source includes the header, depend on itDylan Baker1-15/+18
Otherwise we're racing between the header generation and the source generation.