-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
executable file
·78 lines (62 loc) · 1.94 KB
/
build.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
import argparse
import logging
import nxsd
from nxsd.package import NXSDPackage
from nxsd.components import atmosphere
from nxsd.components import hekate
from nxsd.components import homebrew
from nxsd.components import sigpatches
from nxsd.components import checkpoint
def main():
commands = {
'build': build,
'clean': clean,
}
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='store_true',
help='enable verbose logging output to log/build.log')
parser.add_argument('command', nargs='?', default='build',
choices=commands.keys(),
help='build command to execute. options: build, clean (default: build)')
args = parser.parse_args()
if args.verbose:
nxsd.logger.setLevel(logging.DEBUG)
nxsd.logger.debug('Verbose logging enabled.')
commands[args.command](args)
def build(args):
packages = get_packages()
for package in packages:
if package.build_components():
nxsd.logger.info('Created {name} package!'.format(name=package.name))
else:
nxsd.logger.info('Failed to create {name} package! Check build.log for details.'.format(name=package.name))
def clean(args):
packages = get_packages()
for package in packages:
package.clean()
nxsd.logger.info('Cleaned {name} package!'.format(name=package.name))
pass
def get_packages():
nxsd_core = NXSDPackage(
name='nxsd-core',
build_directory='build/core/',
output_filename='nx-sd.zip',
)
nxsd_core.components = [
atmosphere,
hekate,
homebrew,
sigpatches,
]
nxsd_addon = NXSDPackage(
name='nxsd-addon',
build_directory='build/addon/',
output_filename='nx-sd-addon.zip',
)
nxsd_addon.components = [
checkpoint,
]
return [nxsd_core, nxsd_addon]
if __name__ == '__main__':
main()