make the compression algorithm explicit
This commit is contained in:
parent
8e04d527f1
commit
36f20b3e48
1 changed files with 9 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue