[gnome-weather] meson: Add gnome-weather binary to path



commit b64f77334760d85bbae95a6e427a3f524704498e
Author: Christopher Davis <brainblasted disroot org>
Date:   Wed Feb 13 20:10:43 2019 -0500

    meson: Add gnome-weather binary to path
    
    Adds a gnome-weather binary to the $PATH for simple running.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-weather/issues/19

 meson.build           |  7 ++++++-
 meson_post_install.py | 23 ++++++++++++++++-------
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/meson.build b/meson.build
index 263c13b..2b6fae7 100644
--- a/meson.build
+++ b/meson.build
@@ -55,4 +55,9 @@ subdir('po')
 subdir('src')
 subdir('tests')
 
-meson.add_install_script('meson_post_install.py')
+meson.add_install_script(
+    'meson_post_install.py',
+    join_paths(get_option('prefix'), get_option('datadir')),
+    DATA_DIR,
+    BIN_DIR,
+)
diff --git a/meson_post_install.py b/meson_post_install.py
index 01ea4c0..750d76e 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -1,15 +1,24 @@
 #!/usr/bin/env python3
 
-from os import environ, path
-from subprocess import call
+import os
+import subprocess
+import sys
 
-prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
-datadir = path.join(prefix, 'share')
-destdir = environ.get('DESTDIR', '')
+destdir = os.environ.get('DESTDIR', '')
+datadir = sys.argv[1]
+pkgdatadir = sys.argv[2]
+bindir = os.path.join(destdir + os.sep + sys.argv[3])
+
+if not os.path.exists(bindir):
+    os.makedirs(bindir)
+
+src = os.path.join(pkgdatadir, 'org.gnome.Weather')
+dest = os.path.join(bindir, 'gnome-weather')
+subprocess.call(['ln', '-s', '-f', src, dest])
 
 if not destdir:
     print('Updating icon cache...')
-    call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
+    subprocess.call(['gtk-update-icon-cache', '-qtf', os.path.join(datadir, 'icons', 'hicolor')])
     print("Installing new Schemas")
-    call(['glib-compile-schemas', path.join(datadir, 'glib-2.0/schemas')])
+    subprocess.call(['glib-compile-schemas', os.path.join(datadir, 'glib-2.0/schemas')])
 


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