Example #1
0
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
Example #2
0
def uploadSamba ( p , folder_path):
	#smb://192.168.10.44/root_home/CableBay/Nightly_build/15555/CableBay.apk'
	p.smb_addr = folder_path + p.name + '.apk'
	ctx.mkdir( folder_path, 755 )
	remote_file = ctx.open (p.smb_addr, os.O_CREAT | os.O_WRONLY)
	local_file = open(p.workspace_path + "bin/" + p.name + '.apk')
	remote_file.write(local_file.read())
	myprint ( 'upload '+ p.smb_addr + '...' )
Example #3
0
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()
Example #4
0
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	
Example #5
0
def sign( p ):
	command = "jarsigner -verbose -keystore " + p.keystore_path + " -signedjar "\
			+ p.workspace_path + "bin/" + p.name +".apk "\
			+ p.workspace_path + "bin/" + p.name + "_unsigned.apk " + " " + Constant.alias
                    
        #os.chdir(Constant.tmp_path)
        #command = "jarsigner -verbose -keystore " + p.keystore_path + "-sigfile CERT " \
        #            + "SHI11.apk" + " LISMO"
	p = subprocess.Popen(command + '|' + Constant.log_command, shell=True, stdin=subprocess.PIPE)
	p.communicate(Constant.password)[0]
        #os.rename("SHI11.apk", "SHI11_signed.apk")
	myprint( "singed complete" )
Example #6
0
def buildJava(p):
	java_list = ' '
	libs = ""
	pattern = '*.java'
	for root, dirs, files in os.walk( p.workspace_path):
		result = glob.glob(os.path.join(root, pattern))
		for f in result:
			java_list += f + " "

	pattern = '*.jar'
	for root, dirs, files in os.walk( p.workspace_path + "libs"):
		result = glob.glob(os.path.join(root, pattern))
		for f in result:
			libs += f + ":"
        
	if  p.name == Constant.CableBay:
		libs += Constant.google_map_libs
           
	command = "javac -bootclasspath " +  p.sdk_path + "android.jar -classpath " + libs + " -d "\
                 +  p.workspace_path + "bin  -Xlint:unchecked" + java_list
	myprint( command ) 
	subprocess.call(command + '|'+ Constant.log_command, shell=True)
Example #7
0
def sendEmail( email_list, plainText, subject):
	strFrom = myEmail
	strTo = email_list
	server = authInfo.get('server')
	user = authInfo.get('user')
	passwd = authInfo.get('password')

	if not (server and user and passwd) :
		myprint( 'incomplete login info, exit now' )
		return

	msgRoot = MIMEMultipart('related')
	msgRoot['Subject'] = subject
	msgRoot['From'] = strFrom
	msgRoot['To'] = ', '.join(email_list)
	msgRoot.preamble = 'This is a multi-part message in MIME format.'

    # Encapsulate the plain and HTML versions of the message body in an
    # 'alternative' part, so message agents can decide which they want to display.
	msgAlternative = MIMEMultipart('alternative')
	msgRoot.attach(msgAlternative)

	msgText = MIMEText(plainText, 'plain', 'utf-8')
	msgAlternative.attach(msgText)

        #msgText = MIMEText(htmlText, 'html', 'utf-8')
        #msgAlternative.attach(msgText)

        #fp = open('test.jpg', 'rb')
        #msgImage = MIMEImage(fp.read())
        #fp.close()
        #msgImage.add_header('Content-ID', '<image1>')
        #msgRoot.attach(msgImage)
	myprint ('sending Email...')
	smtp = smtplib.SMTP()
	smtp.set_debuglevel(1)
	smtp.connect(server)
	smtp.login(user, passwd)
	smtp.sendmail(strFrom, strTo, msgRoot.as_string())
	smtp.quit()
	myprint('Email has sent')