blob: 3271d9e9c1964728dcc9adfa7dd06cbbd621fa68 (
plain)
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
|
#!/usr/bin/env python3
import json
import os
import sys
import configparser
from provider import getDefaultProvider
from provider import getProviderData
VERSION = os.environ.get('VERSION', 'unknown')
SCRIPT = 'generate-snap.py'
def writeOutput(data, outfile):
with open(outfile, 'w') as outf:
outf.write(json.dumps(data))
if __name__ == "__main__":
VENDOR_PATH = os.environ.get('VENDOR_PATH')
configFile = os.path.join(VENDOR_PATH, 'vendor.conf')
config = configparser.ConfigParser()
config.read(configFile)
provider = getDefaultProvider(config)
data = getProviderData(provider, config)
if len(sys.argv) != 2:
print('Usage: {} <output_file>'.format(SCRIPT))
sys.exit(1)
outputf = sys.argv[1]
data['version'] = VERSION
writeOutput(data, outputf)
|