aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xmlGenerator/hostConfig.py
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2015-01-29 10:36:23 +0100
committerDavid Wagner <david.wagner@intel.com>2015-01-29 10:36:23 +0100
commit8526bbf8774b9751904703358d6b5efab5efa530 (patch)
treef90db6c0fdd05ea246432b7e36a1c12345b825be /tools/xmlGenerator/hostConfig.py
parent23e217c5edc47e08bd44222a2df0d3a876d3aeec (diff)
parent708d1166897a1f2678273d2febbfa8b2d36f9bc4 (diff)
downloadexternal_parameter-framework-8526bbf8774b9751904703358d6b5efab5efa530.zip
external_parameter-framework-8526bbf8774b9751904703358d6b5efab5efa530.tar.gz
external_parameter-framework-8526bbf8774b9751904703358d6b5efab5efa530.tar.bz2
Merge pull request #38 from dawagner/python-bindings
Python bindings and new EDD -> XML generator using these bindings
Diffstat (limited to 'tools/xmlGenerator/hostConfig.py')
-rwxr-xr-xtools/xmlGenerator/hostConfig.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/xmlGenerator/hostConfig.py b/tools/xmlGenerator/hostConfig.py
index c8ec3ac..871f8f2 100755
--- a/tools/xmlGenerator/hostConfig.py
+++ b/tools/xmlGenerator/hostConfig.py
@@ -32,19 +32,17 @@
import xml.dom.minidom
import sys
-serverPort=sys.argv[1]
-structPath=sys.argv[2]
-
-def main():
+def configure(infile=sys.stdin, outfile=sys.stdout, serverPort=None, structPath=None):
""" Format an xml PFW config file (standard input) for simulation.
- Allow tuning on argv[1] port, remove the plugins and settings need,
+ Allow tuning on @serverPort port, remove the plugins and settings need,
and change the structure path to absolute."""
- dom = xml.dom.minidom.parse(sys.stdin)
+ dom = xml.dom.minidom.parse(infile)
for node in dom.getElementsByTagName("ParameterFrameworkConfiguration"):
- node.setAttribute("ServerPort", serverPort)
+ if serverPort is not None:
+ node.setAttribute("ServerPort", serverPort)
node.setAttribute("TuningAllowed", "true")
def delete(tag):
@@ -53,12 +51,14 @@ def main():
delete("Location")
delete("SettingsConfiguration")
- for node in dom.getElementsByTagName("StructureDescriptionFileLocation"):
- node.setAttribute("Path", structPath + "/" + node.getAttribute("Path"))
+ if structPath is not None:
+ for node in dom.getElementsByTagName("StructureDescriptionFileLocation"):
+ node.setAttribute("Path", structPath + "/" + node.getAttribute("Path"))
- sys.stdout.write(dom.toxml())
+ outfile.write(dom.toxml())
if __name__ == "__main__" :
""" Execute main if the python interpreter is running this module as the main program """
- main()
+
+ configure(serverPort=sys.argv[1], structPath=sys.argv[2])