summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2017-05-02 19:44:41 +0200
committerCarlos Soriano <csoriano@gnome.org>2017-05-02 19:50:54 +0200
commit53928d7f468e233b569f37d058bd9d4742bb60a5 (patch)
tree44408ab6d58656ed41b7a781c39e5cabea3b8f96
parente9f56f411c5959d0c2961f33bcf9d38fb859f20b (diff)
downloadnautilus-53928d7f468e233b569f37d058bd9d4742bb60a5.tar.gz
postinstall: Use python
Instead of shell scripts, much better to maintain. Also, the new python script has better handling of non existing paths.
-rwxr-xr-xbuild-aux/meson/postinstall.py27
-rwxr-xr-xbuild-aux/meson/postinstall.sh13
-rw-r--r--meson.build2
3 files changed, 28 insertions, 14 deletions
diff --git a/build-aux/meson/postinstall.py b/build-aux/meson/postinstall.py
new file mode 100755
index 000000000..81afb18b7
--- /dev/null
+++ b/build-aux/meson/postinstall.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+datadir = os.path.join(prefix, 'share')
+
+# Packaging tools define DESTDIR and this isn't needed for them
+if 'DESTDIR' not in os.environ:
+ print('Updating icon cache...')
+ icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
+ if not os.path.exists(icon_cache_dir):
+ os.makedirs(icon_cache_dir)
+ subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])
+
+ print('Updating desktop database...')
+ desktop_database_dir = os.path.join(datadir, 'applications')
+ if not os.path.exists(desktop_database_dir):
+ os.makedirs(desktop_database_dir)
+ subprocess.call(['update-desktop-database', '-q', desktop_database_dir])
+
+ print('Compiling GSettings schemas...')
+ schemas_dir = os.path.join(datadir, 'glib-2.0', 'schemas')
+ if not os.path.exists(schemas_dir):
+ os.makedirs(schemas_dir)
+ subprocess.call(['glib-compile-schemas', schemas_dir])
diff --git a/build-aux/meson/postinstall.sh b/build-aux/meson/postinstall.sh
deleted file mode 100755
index 9d10bf1e2..000000000
--- a/build-aux/meson/postinstall.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-# Package managers set this so we don't need to run
-if [ -z "$DESTDIR" ]; then
- echo Compiling GSettings schemas...
- glib-compile-schemas ${MESON_INSTALL_PREFIX}/share/glib-2.0/schemas
-
- echo Updating desktop database...
- update-desktop-database -q ${MESON_INSTALL_PREFIX}/share/applications
-
- echo Updating icon cache...
- gtk-update-icon-cache -q -t -f ${MESON_INSTALL_PREFIX}/share/icons/hicolor
-fi \ No newline at end of file
diff --git a/meson.build b/meson.build
index 73fcfd839..ef8293a53 100644
--- a/meson.build
+++ b/meson.build
@@ -125,4 +125,4 @@ if get_option ('enable-nst-extension')
endif
# Compile GSettings schemas when installing from source.
-meson.add_install_script ('build-aux/meson/postinstall.sh')
+meson.add_install_script ('build-aux/meson/postinstall.py')