[gsettings-desktop-schemas] Visual Studio builds: Clean up gschema.xml generation process



commit ebe16d2d42efde7e9755fbb7df83d632976de5f4
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu May 12 18:20:14 2016 +0800

    Visual Studio builds: Clean up gschema.xml generation process
    
    This adds a simple script to generate the .gschema.xml files in one shot,
    which eliminates the need to use a temp file explicitly.

 build/win32/Makefile.am                           |    1 +
 build/win32/genschema.py                          |   25 +++++++++++++++++++++
 build/win32/gsettings-desktop-schemas-msvc.mak.in |    6 +---
 3 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 74341ef..b7853ee 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -24,6 +24,7 @@ EXTRA_DIST = \
        gsettings-desktop-schemas-msvc.mak.in   \
        gsettings-desktop-schemas-msvc.mak      \
        introspection-msvc.mak                  \
+       genschema.py                            \
        replace.py                              \
        uri.py                                  \
        README.txt                              \
diff --git a/build/win32/genschema.py b/build/win32/genschema.py
new file mode 100644
index 0000000..31b690e
--- /dev/null
+++ b/build/win32/genschema.py
@@ -0,0 +1,25 @@
+# Simple Python script to generate the full .schema.xml files
+
+import os
+import sys
+import argparse
+
+from replace import replace_multi
+
+def main(argv):
+    parser = argparse.ArgumentParser(description='Generate .schema.xml from its template.')
+    parser.add_argument('-i', '--input', help='Input file', required=True)
+    parser.add_argument('-o', '--output', help='Output file', required=True)
+    parser.add_argument('--package', help='Package Name', required=True)
+    parser.add_argument('--prefix', help='Installation Prefix', required=True)
+    args = parser.parse_args()
+
+    replace_items = {'@GETTEXT_PACKAGE@': args.package,
+                     '@datadir@': '/' + args.prefix + '/share'}
+
+    replace_multi(args.input,
+                  args.output,
+                  replace_items)
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/build/win32/gsettings-desktop-schemas-msvc.mak.in 
b/build/win32/gsettings-desktop-schemas-msvc.mak.in
index adb6517..30d4c3e 100644
--- a/build/win32/gsettings-desktop-schemas-msvc.mak.in
+++ b/build/win32/gsettings-desktop-schemas-msvc.mak.in
@@ -33,7 +33,7 @@ ERRNUL  = 2>NUL
 _HASH=^#
 
 # Get the Full URI representation of the PREFIX
-!if ![echo PREFIX_URI= ^\> uri.x] \
+!if ![echo PREFIX_POSIX= ^\> uri.x] \
 && ![$(PYTHON) uri.py $(PREFIX) >> uri.x]
 !include uri.x
 !endif
@@ -57,9 +57,7 @@ all: $(gschemas) org.gnome.desktop.enums.xml
 .SUFFIXES: .xml.in .xml
 
 {..\..\schemas\}.xml.in{}.xml:
-       $(PYTHON) replace.py --action=replace-var --input=$< --output=$  tmp --var=GETTEXT_PACKAGE 
--outstring= GETTEXT_PACKAGE@
-       $(PYTHON) replace.py --action=replace-var --input=$  tmp --output=$@ --var=datadir 
--outstring=$(PREFIX_URI)/share
-       @-del $  tmp
+       $(PYTHON) genschema.py --input=$< --output=$@ --package= GETTEXT_PACKAGE@ --prefix=$(PREFIX_POSIX)
 
 org.gnome.desktop.enums.xml:
        $(PERL) $(PREFIX)\bin\glib-mkenums --comments "<!-- @comment@ -->"      \


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