summaryrefslogtreecommitdiff
path: root/branding/templates/snap/generate.py
blob: 41d563dcbe68874d50240386466e9f8271d191c2 (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
#!/usr/bin/env python3
"""
generate.py

Generate a snap package for a given provider.
"""

import json
import os
from string import Template


TEMPLATE = 'snapcraft-template.yaml'
SNAPCRAFT = 'snapcraft.yaml'


here = os.path.split(os.path.realpath(__file__))[0]
data = json.load(open(os.path.join(here, 'data.json')))


template = Template(open(TEMPLATE).read())

with open(SNAPCRAFT, 'w') as output:
    output.write(template.safe_substitute(data))

print("[+] Snapcraft spec written to {path}".format(
    path=os.path.abspath(SNAPCRAFT)))