blob: a57334242ccc85dfed5e38f8f28c1b29fa7fabda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env python3
import argparse
import os
import shutil
prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument('dirname')
parser.add_argument('files', nargs='+')
parser.add_argument('--mode', action='store', default='create', choices=['create', 'copy'])
args = parser.parse_args()
dirname = os.path.join(prefix, args.dirname)
if not os.path.exists(dirname):
os.makedirs(dirname)
if args.mode == 'create':
for name in args.files:
with open(os.path.join(dirname, name), 'w') as f:
f.write('')
else:
for name in args.files:
shutil.copy(name, dirname)
if __name__ == "__main__":
main()
|