[gthumb] meson: added script to make a schema file with the enumeration types



commit 071ff7282788447b5f6174903bd35b9fc004b097
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Oct 23 16:25:42 2017 +0200

    meson: added script to make a schema file with the enumeration types

 data/gschemas/make-enums.py |   28 ++++++++++++++++++++++++++++
 data/gschemas/meson.build   |   17 +++++++++++++++--
 2 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/data/gschemas/make-enums.py b/data/gschemas/make-enums.py
new file mode 100755
index 0000000..21b05ff
--- /dev/null
+++ b/data/gschemas/make-enums.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+import sys
+import os
+import subprocess
+
+if len(sys.argv) <= 1:
+    print("Usage: make-enums.py DIR [DIR [..]]")
+    exit(1)
+
+# Search header files in all the specified directories
+
+dirs = sys.argv[1:]
+all_files = []
+for root_dir in dirs:
+    for root, dirs, files in os.walk(root_dir):
+        for file in files:
+            if file.endswith('.h'):
+                all_files.append(os.path.join(root, file))
+
+subprocess.call(['glib-mkenums',
+  '--comments', '<!-- @comment@ -->',
+  '--fhead',    '<schemalist>',
+  '--vhead',    '  <@type@ id="org.gnome.gthumb.@EnumName@">',
+  '--vprod',    '    <value nick="@valuenick@" value="@valuenum@"/>',
+  '--vtail',    '  </@type@>',
+  '--ftail',    '</schemalist>' 
+] + all_files)
diff --git a/data/gschemas/meson.build b/data/gschemas/meson.build
index bb7caaf..7099cc3 100644
--- a/data/gschemas/meson.build
+++ b/data/gschemas/meson.build
@@ -1,3 +1,5 @@
+schemas_dir = join_paths(datadir, 'glib-2.0', 'schemas')
+
 gschema_files = files(
   'org.gnome.gthumb.gschema.xml',
   'org.gnome.gthumb.change-date.gschema.xml',
@@ -22,6 +24,17 @@ gschema_files = files(
   'org.gnome.gthumb.slideshow.gschema.xml',
   'org.gnome.gthumb.webalbums.gschema.xml'
 )
-install_data(gschema_files, install_dir : join_paths(datadir, 'glib-2.0', 'schemas'))
 
-gnome.compile_schemas()
+enums_schema = custom_target('enums_schema',
+  output : 'org.gnome.gthumb.enums.gschema.xml',
+  command : [ 
+    find_program('make-enums.py'),
+    join_paths(meson.source_root(), 'gthumb'),
+    join_paths(meson.source_root(), 'extensions'),
+  ],
+  capture : true,
+  install : true,
+  install_dir : schemas_dir
+)
+
+install_data(gschema_files, install_dir : schemas_dir)


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