From 0d60138e0a6e8d31cc875c2315812f1cb998f8b7 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 25 Mar 2020 19:13:00 +0100 Subject: [PATCH] build: Only update post-install caches when they exist When building without UI, there are no icon or desktop files so there is no need to run the commands to refresh the caches. It would be even nicer to move the postinstall script to the malcontent-control subdirectory but it really applies to the installation output of the whole project, not just the malcontent-control part. --- build-aux/meson_post_install.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py index 8cd5ad8..aefcadf 100644 --- a/build-aux/meson_post_install.py +++ b/build-aux/meson_post_install.py @@ -7,10 +7,12 @@ import subprocess install_prefix = os.environ['MESON_INSTALL_PREFIX'] if not os.environ.get('DESTDIR'): - print('Updating icon cache…') icon_cache_dir = os.path.join(install_prefix, 'share', 'icons', 'hicolor') - subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir]) + if os.path.exists(icon_cache_dir): + print('Updating icon cache…') + subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir]) - print('Updating desktop database…') desktop_database_dir = os.path.join(install_prefix, 'share', 'applications') - subprocess.call(['update-desktop-database', '-q', desktop_database_dir]) + if os.path.exists(desktop_database_dir): + print('Updating desktop database…') + subprocess.call(['update-desktop-database', '-q', desktop_database_dir])