(from_, to_abs, to_rel)
| 1098 | record = _Record() |
| 1099 | |
| 1100 | def add_file(from_, to_abs, to_rel): |
| 1101 | os.makedirs( os.path.dirname( to_abs), exist_ok=True) |
| 1102 | if isinstance(from_, bytes): |
| 1103 | log2(f'Copying content into {to_abs}.') |
| 1104 | with open(to_abs, 'wb') as f: |
| 1105 | f.write(from_) |
| 1106 | record.add_content(from_, to_rel) |
| 1107 | else: |
| 1108 | log0(f'{from_=}') |
| 1109 | log2(f'Copying from {os.path.relpath(from_, self.root)} to {to_abs}') |
| 1110 | shutil.copy2( from_, to_abs) |
| 1111 | record.add_file(from_, to_rel) |
| 1112 | |
| 1113 | def add_str(content, to_abs, to_rel): |
| 1114 | log2( f'Writing to: {to_abs}') |
no test coverage detected