[gnome-boxes] meson: Fix post install script



commit f90438d51b368c46f7af80c69a8d723152dfcd5e
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Sat Dec 9 21:27:53 2017 +0100

    meson: Fix post install script
    
    meson uses a post install script for compiling gsettings schemas,
    updating the icon cache and also updating the desktop database.
    However, it assumes that the data directory is the share directory
    under prefix, which might not be correct because the user can choose
    a different directory.
    
    This patch uses the data directory used by meson by passing it to
    the post install script.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791421

 build-aux/post_install.py |   14 +++++++-------
 meson.build               |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/build-aux/post_install.py b/build-aux/post_install.py
index c1faf09..a075a22 100755
--- a/build-aux/post_install.py
+++ b/build-aux/post_install.py
@@ -1,19 +1,19 @@
 #!/usr/bin/python3
 
 import os
-import pathlib
 import subprocess
+import sys
 
-prefix = pathlib.Path(os.environ.get('MESON_INSTALL_PREFIX', '/usr/local'))
-datadir = prefix / 'share'
 destdir = os.environ.get('DESTDIR', '')
 
-if not destdir:
+if not destdir and len(sys.argv) > 1:
+    datadir = sys.argv[1]
+
     print('Compiling gsettings schemas...')
-    subprocess.call(['glib-compile-schemas', str(datadir / 'glib-2.0' / 'schemas')])
+    subprocess.call(['glib-compile-schemas', os.path.join(datadir, 'glib-2.0', 'schemas')])
 
     print('Updating icon cache...')
-    subprocess.call(['gtk-update-icon-cache', '-qtf', str(datadir / 'icons' / 'hicolor')])
+    subprocess.call(['gtk-update-icon-cache', '-qtf', os.path.join(datadir, 'icons', 'hicolor')])
 
     print('Updating desktop database...')
-    subprocess.call(['update-desktop-database', '-q', str(datadir / 'applications')])
+    subprocess.call(['update-desktop-database', '-q', os.path.join(datadir, 'icons', 'applications')])
diff --git a/meson.build b/meson.build
index 713d429..3654b91 100644
--- a/meson.build
+++ b/meson.build
@@ -69,7 +69,7 @@ endif
 configure_file (output: 'config.h', configuration: conf)
 config_h_dir = include_directories ('.')
 
-meson.add_install_script (join_paths ('build-aux', 'post_install.py'))
+meson.add_install_script (join_paths ('build-aux', 'post_install.py'), data_dir)
 
 subdir ('data')
 subdir ('help')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]