[bijiben/wip/inigomartinez/meson: 5/5] build: Rename the names of the icons' files



commit 112d80273e254c3aaab9ddae11bf7814e5d13942
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Sep 5 17:31:03 2017 +0200

    build: Rename the names of the icons' files
    
    The names of icons' files, besides containing the final names, they
    also contained the path in which they were going to be installed.
    This implies that they have to be renamed on the installation
    process.
    
    This patch creates the proper directory tree needed on the
    installation process and renames all files' names to their final
    names.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787317

 .../16x16/actions/note.png}                        |  Bin 617 -> 617 bytes
 .../16x16/apps/org.gnome.bijiben.png}              |  Bin 666 -> 666 bytes
 .../22x22/apps/org.gnome.bijiben.png}              |  Bin 784 -> 784 bytes
 .../24x24/actions/note.png}                        |  Bin 964 -> 964 bytes
 .../24x24/apps/org.gnome.bijiben.png}              |  Bin 770 -> 770 bytes
 .../256x256/apps/org.gnome.bijiben.png}            |  Bin 22451 -> 22451 bytes
 .../32x32/apps/org.gnome.bijiben.png}              |  Bin 1484 -> 1484 bytes
 .../48x48/actions/note.png}                        |  Bin 2644 -> 2644 bytes
 .../48x48/apps/org.gnome.bijiben.png}              |  Bin 2561 -> 2561 bytes
 .../scalable/actions/link.svg}                     |    0
 .../scalable/apps/org.gnome.bijiben-symbolic.svg}  |    0
 data/icons/meson.build                             |   50 +++++++------------
 meson_post_install.py                              |   12 -----
 13 files changed, 19 insertions(+), 43 deletions(-)
---
diff --git a/data/icons/hicolor_actions_scalable_link.svg b/data/icons/hicolor/scalable/actions/link.svg
similarity index 100%
rename from data/icons/hicolor_actions_scalable_link.svg
rename to data/icons/hicolor/scalable/actions/link.svg
diff --git a/data/icons/hicolor_apps_scalable_org.gnome.bijiben-symbolic.svg 
b/data/icons/hicolor/scalable/apps/org.gnome.bijiben-symbolic.svg
similarity index 100%
rename from data/icons/hicolor_apps_scalable_org.gnome.bijiben-symbolic.svg
rename to data/icons/hicolor/scalable/apps/org.gnome.bijiben-symbolic.svg
diff --git a/data/icons/meson.build b/data/icons/meson.build
index 6efcee6..6a6c81c 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -1,42 +1,30 @@
-apps_icon_sizes = [
-  '16x16',
-  '22x22',
-  '24x24',
-  '32x32',
-  '48x48',
-  '256x256'
+apps_icons = [
+  ['16x16', 'org.gnome.bijiben.png'],
+  ['22x22', 'org.gnome.bijiben.png'],
+  ['24x24', 'org.gnome.bijiben.png'],
+  ['32x32', 'org.gnome.bijiben.png'],
+  ['48x48', 'org.gnome.bijiben.png'],
+  ['256x256', 'org.gnome.bijiben.png'],
+  ['scalable', 'org.gnome.bijiben-symbolic.svg']
 ]
 
-# must be renamed to org.gnome.bijiben.png
-foreach icon_size: apps_icon_sizes
+foreach icon: apps_icons
   install_data(
-    '_'.join(['hicolor', 'apps', icon_size, 'org.gnome.bijiben.png']),
-    install_dir: join_paths(bijiben_datadir, 'icons', 'hicolor', icon_size, 'apps')
+    join_paths('hicolor', icon[0], 'apps', icon[1]),
+    install_dir: join_paths(bijiben_datadir, 'icons', 'hicolor', icon[0], 'apps')
   )
 endforeach
 
-# must be renamed to org.gnome.bijiben-symbolic.svg
-install_data(
-  '_'.join(['hicolor', 'apps', 'scalable', 'org.gnome.bijiben-symbolic.svg']),
-  install_dir: join_paths(bijiben_datadir, 'icons', 'hicolor', 'scalable', 'apps')
-)
-
-actions_icon_sizes = [
-  '16x16',
-  '24x24',
-  '48x48'
+actions_icons = [
+  ['16x16', 'note.png'],
+  ['24x24', 'note.png'],
+  ['48x48', 'note.png'],
+  ['scalable', 'link.svg']
 ]
 
-# must be renamed to note.png
-foreach icon_size: actions_icon_sizes
+foreach icon: actions_icons
   install_data(
-    '_'.join(['hicolor', 'actions', icon_size, 'note.png']),
-    install_dir: join_paths(bijiben_pkgdatadir, 'icons', 'hicolor', icon_size, 'actions')
+    join_paths('hicolor', icon[0], 'actions', icon[1]),
+    install_dir: join_paths(bijiben_pkgdatadir, 'icons', 'hicolor', icon[0], 'actions')
   )
 endforeach
-
-# must be renamed to link.svg
-install_data(
-  '_'.join(['hicolor', 'actions', 'scalable', 'link.svg']),
-  install_dir: join_paths(bijiben_pkgdatadir, 'icons', 'hicolor', 'scalable', 'actions')
-)
diff --git a/meson_post_install.py b/meson_post_install.py
index 09902c2..8fea98b 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -1,25 +1,13 @@
 #!/usr/bin/env python3
 
-import glob
 import os
-import re
 import subprocess
 import sys
 
 if not os.environ.get('DESTDIR'):
   datadir = sys.argv[1]
 
-  name_pattern = re.compile('hicolor_(?:apps|actions)_(?:\d+x\d+|scalable)_(.*)')
-  search_pattern = '/**/hicolor_*'
-
-  actions_icondir = os.path.join(datadir, 'bijiben', 'icons', 'hicolor')
-  [os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
-   for file in glob.glob(actions_icondir + search_pattern, recursive=True)]
-
   icondir = os.path.join(datadir, 'icons', 'hicolor')
-  [os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
-   for file in glob.glob(icondir + search_pattern, recursive=True)]
-
   print('Update icon cache...')
   subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
 


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