forked from mskcc/roslin-variant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompress.py
53 lines (35 loc) · 1.02 KB
/
compress.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import sys
import subprocess
import yaml
def get_config():
"read config.yaml into the yaml object and return it"
with open("config.yaml", "r") as file_handle:
return yaml.load(file_handle.read())
def compress(output_filename):
"compress"
cmd = [
"tar",
"--exclude", ".DS_Store",
"--exclude", "./setup/config/*.template.sh",
"-cvzf", output_filename,
"./setup"
]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
return stdout, stderr, process.returncode
def main():
"main function"
config = get_config()
pipeline_name = config["name"]
pipeline_version = config["version"]
output_filename = "roslin-{}-pipeline-v{}.tgz".format(
pipeline_name,
pipeline_version
)
stdout, stderr, exit_code = compress(output_filename)
print stdout
print stderr
sys.exit(exit_code)
if __name__ == "__main__":
main()