Exemplo n.º 1
0
def make_run_compile(executableName, executableInputList, resultFolderName, resultFileName, CBuildFolder, operandSampleFileName, bench_suit_name, process_id, settings_obj, input_list):
    if (bench_suit_name == "my_micro_benchmark"): 
        #validating the number of inputs
        #validating the existance of the dir, and making it other wise
        if not os.path.isdir(resultFolderName): 
            print "the folderName provided does not correspond to any existing folder. I will be making it"

            os.system("mkdir " + resultFolderName);
        
        if not os.path.isfile(operandSampleFileName):
            print "the operandSampleFileName:" + operandSampleFileName + " does not exist"
            exit()


        currentDir = os.getcwd() #getting the current directory
        #CBuildFolder = "./../../Debug" 
        os.chdir(CBuildFolder) #chaning the directory
        make.make()
        if (settings_obj.runMode == "parallel"): 
            run.run(executableName, resultFolderName, resultFileName, settings_obj.operatorSampleFileName+str(process_id)+ ".txt", operandSampleFileName)
        else:
            run.run(executableName, resultFolderName, resultFileName, settings_obj.operatorSampleFileName+"0.txt", operandSampleFileName)
        os.chdir(currentDir) #chaning the directory
    elif (bench_suit_name == "sd-vbs"): 
        currentDir = os.getcwd() #getting the current directory
        os.chdir(CBuildFolder) #chaning the directory
        os.system("pwd"); 
        #os.system("gdb --args ./sift ~/behzad_local/sd-vbs/benchmarks/sift/data/sim");
        if (settings_obj.runMode == "parallel"): 
            os.system("gmake c-run-compile " + "exe_annex="+str(process_id) + " first_input="+input_list[0] + " second_input="+input_list[1])
        else:  
            os.system("gmake c-run-compile " + "exe_annex="+str(0) + " first_input="+input_list[0] + " second_input="+input_list[1])
        os.chdir(currentDir) #chaning the directory
Exemplo n.º 2
0
    def __call__(self):
        # TODO: Exception safety
        self.log.write('updating from repository... ')
        starttime = datetime.datetime.now()
        git.reset(self.revision)
        timedelta = datetime.datetime.now() - starttime
        self.log.write('done. (took ' + str(total_seconds(timedelta)) +
                       's) \n')

        # Build the documentation
        self.log.write('building docs... ')
        starttime = datetime.datetime.now()
        make.make('docs')
        make.run('docs')
        timedelta = datetime.datetime.now() - starttime
        self.log.write('done. (took ' + str(total_seconds(timedelta)) +
                       's) \n')
        git.reset('master')  # Revert possible modifications to .po files

        username = '******'
        passwd = open('../passwd/docs.txt', 'r').read().strip()
        ftphost = FTPHostFix.connect('ftp.openclonk.org',
                                     user=username,
                                     password=passwd)

        # upload to /new
        self.log.write('uploading new docs... \n')
        starttime = datetime.datetime.now()
        self.__upload_new_files(ftphost)
        timedelta = datetime.datetime.now() - starttime
        self.log.write('done. (took ' + str(total_seconds(timedelta)) +
                       's) \n')

        # copy script files over to /new
        self.log.write('copying script files... \n')
        starttime = datetime.datetime.now()
        self.__copy_old_script_files(ftphost)
        timedelta = datetime.datetime.now() - starttime
        self.log.write('done. (took ' + str(total_seconds(timedelta)) +
                       's) \n')

        # move everything in / to /old (except just uploaded new directory)
        # move everything in /new to /
        self.log.write('replacing docs... ')
        self.__replace_files(ftphost)
        self.log.write('done. \n')

        # at this point, the new version is online.

        # delete /old folder
        # walk reverse cause the bottom-most folders need to be deleted first
        self.log.write('deleting old docs... \n')
        starttime = datetime.datetime.now()
        self.__remove_old_files(ftphost)
        timedelta = datetime.datetime.now() - starttime
        self.log.write('done. (took ' + str(total_seconds(timedelta)) +
                       's) \n')

        return True
Exemplo n.º 3
0
def deleteGET():
	k = request.args.get('k', '')
	if k:
		del_art(k,base_path = cwd)
		make()
		return '<script>alert("删除成功");location.href="/";</script>'
	else:
		return 'arguements error'
Exemplo n.º 4
0
def writePOST():
	d = {
	'title': request.form['title'],
	'tags': request.form['tags'],
	'content': request.form['input']
	}
	t = str(int(time.time()))
	if writeArt(d, file_path = cwd+'/arts/'+t+'.json'):
		make()
		return '<script>alert("写入成功");location.href="/";</script>'
	return '写入失败'
Exemplo n.º 5
0
def editPOST():
	d = {
	'title': request.form['title'],
	'tags': request.form['tags'],
	'content': request.form['input']
	}
	fn = cwd + 'arts/' + request.form['k'] + '.json'
	if writeArt(d, file_path=fn) == True:
		make()
		return '<script>alert("edit ok");location.href="/";</script>'
	else:
		return 'edit failed'
Exemplo n.º 6
0
path = chk('image/cut/' + sys.argv[1] + "/" + '2.png')
img2 = cv2.imread(path)
path = chk('image/cut/' + sys.argv[1] + "/" + '3.png')
img3 = cv2.imread(path)

path = chk('image/cut/' + sys.argv[1] + "/" + '4.png')
img4 = cv2.imread(path)
path = chk('image/cut/' + sys.argv[1] + "/" + '5.png')
img5 = cv2.imread(path)
path = chk('image/cut/' + sys.argv[1] + "/" + '6.png')
img6 = cv2.imread(path)

path = chk('image/cut/' + sys.argv[1] + "/" + '7.png')
img7 = cv2.imread(path)
path = chk('image/cut/' + sys.argv[1] + "/" + '8.png')
img8 = cv2.imread(path)
path = chk('image/cut/' + sys.argv[1] + "/" + '9.png')
img9 = cv2.imread(path)

img123 = cv2.hconcat([img1, img2, img3])
img456 = cv2.hconcat([img4, img5, img6])
img789 = cv2.hconcat([img7, img8, img9])
imgall = cv2.vconcat([img123, img456, img789])

cv2.imwrite('image/test6.png', imgall)
img = cv2.imread('image/test6.png')
dst = img[24:222, 24:222]
cv2.imwrite('image/test6.png', dst)

make.make()
Exemplo n.º 7
0
#!/usr/bin/env python

import make

make.make(createArchive = True)

Exemplo n.º 8
0
    print("UnitTest started ...\n")
    return os.system(getAppName() + " $")

def installLuaexeclib(ci = False):
    if ci:
        return os.system(getAppName() + " install_luaexeclib_ci.lua")
    else:
        return os.system(getAppName() + " install_luaexeclib.lua")

def luatest():
    return os.system(getAppName() + " lua_test/lua_test.lua")

if __name__ == "__main__":
    if os.path.isfile(getAppName()):
        print('Delete ' + getAppName())
        os.remove(getAppName())
    
    if make.make() != 0:
        sys.exit(-1)

    if unittest() != 0:
        sys.exit(-1)

    if installLuaexeclib(len(sys.argv) > 1 and sys.argv[1].lower() == 'ci') != 0:
        sys.exit(-1)
        
    if luatest() != 0:
        sys.exit(-1)

    sys.exit(0)