#!/usr/bin/env python3 import json import os import sys import configparser from provider import getDefaultProviders from provider import getProviderData VERSION = os.environ.get('VERSION', 'unknown') SCRIPT = 'generate-debian.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 = getDefaultProviders(config)[0] data = getProviderData(provider, config) if len(sys.argv) != 2: print('Usage: {} '.format(SCRIPT)) sys.exit(1) outputf = sys.argv[1] data['version'] = VERSION writeOutput(data, outputf)