From: Claire Xenia Wolf Date: Sun, 31 Oct 2021 13:43:02 +0000 (+0100) Subject: Add support for directories in [files] section X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5d19e4641a4151058df8cc7d488cc60ff0849d99;p=SymbiYosys.git Add support for directories in [files] section Signed-off-by: Claire Xenia Wolf --- diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index 979be6f..78220e5 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -20,7 +20,7 @@ import os, re, sys, signal if os.name == "posix": import resource, fcntl import subprocess -from shutil import copyfile, rmtree +from shutil import copyfile, copytree, rmtree from select import select from time import time, localtime, sleep @@ -332,7 +332,10 @@ class SbyJob: os.makedirs(basedir) self.log(f"Copy '{os.path.abspath(srcfile)}' to '{os.path.abspath(dstfile)}'.") - copyfile(srcfile, dstfile) + if os.path.isdir(srcfile): + copytree(srcfile, dstfile, dirs_exist_ok=True) + else: + copyfile(srcfile, dstfile) def handle_str_option(self, option_name, default_value): if option_name in self.options: