[glib/glib-2-50] Visual Studio builds: Add script to generate utility scripts



commit 4898da5935a27749e1a101770d5ac91d0892ef6d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed May 24 13:29:11 2017 +0800

    Visual Studio builds: Add script to generate utility scripts
    
    This will allow the utility scripts glib-mkenums and gdbus-codegen be
    generated with the proper info in them, as build systems such as Meson
    might look for shebang lines to determine the commands that need to be
    called to invoke the scripts (which is necessary for calling these
    scripts on standard Windows cmd.exe)

 build/win32/Makefile.am         |    3 ++-
 build/win32/gen_util_scripts.py |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 0f93ac2..dc750ed 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -12,4 +12,5 @@ EXTRA_DIST =          \
        make.msc        \
        module.defs     \
        pc_base.py      \
-       replace.py
+       replace.py      \
+       gen_util_scripts.py
diff --git a/build/win32/gen_util_scripts.py b/build/win32/gen_util_scripts.py
new file mode 100644
index 0000000..f644d63
--- /dev/null
+++ b/build/win32/gen_util_scripts.py
@@ -0,0 +1,33 @@
+# Simple Python script to generate the full .schema.xml files
+
+import os
+import sys
+import argparse
+
+from replace import replace_multi
+
+def main(argv):
+    srcroot = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', '..')
+    parser = argparse.ArgumentParser(description='Generate Utility Scripts')
+    parser.add_argument('-t', '--type', help='Script Type (glib-mkenums or gdbus-codegen)', required=True)
+    parser.add_argument('--version', help='Package Version', required=True)
+    args = parser.parse_args()
+
+    replace_items = {'@PYTHON@': 'python',
+                     '@PERL_PATH@': 'perl',
+                     '@GLIB_VERSION@': args.version}
+
+    if args.type == 'glib-mkenums':
+        replace_multi(srcroot + '/gobject/glib-mkenums.in',
+                      srcroot + '/gobject/glib-mkenums',
+                      replace_items)
+    elif args.type == 'gdbus-codegen':
+        replace_multi(srcroot + '/gio/gdbus-2.0/codegen/gdbus-codegen.in',
+                      srcroot + '/gio/gdbus-2.0/codegen/gdbus-codegen',
+                      replace_items)
+
+    else:
+        raise ValueError('Type must be glib-mkenums or gdbus-codegen')
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))


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