blob: 7d684966bda0052639daeed9aeff083393ae122d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
from pathlib import Path
from os.path import join
def add_files_recursive(files, root, common={}, target_root="/", files_root=None):
if files_root == None:
files_root = root
for p in Path(root).rglob("**/*"):
if not p.is_dir():
rel = str(p.relative_to(files_root))
key = join(target_root, rel)
files[key] = (files[key] if key in files else {}) | common | {
"source": rel,
}
|