From 22f8389f067df502f499de4413bbd3ec69f14b20 Mon Sep 17 00:00:00 2001 From: Bob Fournier Date: Thu, 27 Sep 2018 09:57:29 -0400 Subject: [PATCH] In process-templates script write output files to provided dir when using base path When running the process-templates script with both the -o OUTPUT_DIR and -p BASE_PATH options the output files were not being written to the output directory. This fix splits out the file path from the base path to properly write the files. Change-Id: I845e8a2cbd2b12a4a1552b2cfa3ac013466da6bd Closes-Bug: #1794769 (cherry picked from commit 47f47c1deaca950bb45babb5c0bb799897273413) --- tools/process-templates.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/process-templates.py b/tools/process-templates.py index 39622864d3..d19eacaaaa 100755 --- a/tools/process-templates.py +++ b/tools/process-templates.py @@ -150,7 +150,11 @@ def process_templates(template_path, role_data_path, output_dir, # the command multiple times with the same output_dir. out_dir = subdir if output_dir: - out_dir = os.path.join(output_dir, subdir) + if template_path != '.': + # strip out base path if not default + temp = out_dir.split(template_path)[1] + out_dir = temp[1:] if temp.startswith('/') else temp + out_dir = os.path.join(output_dir, out_dir) if not os.path.exists(out_dir): os.mkdir(out_dir)