diff options
author | Paolo Borelli <borellip@amazon.com> | 2022-09-28 14:37:03 +0200 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-09-28 12:07:24 -0400 |
commit | a58ec322b3a9a07af83ea268341c16f972f52791 (patch) | |
tree | f23563338257e18ba59411b2dd7e7ace5593634e | |
parent | 56a6ee1e5d51ca71a9188e6cbdcf8a2ce611cf2b (diff) | |
download | meson-a58ec322b3a9a07af83ea268341c16f972f52791.zip meson-a58ec322b3a9a07af83ea268341c16f972f52791.tar.gz meson-a58ec322b3a9a07af83ea268341c16f972f52791.tar.bz2 |
gnome: add support for update-mime-database
Fixes https://github.com/mesonbuild/meson/issues/10865
-rw-r--r-- | docs/markdown/Gnome-module.md | 2 | ||||
-rw-r--r-- | docs/markdown/snippets/gnome_update_mime_database.md | 5 | ||||
-rw-r--r-- | mesonbuild/modules/gnome.py | 10 |
3 files changed, 17 insertions, 0 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md index d85476a..85b101a 100644 --- a/docs/markdown/Gnome-module.md +++ b/docs/markdown/Gnome-module.md @@ -415,3 +415,5 @@ It takes the following keyword arguments: `<prefix>/<datadir>/icons/hicolor`. - `update_desktop_database`: *Since 0.59.0* If set to `true`, update cache of MIME types handled by desktop files in `<prefix>/<datadir>/applications`. +- `update_mime_database`: *Since 0.64.0* If set to `true`, update cache of + MIME types in `<prefix>/<datadir>/mime`. diff --git a/docs/markdown/snippets/gnome_update_mime_database.md b/docs/markdown/snippets/gnome_update_mime_database.md new file mode 100644 index 0000000..a60381d --- /dev/null +++ b/docs/markdown/snippets/gnome_update_mime_database.md @@ -0,0 +1,5 @@ +## Added `update_mime_database` to `gnome.post_install()` + +Applications that install a `.xml` file containing a `mime-type` need to update +the cache upon installation. Most applications do that using a custom script, +but it can now be done by Meson directly. diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 499d279..4287b13 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -58,6 +58,7 @@ if T.TYPE_CHECKING: gio_querymodules: T.List[str] gtk_update_icon_cache: bool update_desktop_database: bool + update_mime_database: bool class CompileSchemas(TypedDict): @@ -282,6 +283,7 @@ class GnomeModule(ExtensionModule): self.install_gio_querymodules: T.List[str] = [] self.install_gtk_update_icon_cache = False self.install_update_desktop_database = False + self.install_update_mime_database = False self.devenv: T.Optional[build.EnvironmentVariables] = None self.native_glib_version: T.Optional[str] = None self.methods.update({ @@ -332,6 +334,7 @@ class GnomeModule(ExtensionModule): KwargInfo('gio_querymodules', ContainerTypeInfo(list, str), default=[], listify=True), KwargInfo('gtk_update_icon_cache', bool, default=False), KwargInfo('update_desktop_database', bool, default=False, since='0.59.0'), + KwargInfo('update_mime_database', bool, default=False, since='0.64.0'), ) @noPosargs @FeatureNew('gnome.post_install', '0.57.0') @@ -370,6 +373,13 @@ class GnomeModule(ExtensionModule): script = state.backend.get_executable_serialisation([prog, '-q', appdir]) script.skip_if_destdir = True rv.append(script) + if kwargs['update_mime_database'] and not self.install_update_mime_database: + self.install_update_mime_database = True + prog = state.find_program('update-mime-database') + appdir = os.path.join(datadir_abs, 'mime') + script = state.backend.get_executable_serialisation([prog, appdir]) + script.skip_if_destdir = True + rv.append(script) return ModuleReturnValue(None, rv) @typed_pos_args('gnome.compile_resources', str, (str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)) |