[gnome-tweak-tool] build: Rewrite post-install script in python
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] build: Rewrite post-install script in python
- Date: Thu, 8 Jun 2017 22:51:36 +0000 (UTC)
commit 83ae105c9a5882739a8124ba79df031f41ae5052
Author: Patrick Griffis <tingping tingping se>
Date: Wed Jun 7 16:34:29 2017 -0400
build: Rewrite post-install script in python
There is no reason to depend upon shell.
https://bugzilla.gnome.org/show_bug.cgi?id=783531
meson-postinstall.py | 19 +++++++++++++++++++
meson-postinstall.sh | 10 ----------
meson.build | 2 +-
3 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/meson-postinstall.py b/meson-postinstall.py
new file mode 100755
index 0000000..115d8e0
--- /dev/null
+++ b/meson-postinstall.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import sysconfig
+from compileall import compile_dir
+from os import environ, path
+from subprocess import call
+
+prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+datadir = path.join(prefix, 'share')
+destdir = environ.get('DESTDIR', '')
+
+# Package managers set this so we don't need to run
+if not destdir:
+ print('Updating icon cache...')
+ call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
+
+print('Compiling python bytecode...')
+moduledir = sysconfig.get_path('purelib', vars={'base': str(prefix)})
+compile_dir(destdir + path.join(moduledir, 'gtweak'), optimize=2)
diff --git a/meson.build b/meson.build
index f6bdad7..aef9307 100644
--- a/meson.build
+++ b/meson.build
@@ -30,4 +30,4 @@ subdir('gtweak')
subdir('data')
subdir('po')
-meson.add_install_script('meson-postinstall.sh')
+meson.add_install_script('meson-postinstall.py')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]