X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=scripts%2Fjcopy.py;h=ac8950877c57a87bc3cb8bd2ab9814e598ab2215;hb=refs%2Fchanges%2F69%2F369%2F1;hp=fb3f21ec7dc9cf38d44c9012d3acc3b8b4400295;hpb=d743ec6c91f97cc9f5b944a8d0a609883440b14e;p=yaml_builds.git diff --git a/scripts/jcopy.py b/scripts/jcopy.py index fb3f21e..ac89508 100755 --- a/scripts/jcopy.py +++ b/scripts/jcopy.py @@ -1,6 +1,6 @@ #!/usr/bin/python ############################################################################## -# Copyright © 2018 AT&T Intellectual Property. All rights reserved. # +# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. # @@ -55,22 +55,21 @@ def expand_files(target_dir, dir_name, files): print '{0} -> {1}'.format(source_path, target_path) total += 1 -def expand_file(target_dir, file): +def expand_file(target_file, file): global total - if not os.path.exists(target_dir): - os.makedirs(target_dir) + if not os.path.exists(os.path.dirname(target_file)): + os.makedirs(os.path.dirname(target_file)) env = jinja2.Environment() env.trim_blocks = True env.lstrip_blocks = True with open(file) as fd: template = env.from_string(fd.read()) data = template.render(yaml=yaml) - target_path = target_dir + '/' + os.path.basename(file) - fd2 = open(target_path,'w') + fd2 = open(target_file,'w') fd2.write(data) fd2.write("\n") fd2.close() - print '{0} -> {1}'.format(file, target_path) + print '{0} -> {1}'.format(file, target_file) total += 1 if len(sys.argv) != 4: