Commit f5c9cff4 authored by Willi Rath's avatar Willi Rath

Always unlink util before copying

parent b60e4fb2
......@@ -615,6 +615,7 @@ def cli_run_renderer(argvec=None):
try:
f.unlink()
except Exception as e:
logger.debug("failed to unlink {} with: {}".format(f, e))
pass
_unlink_files([update_script, init_script, readme_file])
......@@ -651,12 +652,20 @@ def cli_run_renderer(argvec=None):
try:
shutil.copy(str(yaml_file), str(prefix / "meta.yaml"))
except shutil.SameFileError as e:
logger.debug("failed to copy `meta.yaml` with: {}".format(e))
pass
# copy util scripts (if any)
# copy util scripts (if any): First, remove targed util, and then copy
# source util directory.
try:
shutil.rmtree(str(util_dst))
except Exception as e:
logger.debug("failed to unlink {} with: {}".format(util_dst, e))
pass
shutil.copytree(str(util_src), str(util_dst))
except Exception as e:
logger.debug("failed to copy {} to {} with: {}".format(
util_src, util_dst, e))
pass
# make scripts executable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment