forked from Xilinx/Containerization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
containerize.py
executable file
·39 lines (30 loc) · 992 Bytes
/
containerize.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
#!/usr/bin/env python
import json
import subprocess
import os
import sys
import shutil, errno
def print_help():
print("usage: ./nimbixlize.py [-h] [-q]")
print("")
print("optional arguments:")
print(" -h, --help show this help message and exit")
print(" -q, --quiet only print error messages on stdout")
support_vendors = ['nimbix', 'on_premise']
argvs = sys.argv[1:]
isQuiet = False
for argv in argvs:
if argv == "-q" or argv == "--quiet":
isQuiet = True
elif argv == "-h" or argv == "--help":
print_help()
exit(0)
with open('config.json') as d:
repos = json.load(d)
vendor = repos['vendor']
if vendor not in support_vendors:
sys.exit("Vendor is NOT supported! Support Vendors: " + ", ".join(support_vendors))
if isQuiet:
subprocess.check_output("./" + vendor + ".py", stderr=subprocess.STDOUT, shell=True)
else:
subprocess.call("./" + vendor + ".py", stderr=subprocess.STDOUT, shell=True)