summaryrefslogtreecommitdiffstats
path: root/rtemsqual/util.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-17 14:29:00 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-17 14:29:00 +0200
commit8230acb305029bd6f628244330a3be533649ba80 (patch)
treebd11ef777a4feee1e6dc2474c4a2201aa6349fe6 /rtemsqual/util.py
parentutil: New module (diff)
downloadrtems-central-8230acb305029bd6f628244330a3be533649ba80.tar.bz2
util: Add copy_files()
Diffstat (limited to 'rtemsqual/util.py')
-rw-r--r--rtemsqual/util.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/rtemsqual/util.py b/rtemsqual/util.py
index 2680b0ac..d2403cd3 100644
--- a/rtemsqual/util.py
+++ b/rtemsqual/util.py
@@ -25,10 +25,24 @@
# POSSIBILITY OF SUCH DAMAGE.
import os
-from typing import Any
+import shutil
+from typing import Any, List
import yaml
+def copy_files(src_dir: str, dst_dir: str, files: List[str]) -> None:
+ """
+ Copies a list of files in the source directory to the destination
+ directory preserving the directory of the files relative to the source
+ directory.
+ """
+ for a_file in files:
+ src = os.path.join(src_dir, a_file)
+ dst = os.path.join(dst_dir, a_file)
+ os.makedirs(os.path.dirname(dst), exist_ok=True)
+ shutil.copy2(src, dst)
+
+
def load_config(config_filename: str) -> Any:
""" Loads the configuration file with recursive includes. """
class IncludeLoader(yaml.SafeLoader): # pylint: disable=too-many-ancestors