Exemplo n.º 1
0
def main():
	global num_min, num_max, same, active, total, out, name_arra

	printf.reset()
	time.push(os.path.abspath(__file__))

	printf.status("write file ...")
	fp = open(out, 'w')

	random.seed()
	for i in range(total):
		name = str(random.randrange(num_min, num_max))
		if name in name_array:
			same  = same + 1
			printf.status("same: " + name)
		else:
			active = active + 1
			name_array.append("\"" + str(name) + "@qq.com" + "\"")
	printf.status("same:   "  + str(same))
	printf.status("active: "  + str(active))
	printf.status("total:  " + str(total))
	printf.status("len(name_array): " + str(len(name_array)))

	fp.write("array_len  = " + str(active) + "\n")
	fp.write("name_array = [\n")
	for i in range(len(name_array)):
		fp.write(name_array[i] + ",")
		if((i+1)%16 == 0):
			fp.write("\n")
	fp.write("]\n")

	fp.close()
	time.pop()
	sys.exit(0)
Exemplo n.º 2
0
def main():
	# start send
	printf.reset()
	
	time.push(os.path.abspath(__file__))

	# loop send mail
	current = 0
	scnt    = 0
	fcnt    = 0
	onetime = 16
	cmd.do("rm -f number.py*")
	cmd.do("random_number.py")
	fp = open("send_done", 'w')
	fp.close()
	import number
	maxcnt  = number.array_len/onetime
	while 1:
		if scnt > maxcnt:
			break
		pos0 = scnt * onetime
		pos1 = pos0 + onetime
		if pos1 > number.array_len:
			pos1 = number.array_len
		send.to      = number.name_array[pos0:pos1]
		send.me      = data.me[current]
		send.pwd     = data.pwd
		send.smtp    = data.smtp[current]
		send.port    = data.port[current]
		send.subject = data.subject
		send.info    = data.info
		printf.status(data.me[current])
		try:
			send.send()
			scnt = scnt + 1
			printf.status("sucess to send - " + str(scnt))
			printf.status("fail to send - " + str(fcnt))
			fp = open("send_done", 'a')
			fp.write(str(scnt) + " - " + str(send.to) + "\n")
			fp.close()
		except:
			fcnt = fcnt + 1
			current = current + 1  # change email user name
			if current >= len(data.me):
				current = 0 # again
			printf.warn("sucess to send - " + str(scnt))
			printf.warn("fail to send - " + str(fcnt))
			systime.sleep(3)

	# end send
	fp.close()
	time.pop()
	printf.silence("send done.")

	sys.exit(0)
Exemplo n.º 3
0
def main():

	# start patch
	time.push(os.path.abspath(__file__))

	# check out the project
	check_repos.check_args = arg.check_args()
	ini = os.getcwd() + "/" + check_repos.check_args['-f']
	check_repos.check_out(ini)

	# end patch
	time.pop()
	printf.silence("check out done.")
	sys.exit(0)
Exemplo n.º 4
0
def main():
	# start links
	printf.reset()
	time.push(os.path.abspath(__file__))
	links_args = arg.links_args()
	
	# Judge source folder
	if not os.path.isdir(links_args['-s']):
		printf.error("No a dir - " + links_args['-s'])
	if not os.path.isdir(links_args['-d']):
		cmd.do("mkdir -p " + links_args['-d'])
	links_args['-s'] = os.path.abspath(links_args['-s'])

	# create folder and link for file
	printf.status("links ...")
	for root, dirs, files in os.walk(links_args['-s']):		
		# set filter
		if '.git' in dirs:
			dirs.remove('.git')  # don't visit .git directories
		if '.svn' in dirs:
			dirs.remove('.svn')  # don't visit .svn directories

		# Create folder
		current_folder = root.replace(links_args['-s'], "")
		new_folder     = links_args['-d'] + "/" + current_folder
		cmd_mkdir = "mkdir -p " + "\"" + new_folder + "\""
		os.system(cmd_mkdir)
		sys.stdout.write('\r' + current_folder)
		sys.stdout.flush()
		#print "\r\n", cmd_mkdir
		#raw_input("Press ENTER to exit")

		# link for files
		for f in files:
			source_file = "\"" + root       + "/" + f + "\""
			link_file   = "\"" + new_folder + "/" + f + "\""
			cmd_ln = "ln -sf " + source_file + " " + link_file
			os.system(cmd_ln)
			#print "\r\n", cmd_ln
		size = len(current_folder)
		sys.stdout.write('\r' + ' '*size)
		sys.stdout.flush()

	# done.
	print ""
	printf.status("links done.")

	# end links
	time.pop()
	sys.exit(0)
Exemplo n.º 5
0
def main():

	# start check
	printf.reset()
	time.push(os.path.abspath(__file__))

	# check out the project
	check_repos.check_args = arg.check_args()
	ini = check_repos.check_args['-f']
	check_repos.check_out(ini)

	# end check
	time.pop()
	printf.silence("check out done.")
	sys.exit(0)
Exemplo n.º 6
0
def main():

	# start patch
	time.push(os.path.abspath(__file__))

	# patch the project
	patch_repos.patch_args = arg.patch_args()
	ini = os.getcwd() + "/" + patch_repos.patch_args['-f']
	build_ini.parse(ini)
	patch_repos.do_patch()

	# end patch
	time.pop()
	printf.silence("patch done.")
	sys.exit(0)
Exemplo n.º 7
0
def main():

	# start upload
	printf.reset()
	time.push(os.path.abspath(__file__))

	# check out the project
	upload_repos.upload_args = arg.upload_args()
	ini = upload_repos.upload_args['-f']
	upload_repos.upload(ini)

	# end upload
	time.pop()
	printf.silence("upload done.")
	sys.exit(0)
Exemplo n.º 8
0
def main():
	# start build
	printf.reset()
	time.push(os.path.abspath(__file__))

	# build the project
	make.build_args  = arg.build_args()
	ini = os.getcwd() + "/" + glb.build_ini
	build_ini.parse(ini)
	make.do_makes()

	# end build
	time.pop()
	printf.silence("build done.")
	sys.exit(0)
Exemplo n.º 9
0
def main():
	# start build
	printf.reset()
	time.push(os.path.abspath(__file__))

	# build the project
	make.build_args  = arg.build_args()
	if make.build_args['-f'] == '':
		ini = os.getcwd() + "/" + glb.build_ini
	else:
		ini = make.build_args['-f']
	build_ini.parse(ini)
	make.do_makes()

	# end build
	time.pop()
	printf.silence("[" + str(datetime.now()) + "]: build done.")
	sys.exit(0)