[gnome-bluetooth] build: Improve post-install script



commit a18ecf2fd8c0a396526765ffdebb43fec661451b
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Nov 14 11:25:35 2017 +0100

    build: Improve post-install script
    
    The post install script is executing a rename process from when the
    icons' filenames also contained their installation path, which is
    not necessary anymore. It also contains a fixed path for datadir,
    which might change.
    
    This patch removes the unnecessary rename process and also uses
    the provided datadir path, if the user provides one, or the default
    path.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790332

 icons/meson.build     |    2 +-
 meson.build           |    8 +++++---
 meson_post_install.py |   12 ++----------
 3 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/icons/meson.build b/icons/meson.build
index f60a088..d01af7e 100644
--- a/icons/meson.build
+++ b/icons/meson.build
@@ -1 +1 @@
-install_subdir('hicolor', install_dir: gnomebt_icondir)
+install_subdir('hicolor', install_dir: join_paths(gnomebt_datadir, 'icons'))
diff --git a/meson.build b/meson.build
index 9c7bd42..bdc8eaf 100644
--- a/meson.build
+++ b/meson.build
@@ -32,8 +32,6 @@ gnomebt_mandir = join_paths(gnomebt_prefix, get_option('mandir'))
 gnomebt_pkgdatadir = join_paths(gnomebt_datadir, meson.project_name())
 gnomebt_pkglibdir = join_paths(gnomebt_libdir, meson.project_name())
 
-gnomebt_icondir = join_paths(gnomebt_datadir, 'icons')
-
 gnomebt_buildtype = get_option('buildtype')
 gnomebt_debug = gnomebt_buildtype.contains('debug')
 
@@ -128,7 +126,11 @@ configure_file(
   configuration: config_h
 )
 
-meson.add_install_script('meson_post_install.py', get_option('icon_update') ? 'icon_update' : '')
+meson.add_install_script(
+  'meson_post_install.py',
+  get_option('icon_update') ? 'icon_update' : '',
+  gnomebt_datadir
+)
 
 output = '\nConfigure summary:\n\n'
 output += '        Compiler....................:  ' + cc.get_id() + '\n\n'
diff --git a/meson_post_install.py b/meson_post_install.py
index 824a94c..cd91721 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -1,18 +1,10 @@
 #!/usr/bin/env python3
 
-import glob
 import os
-import re
 import subprocess
 import sys
 
-name_pattern = re.compile('hicolor_(?:apps|status)_(?:\d+x\d+|scalable)_(.*)')
-search_pattern = '/**/hicolor_*'
-
-icon_dir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'icons', 'hicolor')
-[os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
- for file in glob.glob(icon_dir + search_pattern, recursive=True)]
-
 if not os.environ.get('DESTDIR') and sys.argv[1] == 'icon_update':
+  icondir = os.path.join(sys.argv[2], 'icons', 'hicolor')
   print('Update icon cache...')
-  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icon_dir])
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])


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