[gtk/gtk-3-24-meson: 33/89] meson: Make post-install script a Python script



commit b65a6b1640b626b7ed0b25a22b8eda3116cdd783
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Mar 22 17:31:02 2019 +0800

    meson: Make post-install script a Python script
    
    This is so that the post install script will work on environments where
    *NIX shell scripts are not supported, such as on Windows cmd.exe for
    Visual Studio builds.

 build-aux/meson/post-install.py | 36 ++++++++++++++++++++++++++++++++++++
 build-aux/meson/post-install.sh | 26 --------------------------
 meson.build                     |  5 +++--
 3 files changed, 39 insertions(+), 28 deletions(-)
---
diff --git a/build-aux/meson/post-install.py b/build-aux/meson/post-install.py
new file mode 100644
index 0000000000..f526bc81bf
--- /dev/null
+++ b/build-aux/meson/post-install.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import subprocess
+
+if 'DESTDIR' not in os.environ:
+    gtk_api_version = sys.argv[1]
+    gtk_abi_version = sys.argv[2]
+    gtk_bindir = sys.argv[3]
+    gtk_libdir = sys.argv[4]
+    gtk_datadir = sys.argv[5]
+    gtk_query_immodules = os.path.join(gtk_bindir, 'gtk-query-immodules-' + gtk_api_version)
+
+    gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
+    gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
+    gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
+
+    print('Compiling GSettings schemas...')
+    subprocess.call(['glib-compile-schemas',
+                    os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
+
+    print('Updating icon cache...')
+    subprocess.call(['gtk-update-icon-cache', '-q', '-t' ,'-f',
+                    os.path.join(gtk_datadir, 'icons', 'hicolor')])
+
+    print('Updating module cache for input methods...')
+    os.makedirs(gtk_immodule_dir, exist_ok=True)
+    immodule_cache_file = open(os.path.join(gtk_moduledir, 'immodules.cache'), 'w')
+    subprocess.call([gtk_query_immodules], stdout=immodule_cache_file)
+    immodule_cache_file.close()
+
+    # Untested!
+    print('Updating module cache for print backends...')
+    os.makedirs(gtk_printmodule_dir, exist_ok=True)
+    subprocess.call(['gio-querymodules', gtk_printmodule_dir])
diff --git a/meson.build b/meson.build
index 4b902f276e..167689ec85 100644
--- a/meson.build
+++ b/meson.build
@@ -749,10 +749,11 @@ endif
 #  subdir('docs/reference')
 #endif
 
-# Keep this in sync with post-install.sh expected arguments
-meson.add_install_script('build-aux/meson/post-install.sh',
+# Keep this in sync with post-install.py expected arguments
+meson.add_install_script('build-aux/meson/post-install.py',
                          gtk_api_version,
                          gtk_binary_version,
+                         join_paths(gtk_prefix, get_option('bindir')),
                          gtk_libdir,
                          gtk_datadir)
 


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