tracker r2806 - in trunk: . utils/services
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2806 - in trunk: . utils/services
- Date: Tue, 20 Jan 2009 10:51:43 +0000 (UTC)
Author: pvanhoof
Date: Tue Jan 20 10:51:43 2009
New Revision: 2806
URL: http://svn.gnome.org/viewvc/tracker?rev=2806&view=rev
Log:
2009-01-20 Philip Van Hoof <philip codeminded be>
* utils/services/service2xml.py: A tool to convert a .service file to
an XML file. Usage:
python utils/services/service2xml.py < data/services/service.service
Added:
trunk/utils/services/
trunk/utils/services/service2xml.py
Modified:
trunk/ChangeLog
Added: trunk/utils/services/service2xml.py
==============================================================================
--- (empty file)
+++ trunk/utils/services/service2xml.py Tue Jan 20 10:51:43 2009
@@ -0,0 +1,20 @@
+import ConfigParser, os
+import sys
+
+config = ConfigParser.ConfigParser()
+config.readfp(sys.stdin)
+
+for section in config.sections():
+ splitted = section.split (":")
+ print "<section prefix=\"" + splitted[0] + "\" name=\"" + splitted[1] + "\" fullname=\"" + section + "\">"
+ for name, value in config.items (section):
+ vsplit = value.split (":")
+ print "\t<item name=\""+ name + "\" fullvalue=\"" + value+ "\">"
+ if len (vsplit) > 1:
+ print "\t\t<prefix>" + vsplit[0] + "</prefix>"
+ print "\t\t<value>" + vsplit[1] + "</value>"
+ else:
+ print "\t\t<prefix />"
+ print "\t\t<value>" + value + "</value>"
+ print "\t</item>"
+ print "</section>"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]