summaryrefslogtreecommitdiff
path: root/upstream/tools/xmlGenerator/PFWScriptGenerator.py
diff options
context:
space:
mode:
Diffstat (limited to 'upstream/tools/xmlGenerator/PFWScriptGenerator.py')
-rwxr-xr-xupstream/tools/xmlGenerator/PFWScriptGenerator.py37
1 files changed, 17 insertions, 20 deletions
diff --git a/upstream/tools/xmlGenerator/PFWScriptGenerator.py b/upstream/tools/xmlGenerator/PFWScriptGenerator.py
index d047972..145295d 100755
--- a/upstream/tools/xmlGenerator/PFWScriptGenerator.py
+++ b/upstream/tools/xmlGenerator/PFWScriptGenerator.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/python2
# Copyright (c) 2015, Intel Corporation
# All rights reserved.
@@ -28,13 +28,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import EddParser
+from PfwBaseTranslator import PfwBaseTranslator
import argparse
import sys
-import EddParser
-from PfwBaseTranslator import PfwBaseTranslator
-
class PfwScriptTranslator(PfwBaseTranslator):
def __init__(self):
@@ -67,10 +66,9 @@ class PfwScriptTranslator(PfwBaseTranslator):
self._appendCommand("setRule", self._ctx_domain, self._ctx_configuration, rule)
def _doSetParameter(self, path, value):
- self._appendCommand("setConfigurationParameter", self._ctx_domain, self._ctx_configuration,
- path, value)
+ self._appendCommand("setConfigurationParameter", self._ctx_domain, self._ctx_configuration, path, value)
-class ArgparseArgumentParser(object):
+class ArgparseArgumentParser(object) :
"""class that parse command line arguments with argparse library
result of parsing are the class atributs"""
@@ -79,22 +77,21 @@ class ArgparseArgumentParser(object):
myArgParser = argparse.ArgumentParser(description='Process domain scripts.')
myArgParser.add_argument('input', nargs='?',
- type=argparse.FileType('r'), default=sys.stdin,
- help="the domain script file, default stdin")
+ type=argparse.FileType('r'), default=sys.stdin,
+ help="the domain script file, default stdin")
myArgParser.add_argument('-o', '--output',
- type=argparse.FileType('w'), default=sys.stdout,
- help="the output file, default stdout")
+ type=argparse.FileType('w'), default=sys.stdout,
+ help="the output file, default stdout")
myArgParser.add_argument('-d', '--debug',
- action='store_true',
- help="print debug warnings")
+ action='store_true',
+ help="print debug warnings")
myArgParser.add_argument('--output-kind',
- choices=['pfw', 'raw'],
- default='pfw',
- help="output kind; can be either 'raw' (debug only) or 'pfw' \
- (pfw commands; default choice)")
+ choices=['pfw', 'raw'],
+ default='pfw',
+ help="output kind; can be either 'raw' (debug only) or 'pfw' (pfw commands; default choice)")
# process command line arguments
@@ -117,7 +114,7 @@ def printE(s):
"""print in stderr"""
sys.stderr.write(str(s))
-def main():
+def main ():
options = ArgparseArgumentParser()
@@ -136,7 +133,7 @@ def main():
try:
myroot.propagate()
- except EddParser.MyPropagationError as ex:
+ except EddParser.MyPropagationError as ex :
printE(ex)
printE("EXIT ON FAILURE")
exit(1)
@@ -147,6 +144,6 @@ def main():
options.output.write("\n".join(translator.getScript()))
# execute main function if the python interpreter is running this module as the main program
-if __name__ == "__main__":
+if __name__ == "__main__" :
main()