[CRIU] [PATCH yoda] Add --dir-c, --dir-h options

Cyrill Gorcunov gorcunov at gmail.com
Fri May 31 08:19:32 EDT 2013


We need source/headers files are to be placed
in controllable paths.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 yoda.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/yoda.py b/yoda.py
index 3a77920..3ca15aa 100644
--- a/yoda.py
+++ b/yoda.py
@@ -43,6 +43,8 @@ arg_parser = argparse.ArgumentParser()
 arg_parser.add_argument("-f", "--file", required=True, help="yoda file to parse", type=str)
 arg_parser.add_argument("-n", "--name", required=True, help="project name", type=str)
 arg_parser.add_argument("-d", "--dir", default="./", help="templates directory", type=str)
+arg_parser.add_argument("--dir-c", default="./", help="generated *.c files directory", type=str)
+arg_parser.add_argument("--dir-h", default="./", help="generated *.h files directory", type=str)
 arg_opts = arg_parser.parse_args()
 
 if arg_opts.file == None or arg_opts.name == None:
@@ -312,7 +314,7 @@ for yopt in yopts:
 yincode = yincode.replace("${CHOICES}", yopt_str)
 
 # Commit the code into .h file
-youtfile = open(yname + "_yopts.h", "w")
+youtfile = open(os.path.join(arg_opts.dir_h, yname + "_yopts.h"), "w")
 youtfile.write(yincode)
 yinfile.close()
 youtfile.close()
@@ -742,7 +744,7 @@ for group in yopts_groups:
 yincode = yincode.replace("${USAGE}", yopt_str)
 
 # Commit the code into .c file
-youtfile = open(yname + "_yopts.c", "w")
+youtfile = open(os.path.join(arg_opts.dir_c, yname + "_yopts.c"), "w")
 youtfile.write(yincode)
 
 yinfile.close()
-- 
1.8.1.4



More information about the CRIU mailing list