-
Notifications
You must be signed in to change notification settings - Fork 0
/
sp
executable file
·27 lines (27 loc) · 1.03 KB
/
sp
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/python
def main():
from optparse import OptionParser
import sys, logging
sys.path.append("/dk/work/sweetpotato")
from sweetpotato.core import Task, SweetPotato
usage = "%prog [options] target"
parser = OptionParser(usage=usage, version="sweetpotato 0.0.1")
parser.add_option("-f","--file",default="plan.yaml",
help="build file [default: %default]")
parser.add_option("-l","--list", action="store_true", help="list targets")
parser.add_option("-a","--list-all", action="store_true", help="list all targets")
parser.add_option("-T",dest="tokens", metavar="TOKEN=VALUE", action="append",
help="set build token")
parser.add_option("-L","--log-level", type="choice",
help="error, warning, info [default], debug",
choices=['error','warning','info','debug'],
default='info')
(options, args) = parser.parse_args()
if 1 > len(args):
parser.error("target missing")
sweetpotato = SweetPotato(options)
for target in args:
sweetpotato.run(target)
sweetpotato.log('PLAN FINISHED\n')
if "__main__" == __name__:
main()