-
Notifications
You must be signed in to change notification settings - Fork 0
/
Init.py
67 lines (54 loc) · 1.56 KB
/
Init.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
'''
Created on 2011-7-19
@author: zheng
'''
import Constant
import os, sys
from Project import Project
from Utils import myprint
import subprocess
def init_choice(numOfArgv):
if ( numOfArgv < 0):
myprint( 'There is no argument, system exit' )
exit()
elif ( numOfArgv == 1 ):
project = ask()
elif ( numOfArgv == 3):
project = newProject(sys.argv[1])
init_build_method(sys.argv[2], project)
return project
def init_build_method( choice, p):
if ( choice == '--nightly' or choice == '1' ):
p.build_method = Constant.build_nightly
elif ( choice =='--release' or choice == '2' ):
p.build_method = Constant.build_release
elif ( choice =='--verify' or choice == '3'):
p.build_method = Constant.build_verify
else :
myprint( 'no such project build method, system exit' )
exit()
def ask():
choice = raw_input('Which project u want to sync: \n \
1. '+Constant.CableBay+'\n==>Please enter the number to cotinue: \n')
#ask for which commit to build
project = newProject( choice )
choice = raw_input('Which kind of build method u want to do:\n \
1. nightly\n \
2. release\n \
3. verify\n==>Please enter the number to cotinue: \n')
init_build_method( choice, project )
return project
def newProject( choice ):
if ( choice == '1' or choice == 'cablebay') :
project = Project()
project.name = Constant.CableBay
else :
myprint( 'no such project, system exit' )
exit()
return project
def system_init():
os.putenv('PATH', "/usr/bin:/bin:" + Constant.bin_path)
#init the log file
fd = open(Constant.log_path, 'w')
fd.write( '' )
fd.close()