Changeset 8230acb in rtems-central
- Timestamp:
- Apr 17, 2020, 12:29:00 PM (9 months ago)
- Branches:
- master
- Children:
- a4e08c5
- Parents:
- 4733ad3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
rtems_spec_to_x.py
r4733ad3 r8230acb 27 27 28 28 import os 29 import shutil30 29 import string 31 30 import subprocess … … 57 56 source_dir = config["source-directory"] 58 57 workspace_dir = config["workspace-directory"] 59 for a_file in files: 60 src = os.path.join(source_dir, a_file) 61 dst = os.path.join(workspace_dir, a_file) 62 os.makedirs(os.path.dirname(dst), exist_ok=True) 63 shutil.copy2(src, dst) 58 rtemsqual.util.copy_files(source_dir, workspace_dir, files) 64 59 with open(os.path.join(workspace_dir, "config.ini"), "w") as config_ini: 65 60 content = string.Template(config["config-ini"]).substitute(config) -
rtemsqual/tests/test_util.py
r4733ad3 r8230acb 27 27 import os 28 28 29 from rtemsqual.util import load_config 29 from rtemsqual.util import copy_files, load_config 30 31 32 def test_copy_files(tmpdir): 33 src_dir = os.path.dirname(__file__) 34 copy_files(src_dir, tmpdir, []) 35 filename = "config/c/d.yml" 36 assert not os.path.exists(os.path.join(tmpdir, filename)) 37 copy_files(src_dir, tmpdir, [filename]) 38 assert os.path.exists(os.path.join(tmpdir, filename)) 30 39 31 40 -
rtemsqual/util.py
r4733ad3 r8230acb 26 26 27 27 import os 28 from typing import Any 28 import shutil 29 from typing import Any, List 29 30 import yaml 31 32 33 def copy_files(src_dir: str, dst_dir: str, files: List[str]) -> None: 34 """ 35 Copies a list of files in the source directory to the destination 36 directory preserving the directory of the files relative to the source 37 directory. 38 """ 39 for a_file in files: 40 src = os.path.join(src_dir, a_file) 41 dst = os.path.join(dst_dir, a_file) 42 os.makedirs(os.path.dirname(dst), exist_ok=True) 43 shutil.copy2(src, dst) 30 44 31 45
Note: See TracChangeset
for help on using the changeset viewer.