make the compression algorithm explicit

This commit is contained in:
Sehny 2019-07-16 08:33:42 +02:00 committed by Tom Gundersen
parent 8e04d527f1
commit 36f20b3e48

View file

@ -4,10 +4,18 @@ import json
import subprocess
import sys
def main(tree, output_dir, options):
filename = options["filename"]
compression = options["compression"]
if compression not in {"bzip2", "xz", "lzip", "lzma", "lzop", "gzip"}:
return 1
subprocess.run(["tar", f"--{compression}", "-cf", f"{output_dir}/{filename}", "-C", tree, "."],
stdout=subprocess.DEVNULL, check=True)
return 0
subprocess.run(["tar", "--auto-compress", "-cf", f"{output_dir}/{filename}", "-C", tree, "."], stdout=subprocess.DEVNULL, check=True)
if __name__ == '__main__':
args = json.load(sys.stdin)