blob: 8760e5eee90503c0d9b94855cd5d1e49ad4ed813 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import argparse
import os
import tarfile
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--input', nargs='*', required=True)
parser.add_argument('--output', required=True)
parser.add_argument('--prefix', required=True)
return parser.parse_args()
def main():
args = parse_args()
with tarfile.open(args.output, 'w') as out:
for f in args.input:
out.add(f, arcname=os.path.relpath(f, args.prefix))
if __name__ == '__main__':
main()
|