示例#1
0
def dist_headers(conf, clean=True):
    util.cd(config.PATH_ROOT)

    webrtc_src_path = util.getpath(config.PATH_WEBRTC, 'src')
    dist_path = util.getpath(config.DIR_DIST)

    name = _generate_name(conf)

    include_path = os.path.join(dist_path, 'include', 'webrtc')

    if clean:
        shutil.rmtree(include_path, ignore_errors=True)

    os.makedirs(include_path, exist_ok=True)

    for directory in config.API_HEADERS:
        for file_path in glob.iglob(os.path.join(webrtc_src_path, directory,
                                                 '**', '*.h'),
                                    recursive=True):
            _copy_tree(webrtc_src_path, file_path, include_path)

    for directory in config.LEGACY_HEADERS:
        for file_path in glob.iglob(os.path.join(webrtc_src_path, directory,
                                                 '*.h'),
                                    recursive=False):
            _copy_tree(webrtc_src_path, file_path, include_path)

    if not conf['boringssl']:
        for directory in config.SSL_HEADERS:
            for file_path in glob.iglob(os.path.join(webrtc_src_path,
                                                     directory, '**', '*.h'),
                                        recursive=True):
                _copy_tree(webrtc_src_path, file_path, include_path)
def main():
	'''
	do the thing
	'''
	conf = rawconfig.config()
	parser = argparse.ArgumentParser(description="processes non-PHI disc transfers")
	#parser.add_argument('-m', dest='m', choices=['batch', 'single'], default=False, help='mode, for processing a single transfer or a bacth in new_ingest')
	parser.add_argument('-i', '--input', dest='i', help="the rawcapture file.wav to process, single mode only")
	args = parser.parse_args()
	captureDir = conf.discs.rawArchDir
	archRepoDir = conf.discs.archRepoDir
	bextsDir = conf.discs.mtdCaptures
	for _, subdirs, files in os.walk(captureDir):
		for f in files:
			if f.endswith(".gpk"):
				with ut.cd(os.pardir(f)):
					os.remove(f)
		for s in subdirs:
			with ut.cd(os.path.join(captureDir, s)):
				endObj1 = s + "b.wav"
				if os.path.isfile(s + "b.wav"):
					subprocess.call(['python', os.path.join(conf.scriptRepo, "makebroadcast.py"), '-ff', endObj1])
					os.remove(endObj1)
					os.rename(s + "c.wav", endObj1)
				if os.path.isfile(s + "a.wav"):
					subprocess.call(['bwfmetaedit', '--Originator=US, CUSB, SRC', '--OriginatorReference=' + s, '--MD5-Embed-Overwrite', s + "a.wav"])
			subprocess.call(['python', os.path.join(conf.scriptRepo, "hashmove.py"), os.path.join(captureDir, s), os.path.join(archRepoDir, s)])
	return
示例#3
0
def patch(conf):
    patches_path = util.getpath(config.DIR_PATCH)

    if conf['platform'] in config.patches.keys():
        for patch in config.patches[conf['platform']]:
            util.cd(patch[0])
            util.exec('git', 'apply', os.path.join(patches_path, patch[1]))
示例#4
0
def archive(conf):
    util.cd(config.PATH_ROOT)

    dist_path = util.getpath(config.DIR_DIST)
    name = _generate_name(conf)

    format = 'zip'
    shutil.make_archive(name, format, dist_path)
 def summarize(self, run_name="optimization"):
     a, b, c = self.opt.x0
     params = {"a0": a,
               "b0": b,
               "c0": c}
     with cd(run_name):
         with cd("times_series_convergence"):
             fn1 = "timeseries_" + stringify(**params) + ".png"
             self.plot_time_series_convergence(file_name=fn1)
         with cd("parameter_convergence"):
             fn2 = "param_cnvg_" + stringify(**params) + ".png"
             self.plot_parameter_convergence(file_name=fn2)
示例#6
0
def retrieve_commit(conf):
    util.cd(util.getpath(config.PATH_WEBRTC, 'src'))
    conf['webrtc_commit'] = util.exec_stdout(
        'git', 'log', '--format="%H"', '-n',
        '1').decode("utf-8").strip().strip("\"")

    if conf['boringssl']:
        util.cd(util.getpath(config.PATH_BORINGSSL))
        conf['boringssl_commit'] = util.exec_stdout(
            'git', 'log', '--format="%H"', '-n',
            '1').decode("utf-8").strip().strip("\"")

    return conf
示例#7
0
def pull(conf):
    webrtc_path = util.getpath(config.PATH_WEBRTC)

    util.cd(webrtc_path)
    if not util.exists(webrtc_path, '.gclient'):
        util.exec('fetch', '--nohooks', 'webrtc')

    util.cd(webrtc_path, 'src')

    util.exec('git', 'reset', '--hard')
    util.exec('git', 'fetch', 'origin')
    util.exec('git', 'checkout', "{}{}".format(config.WEBRTC_BRANCH_PREFIX,
                                               conf["branch"]))

    util.exec('gclient', 'sync', '-D')
示例#8
0
def setup(conf):
    util.cd(config.DIR_BUILD)
    if os.path.exists(util.getpath(config.PATH_DEPOT_TOOLS)):
        util.cd(config.PATH_DEPOT_TOOLS)
        util.exec('git', 'checkout', '-f', 'master')
        util.exec('git', 'pull')
    else:
        util.exec(
            'git', 'clone',
            'https://chromium.googlesource.com/chromium/tools/depot_tools.git',
            util.getpath(config.PATH_DEPOT_TOOLS))

    os.environ['PATH'] = util.getpath(
        config.PATH_DEPOT_TOOLS) + os.path.pathsep + os.environ['PATH']

    if sys.platform == 'win32':
        os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'

    if conf['boringssl']:
        if os.path.exists(util.getpath(config.PATH_BORINGSSL)):
            util.cd(config.PATH_BORINGSSL)
            util.exec('git', 'reset', '--hard')
            util.exec('git', 'fetch', '--all')
        else:
            util.exec('git', 'clone',
                      'https://boringssl.googlesource.com/boringssl.git',
                      util.getpath(config.PATH_BORINGSSL))

        util.cd(config.PATH_BORINGSSL)
        util.exec('git', 'checkout', '-f', conf['boringssl'])

        if os.path.exists(util.getpath(config.PATH_BORINGSSL, 'src',
                                       'include')):
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL, 'src',
                                                  'include')
        elif os.path.exists(util.getpath(config.PATH_BORINGSSL, 'src')):
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL, 'src')
        else:
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL)

    if conf['platform'] in config.libcxx_url.keys():
        util.cd(config.PATH_LIBCXX)
        url = config.libcxx_url[conf['platform']]
        if not os.path.exists(os.path.abspath(url.split('/')[-1])):
            util.exec('wget', url)
        util.exec('tar', 'xvaf',
                  url.split('/')[-1], '--strip-components=1', '--wildcards',
                  '*/include/c++', '*/libc++*')
示例#9
0
 def bundles(self):
     """ List of bundles in the vimpyre path """
     try:
         with util.cd(self.VIMPYRE_PATH):
             return [item for item in listdir('.') if path.isdir(item)]
     except OSError:
         console('Cannot access your vimpyre path!')
示例#10
0
def concatThem(startObj, archRepoDir, vidLeadDir):
    with ut.cd(os.path.join(archRepoDir, startObj)):
        ###INIT CONCAT.TXT###
        concatxt = open("concat.txt", "w")
        concatxt.write('file ' +
                       os.path.join(vidLeadDir, 'headlogoandtxt.mov\n'))
        concatxt.write('file headtailwithaudio.mov\n')
        concatxt.close()
        ###END INIT###

        #actually concatenate the headlogo with the headtailwithaudio file
        subprocess.call([
            'ffmpeg', '-f', 'concat', '-safe', '0', '-i', 'concat.txt', '-c',
            'copy',
            os.path.basename(startObj) + "yt.mov"
        ])
        #create an mp4 from that, pretty visually compressed
        subprocess.call([
            'ffmpeg', '-i',
            os.path.basename(startObj) + "yt.mov", '-pix_fmt', 'yuv420p',
            '-c:v', 'libx264', '-crf', '28', '-c:a', 'copy', '-movflags',
            'faststart', '-maxrate', '4380k', '-threads', '0',
            os.path.basename(startObj) + "yt.mp4"
        ])

        #remove all the crap we created
        os.remove(os.path.join(archRepoDir, startObj, 'concat.txt'))
        #os.remove(os.path.join(archRepoDir,startObj,'headwhite.mov'))
        os.remove(os.path.join(archRepoDir, startObj, 'headtxt.mov'))
        os.remove(os.path.join(archRepoDir, startObj, 'tail.mov'))
        os.remove(os.path.join(archRepoDir, startObj, 'headtail.mov'))
        os.remove(os.path.join(archRepoDir, startObj, 'headtailwithaudio.mov'))
示例#11
0
def process_toc_yaml(path):
    with util.cd(docs_dir):
        init_redirects()
        with open(path, 'r') as f:
            data = yaml.full_load(f.read())
        process_toc_entry(data['nav'], [], 1)
        update_redirects()
示例#12
0
文件: bat.py 项目: PiDelport/vimpyre
 def bundles(self):
     """ List of bundles in the vimpyre path """
     try:
         with util.cd(self.VIMPYRE_PATH):
             return [item for item in listdir('.') if path.isdir(item)]
     except OSError:
         console('Cannot access your vimpyre path!')
示例#13
0
def process(thefile):
	print thefile.rawcapNumber
	kwargs = thefile
	acf = mtd.get_aNumber_channelConfig_face(conf.magneticTape.cnxn,**kwargs)
	print acf
	if acf is not None:
		for k,v in acf.iteritems():
			kwargs[k] = v
		kwargs = ut.dotdict(kwargs)
		kwargs.aNumber = "a" + kwargs.aNumber
		###END GET ANUMBER FACE CHANNELCONFIG FROM FILEMAKER###
		###DO THE FFMPEG###
		#init folder to do the work in
		kwargs.processDir = os.path.join(conf.magneticTape.new_ingest,kwargs.aNumber)
		if not os.path.exists(kwargs.processDir):
			os.makedirs(kwargs.processDir)
			time.sleep(1)
		#make the full ffstr using the paths we have
		ffproc = ff.audio_init_ffproc(conf,kwargs)
		full_ffstr = ff.prefix(os.path.join(conf.magneticTape.new_ingest,kwargs.rawcapNumber) + "." + conf.ffmpeg.acodec_master_format) + ffproc.ff_suffix
		print full_ffstr
		#run ffmpeg on the file and make sure it completes successfully
		with ut.cd(kwargs.processDir):
			ffWorked = ff.go(full_ffstr)
		makebext(kwargs.aNumber,kwargs.processDir)
def run_fooof(freq_path,loc_path,save_report_path,save_variables_path,save_variable_prefix,save_variables = True
,save_report=True,freq_range=[1,30],channel = 'Oz'):

    freqIterator = folderIterator(freq_path)
    chan_inds_iterator = chanIndIterator(loc_path)

    # Constant
    bg_ppts= []# background parameters/ppts
    peak_ppts = []
    errors = []
    for chan_ind, freq_var in zip(chan_inds_iterator,freqIterator)
        if True: # if files[0].endswith(".mat"): TODO: set the conditions for safety            
            power,spectrum = getFreqValuesVec(freq_var)
            if chan_ind != -1
                power = 10**np.array(power[chan_ind])
                spectrum=np.array(spectrum).flatten()
                # Initialize FOOOF object
                fm = FOOOF(peak_width_limits=[0.5,8])
                
                # Model the power spectrum with FOOOF, and print out a report
                fm.fit(spectrum, power, freq_range)

                bg_ppts.append(fm.background_params_)
                peak_ppts.append(fm.peak_params_)
                errors.append(fm.error_)
                if save_report:
                    fm.save_report(str(freq_var[-7:-4]),save_report_path)

    if save_variables :
        with cd(save_variables_path):
            save_file(save_variable_prefix+'bg_ppts.npy',bg_ppts)
            save_file(save_variable_prefix+'peak_ppts.npy',peak_ppts)
            save_file(save_variable_prefix+'errors.npy',errors) 
示例#15
0
 def save_vars(self, suptitle, titles, axis):
     '''Helper method called in self.plot(). It saves the variables'''
     if self.save_vars_bool:
         saving_dic = {}
         if self.save_std:
             test_std = np.std(self.test_list, axis=axis)
             saving_dic.update({
                 titles[i] + '_std': test_std[:, i]
                 for i in range(len(titles))
             })
         if self.save_mean:
             test_mean = np.mean(self.test_list, axis=axis)
             saving_dic.update({
                 titles[i] + '_mean': test_mean[:, i]
                 for i in range(len(titles))
             })
         if self.t_score:
             shape = np.array(self.test_list).shape
             if len(axis) == 2:
                 self.test_list = np.reshape(self.test_list,
                                             (shape[0] * shape[1], -1))
                 shape = self.test_list.shape
             (t_scores, p_values) = ttest_rel(self.test_list,
                                              np.ones(shape) * 0.5,
                                              axis=0)
             t_scores = t_scores.reshape(t_scores.shape[0], -1)
             saving_dic.update({
                 titles[i] + '_tscore': t_scores[:, i]
                 for i in range(len(titles))
             })
         with cd(self.save_vars_path):
             savemat(suptitle + '.mat', saving_dic)
示例#16
0
def concat_vobs(file):
	'''
	concatenates VOB files into single VOB
	'''
	'''with open(file.concatxt, 'a') as concat:
		for vob in os.listdir(file.vobDir):
			if vob.startswith('VTS') and vob.endswith('.VOB'):
				concat.write("file '" + vob + "'\n")
	ffstr = 'ffmpeg -f concat -i concat.txt -c copy -map V -map a ' + file.vobOutFullPath'''
	inputstr = ''
	inputcount = 0
	filterstrprefix = ''
	for vob in os.listdir(file.vobDir):
		if vob.startswith('VTS') and vob.endswith('.VOB'):
			inputstr = inputstr + " -i " + vob
			filterstrprefix = filterstrprefix + "[" + str(inputcount) + ":v:0] [" + str(inputcount) + ":a:0] "
			inputcount = inputcount + 1
	ffstr = 'ffmpeg' + inputstr + ' -filter_complex "' + filterstrprefix + ' concat=n=' + str(inputcount) + ':v=1:a=1 [v] [a]" -map "[v]" -map "[a]" -c:v libx264 -movflags faststart -pix_fmt yuv420p -crf 20 -c:a aac -ac 2 -b:a 192k ' + file.outputFullPath
	print ffstr
	foo = raw_input("eh")
	with ut.cd(file.vobDir):
		ffWorked = ff.go(ffstr)
		if ffWorked is not True:
			print 'makebroadcast encountered the following error trying to concatenate the VOBs'
			print ffWorked
			return False
		else:
			return True
示例#17
0
def main():
    ###INIT VARS###
    global conf
    conf = rawconfig.config()
    log.log("started")
    parser = argparse.ArgumentParser(
        description="slices, reverses input file, concatenates back together")
    parser.add_argument(
        '-i',
        '--input',
        dest='i',
        help='the full path to the file to be reversed',
    )
    args = parser.parse_args()
    endObj = os.path.basename(args.i)
    endObj, ext = os.path.splitext(endObj)
    workingDir = args.workingDir = os.path.dirname(args.i)
    ###END INIT###
    with ut.cd(workingDir):
        #ffprobe input file and find duraiton
        output = subprocess.Popen(
            ['ffprobe', '-show_streams', '-of', 'flat', args.i],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE)
        ffdata, err = output.communicate()
        match = re.search(r".*duration=.*",
                          ffdata)  #get just the bit after duration
        if match:
            _dur = match.group().split('"')[1::2]
            dur = args.dur = _dur[0]  #separate out single value from list _dur
        ###end init###
        if float(dur) <= 300.0:
            revWorked = process_short(args)
        else:
            revWorked = process(args)
            #concatenate the revsered output from slicer loop
            if revWorked is True:
                ffmpegstring = "ffmpeg -f concat -i concat.txt -c:a copy -threads 0 " + endObj + "-reversed.wav"
                try:
                    output = subprocess.call(ffmpegstring)
                    revWorked = True
                except subprocess.CalledProcessError, e:
                    revWorked = e.returncode
        ###DELETE STUFF###
        if revWorked is True:
            for f in os.listdir(os.getcwd()):
                match = ''
                match = re.match("concat", f)
                if match:
                    os.remove(f)
            if os.path.exists(endObj + "-reversed.wav"):
                if os.path.getsize(
                        endObj.replace(".wav", "") + "-reversed.wav"
                ) > 50000:  #validate that the reversed file is actually good and ok
                    if os.path.exists(args.i):
                        os.remove(args.i)
                        os.rename(endObj + "-reversed.wav", args.i)
        else:
            print "Buddy, there was a problem reversing that file"
示例#18
0
 def run_download(self):
     '''
     Download the <source_url> to the <download_dir>.
     '''
     with cd(self.get_rundir('download')):
         rc = download.get(self.vars['source_url'],self.vars['download_dir'], 
                           self.vars.get('download_final'))
     return rc
示例#19
0
文件: bat.py 项目: PiDelport/vimpyre
 def update(self):
     console('=> => Send a bat to update %s' % self.CURR_SCRIPT)
     bundle_path = path.join(self.VIMPYRE_PATH, self._filter_script_name())
     if path.isdir(bundle_path):
         with util.cd(bundle_path):
             system('git pull')
         console('%s update done!' % self.CURR_SCRIPT)
     else:
         console('%s does not exist!' % self.CURR_SCRIPT)
示例#20
0
 def update(self):
     console('=> => Send a bat to update %s' % self.CURR_SCRIPT)
     bundle_path = path.join(self.VIMPYRE_PATH, self._filter_script_name())
     if path.isdir(bundle_path):
         with util.cd(bundle_path):
             system('git pull')
         console('%s update done!' % self.CURR_SCRIPT)
     else:
         console('%s does not exist!' % self.CURR_SCRIPT)
示例#21
0
def delete_bs(kwargs):
    ###delete bs###
    with ut.cd(kwargs.archDir):
        for dirs, subdirs, files in os.walk(os.getcwd()):
            for f in files:
                if f.endswith(".gpk") or f.endswith(".mrk"):
                    try:
                        os.remove(f)
                    except:
                        pass
    with ut.cd(kwargs.broadDir):
        for dirs, subdirs, files in os.walk(os.getcwd()):
            for f in files:
                if f.endswith(".gpk") or f.endswith(".bak") or f.endswith(
                        ".mrk"):
                    try:
                        os.remove(f)
                    except:
                        pass
示例#22
0
    def list_installed(self):
        console('=> => Send bats to collect all your vim-scripts')
        if not self.bundles:
            console('No vim-scripts found!')
            sys.exit(1)

        for bundle in self.bundles:
            bundle_path = path.join(self.VIMPYRE_PATH, bundle)
            with util.cd(bundle_path):
                url = subprocess.check_output(['grep', 'url', '.git/config']).replace('\turl = ', '').replace('\n', '')
                console('\033[1m%s\033[m => %s' % (bundle, url))
示例#23
0
    def update_all(self):
        console('=> => Send bats to update all installed vim-scripts ...')
        if not self.bundles:
            console('No vim-scripts! Please use `vimpyre install <vim-scripts>` first!')
            sys.exit(1)

        for item in self.bundles:
            console('=> Update %s ...' % item)
            with util.cd(path.join(self.VIMPYRE_PATH, item)):
                system('git pull')
        console('Update all vim-scripts done!')
示例#24
0
文件: bat.py 项目: PiDelport/vimpyre
    def list_installed(self):
        console('=> => Send bats to collect all your vim-scripts')
        if not self.bundles:
            console('No vim-scripts found!')
            sys.exit(1)

        for bundle in self.bundles:
            bundle_path = path.join(self.VIMPYRE_PATH, bundle)
            with util.cd(bundle_path):
                url = subprocess.check_output(['grep', 'url', '.git/config']).replace('\turl = ', '').replace('\n', '')
                console('\033[1m%s\033[m => %s' % (bundle, url))
示例#25
0
文件: bat.py 项目: PiDelport/vimpyre
    def update_all(self):
        console('=> => Send bats to update all installed vim-scripts ...')
        if not self.bundles:
            console('No vim-scripts! Please use `vimpyre install <vim-scripts>` first!')
            sys.exit(1)

        for item in self.bundles:
            console('=> Update %s ...' % item)
            with util.cd(path.join(self.VIMPYRE_PATH, item)):
                system('git pull')
        console('Update all vim-scripts done!')
示例#26
0
 def prepare(self):
     if "version" in self.settings:
         version = self.settings["version"]
         download(self.url % (version), self.zipfile)
         unzip(self.zipfile, 'temp')
         cp('temp/imgui-%s/' % (version), 'temp/') # TODO: mv would be cleaner
     else:
         git_clone(self.repo, 'master', 'temp')
     if "patch" in self.settings:
         with cd('temp/'):
             patch(self.settings["patch"])
示例#27
0
 def run(self, out_dir, _):
     build_dir = os.path.join(out_dir, self.name)
     print('Building test: {}'.format(self.name))
     _prep_build_dir(self.test_dir, build_dir)
     with util.cd(build_dir):
         module = imp.load_source('test', 'test.py')
         success, failure_message = module.run_test(
             abi=self.abi, platform=self.platform, toolchain=self.toolchain,
             build_flags=self.build_flags)
         if success:
             yield Success(self.name)
         else:
             yield Failure(self.name, failure_message)
示例#28
0
def main():
    '''
	do the thing
	'''
    #initialize via the config file
    global conf
    conf = rawconfig.config()
    parser = argparse.ArgumentParser(
        description="capture, import, and rename a photo for the PHI project")
    parser.add_argument(
        'barcode', help="the barcode for the disc side you want to capture")
    args = parser.parse_args()
    rawCapturePath = conf.NationalJukebox.VisualArchRawDir
    if not os.path.exists(rawCapturePath):
        os.makedirs(rawCapturePath)
    barcode = args.barcode.strip()  #grab the lone argument that FM provides
    barcode = barcode.replace("ucsb", "cusb")  #stupid, stupid bug
    fname = barcode + ".cr2"  #make the new filename
    log.log("started")
    print conf.python
    print os.path.join(conf.scriptRepo, "capture-image.py")
    subprocess.call([
        conf.python,
        os.path.join(conf.scriptRepo, "capture-image.py"), "-nj"
    ])
    time.sleep(3)
    with ut.cd(rawCapturePath):  #cd into capture dir
        if os.path.isfile(os.path.join(
                rawCapturePath, barcode + ".cr2")) or os.path.isfile(
                    os.path.join(
                        rawCapturePath, barcode +
                        ".CR2")):  #error checking, if the file already exists
            log.log(
                **{
                    "message":
                    "It looks like you already scanned that barcode " +
                    barcode,
                    "level": "warning"
                })
            print "It looks like you already scanned that barcode"
            a = raw_input("Better check on that")
            sys.exit()
        newest = max(glob.iglob('*.[Cc][Rr]2'), key=os.path.getctime
                     )  #sort dir by creation date of .cr2 or .CR2 files
        os.rename(newest,
                  fname)  #rename the newest file w/ the barcode just scanned
        log.log("renamed " + newest + " " + fname)
        mtd.insertFM(
            """update SONYLOCALDIG set capturedImage='1' where filename='""" +
            args.barcode.strip() + """'""",
            pyodbc.connect(conf.NationalJukebox.cnxn))
示例#29
0
文件: bat.py 项目: PiDelport/vimpyre
 def remove_all(self):
     console('=> => Send bats to clean all vimpyre files')
     try:
         with util.cd(self.VIMPYRE_PATH):
             for bundle in self.bundles:
                 shutil.rmtree(bundle)
         console('Remove vimpyre bundles done!')
     except OSError:
         console('Could not remove bundles! Please verify permissions of '
                 'your bundle directories.')
     else:
         console('Please remove %s/pathogen.vim manually and clean `call pathogen#runtime_append_all_bundles("vimpyre")` from your .vimrc!' % self.AUTOLOAD_PATH)
         console('')
         console('If you wish to use vimpyre to manage your vim scripts again, you need to use `vimpyre init` first!')
示例#30
0
def dist_lib(conf, mode, clean=True):
    util.cd(config.PATH_ROOT)

    webrtc_src_path = util.getpath(config.PATH_WEBRTC, 'src')
    dist_path = util.getpath(config.DIR_DIST)

    name = _generate_name(conf)
    out_path = _generate_out(conf, mode)

    lib_path = os.path.join(dist_path, 'lib', mode.lower().capitalize())

    if clean:
        shutil.rmtree(lib_path, ignore_errors=True)

    os.makedirs(lib_path, exist_ok=True)

    for file_path in glob.iglob(
            os.path.join(webrtc_src_path, out_path, 'obj', '*.lib')):
        shutil.copy(file_path, lib_path)

    for file_path in glob.iglob(
            os.path.join(webrtc_src_path, out_path, 'obj', '*.a')):
        shutil.copy(file_path, lib_path)
示例#31
0
def make_video(thefile):
    '''
	actually use everything we've made to make the mp4
	'''
    with ut.cd(thefile.dir):
        if thefile.ext == 'mxf':
            ffstr = 'ffmpeg -i ' + thefile.infullpath + ' -map 0 -dn -vf "weave,setfield=bff,setdar=4/3" -c:v libx264 -preset slower -crf 18 -c:a aac ' + thefile.outfullpath
        else:
            ffstr = 'ffmpeg -i ' + thefile.infullpath + ' -map 0 -dn -c:v libx264 -preset slower -crf 18 -c:a aac ' + thefile.outfullpath
        print ffstr
        ffWorked = ff.go(ffstr)
        if ffWorked is not True:
            print "makeaccess encountered an error transcoding that file"
            print ffWorked
示例#32
0
def makebext(aNumber,processDir): #embed bext info using bwfmetaedit
	try:
		kwargs = {"aNumber":aNumber,"bextVersion":"1"}
		bextstr = mtd.makebext_complete(pyodbc.connect(conf.magneticTape.cnxn),**kwargs)
	except:
		bextstr = "--originator=US,CUSB,SRC --originatorReference=" + aNumber.capitalize()
	with ut.cd(processDir):
		for f in os.listdir(os.getcwd()):
			if f.endswith(".wav"):
				subprocess.check_output("bwfmetaedit --in-core-remove " + f) #removes all bext info currently present
				print "embedding MD5 hash of data chunk..."
				subprocess.check_output("bwfmetaedit --MD5-Embed-Overwrite " + f) #embeds md5 hash of data chunk, overwrites if currently exists
				print "embedding BEXT chunk..."
				subprocess.check_output("bwfmetaedit " + bextstr + " " + f) #embeds bext v0 info
def main():
    drive = "R:/Visual/avlab/new_ingest"
    txtfile = open("S:/avlab/microservices/utility-scripts/srcdig004-qct-parse.txt","a")
    for dirs, subdirs, files in os.walk(drive):
        for s in subdirs:
            if s.startswith("System"):
                continue
            sfullpath = os.path.join(dirs, s)
            with ut.cd(sfullpath):
                for f in os.listdir(os.getcwd()):
                    if f.endswith(".qctools.xml.gz"):
                        print os.path.join(os.getcwd(),f)
                        output = subprocess.check_output("python S:/avlab/qct-parse/qct-parse/qct-parse.py -p default8bit -i " + os.path.join(os.getcwd(),f),shell=True)
                        txtfile.write(output)
示例#34
0
 def remove_all(self):
     console('=> => Send bats to clean all vimpyre files')
     try:
         with util.cd(self.VIMPYRE_PATH):
             for bundle in self.bundles:
                 shutil.rmtree(bundle)
         console('Remove vimpyre bundles done!')
     except OSError:
         console('Could not remove bundles! Please verify permissions of '
                 'your bundle directories.')
     else:
         console('Please remove %s/pathogen.vim manually!' % self.AUTOLOAD_PATH)
         console('')
         console('If you wish to use vimpyre to manage your vim scripts again, you need to use `vimpyre init` first!')
示例#35
0
def build(conf, mode):
    webrtc_src_path = util.getpath(config.PATH_WEBRTC, 'src')
    util.cd(webrtc_src_path)

    if sys.platform == 'linux':
        util.exec('bash', 'build/install-build-deps.sh', '--no-prompt')

    if conf['os'] == 'linux':
        util.exec('python', 'build/linux/sysroot_scripts/install-sysroot.py',
                  '--arch={}'.format(conf['cpu']))

    args = _generate_args(conf, mode)
    out_path = _generate_out(conf, mode)

    args_file = os.path.join(webrtc_src_path, out_path, 'args.gn')

    os.makedirs(util.getpath(webrtc_src_path, out_path), exist_ok=True)

    with open(args_file, 'w') as file:
        file.write('\n'.join(args))

    util.exec('gn', 'gen', out_path)

    util.exec('ninja', '-C', out_path)
示例#36
0
 def run(self, out_dir, _):
     build_dir = os.path.join(out_dir, self.name)
     print('Running build test: {}'.format(self.name))
     _prep_build_dir(self.test_dir, build_dir)
     with util.cd(build_dir):
         module = imp.load_source('test', 'test.py')
         success, failure_message = module.run_test(
             abi=self.abi,
             platform=self.platform,
             toolchain=self.toolchain,
             build_flags=self.build_flags)
         if success:
             return [Success(self.name)]
         else:
             return [Failure(self.name, failure_message)]
示例#37
0
def _run_ndk_build_test(test_name, build_dir, test_dir, build_flags, abi,
                        platform, toolchain):
    _prep_build_dir(test_dir, build_dir)
    with util.cd(build_dir):
        args = [
            'APP_ABI=' + abi,
            'NDK_TOOLCHAIN_VERSION=' + toolchain,
            _get_jobs_arg(),
        ]
        if platform is not None:
            args.append('APP_PLATFORM=' + platform)
        rc, out = ndk.build(build_flags + args)
        if rc == 0:
            return Success(test_name)
        else:
            return Failure(test_name, out)
示例#38
0
def _run_ndk_build_test(test_name, build_dir, test_dir, build_flags, abi,
                        platform, toolchain):
    _prep_build_dir(test_dir, build_dir)
    with util.cd(build_dir):
        args = [
            'APP_ABI=' + abi,
            'NDK_TOOLCHAIN_VERSION=' + toolchain,
            _get_jobs_arg(),
        ]
        if platform is not None:
            args.append('APP_PLATFORM=' + platform)
        rc, out = ndk.build(build_flags + args)
        if rc == 0:
            return Success(test_name)
        else:
            return Failure(test_name, out)
示例#39
0
def _run_build_sh_test(test_name, build_dir, test_dir, build_flags, abi,
                       platform, toolchain):
    _prep_build_dir(test_dir, build_dir)
    with util.cd(build_dir):
        build_cmd = ['bash', 'build.sh', _get_jobs_arg()] + build_flags
        test_env = dict(os.environ)
        if abi is not None:
            test_env['APP_ABI'] = abi
        if platform is not None:
            test_env['APP_PLATFORM'] = platform
        assert toolchain is not None
        test_env['NDK_TOOLCHAIN_VERSION'] = toolchain
        rc, out = util.call_output(build_cmd, env=test_env)
        if rc == 0:
            return Success(test_name)
        else:
            return Failure(test_name, out)
示例#40
0
def _run_build_sh_test(test_name, build_dir, test_dir, build_flags, abi,
                       platform, toolchain):
    _prep_build_dir(test_dir, build_dir)
    with util.cd(build_dir):
        build_cmd = ['sh', 'build.sh', _get_jobs_arg()] + build_flags
        test_env = dict(os.environ)
        if abi is not None:
            test_env['APP_ABI'] = abi
        if platform is not None:
            test_env['APP_PLATFORM'] = platform
        assert toolchain is not None
        test_env['NDK_TOOLCHAIN_VERSION'] = toolchain
        rc, out = util.call_output(build_cmd, env=test_env)
        if rc == 0:
            return Success(test_name)
        else:
            return Failure(test_name, out)
示例#41
0
    def install(self):
        console('=> => Send a bat to catch %s' % self.CURR_SCRIPT)

        try:
            ret = self._check_name()
            if ret:
                fetch_url = self._render_fetch_url(ret)
                cmd_fetch = 'git clone --depth 1 %s' % fetch_url
                util.mkdir_p(self.VIMPYRE_PATH)
                with util.cd(self.VIMPYRE_PATH):
                    system(cmd_fetch)
            else:
                msg = ('%s not found! Please use `vimpyre search <vim-script>`'
                       ' to check the script name and install again!' %
                       self.CURR_SCRIPT)
                console(msg)
        except:
            self.install_base()
示例#42
0
def _run_ndk_build_test(test_name, build_dir, test_dir, build_flags, abi,
                        platform):
    try:
        reason = _should_skip_test(test_dir, abi, platform)
    except RuntimeError as ex:
        return Failure(test_name, ex)
    if reason is not None:
        return Skipped(test_name, reason)

    _prep_build_dir(test_dir, build_dir)
    with util.cd(build_dir):
        rc = ndk.build(build_flags + [_get_jobs_arg()])
    expect_failure = os.path.isfile(
        os.path.join(test_dir, 'BUILD_SHOULD_FAIL'))
    if rc == 0 and expect_failure:
        return Failure(test_name, 'build should have failed')
    elif rc != 0 and not expect_failure:
        return Failure(test_name, 'build failed')
    return Success(test_name)
示例#43
0
def _run_build_sh_test(test_name, build_dir, test_dir, build_flags, abi,
                       platform):
    android_mk = os.path.join(test_dir, 'jni/Android.mk')
    application_mk = os.path.join(test_dir, 'jni/Application.mk')
    if os.path.isfile(android_mk) and os.path.isfile(application_mk):
        result = subprocess.call(['grep', '-q', 'import-module', android_mk])
        if result != 0:
            try:
                reason = _should_skip_test(test_dir, abi, platform)
            except RuntimeError as ex:
                return Failure(test_name, ex)
            if reason is not None:
                return Skipped(test_name, reason)

    _prep_build_dir(test_dir, build_dir)
    with util.cd(build_dir):
        build_cmd = ['sh', 'build.sh', _get_jobs_arg()] + build_flags
        if subprocess.call(build_cmd) == 0:
            return Success(test_name)
        else:
            return Failure(test_name, 'build failed')
示例#44
0
文件: rssfeed.py 项目: ahorn/z3test
print '<?xml version="1.0" encoding="utf-8"?>'
print '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005">'
print '<channel xmlns:cfi="http://www.microsoft.com/schemas/rss/core/2005/internal" cfi:lastdownloaderror="None">'
# print '<?xml version="1.0" encoding="utf-8"?>'
# print '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' 
# print '<channel>' 
print '<title>Z3 commits</title>'
print '<description>Recent commits at github.com/z3prover</description>'
print '<link>http://research.microsoft.com/en-us/um/redmond/projects/z3/z3commits.xml</link>'
t = datetime.datetime.now()
s = t.strftime("%A, %d %B %Y, %I:%M%p PST")
print '<lastBuildDate>', s, '</lastBuildDate>'
print '<pubDate>', s, '</pubDate>'

z3dir = util.find_z3depot()
with util.cd(z3dir):
    NULL=open(os.devnull, 'wb')
    for branch in config.RSSFEED_BRANCHES:
        if subprocess.call(['git', 'checkout', branch], stdout=NULL, stderr=NULL) != 0:
            raise Exception("Failed to checkout %s" % branch)
        if subprocess.call(['git', 'pull'], stdout=NULL, stderr=NULL) != 0:
            raise Exception("Failed to update git depot")
    output = subprocess.Popen(['git', 'log', '--branches', '--pretty=format:%an | %cD | %s | %H', '-100'], stdout=subprocess.PIPE, stderr=NULL).communicate()[0]
    for line in output.splitlines():
        fields = line.split('|')
        if len(fields) == 4:
            print '<item>'
            print '<title>Commit by', fields[0], '</title>'
            print '<description>commit on %s<![CDATA[<br/>]]>%s</description>' % (fields[1].strip(' '), cgi.escape(fields[2].strip(' ')))
            print '<link>http://z3.codeplex.com/SourceControl/changeset/%s</link>' % fields[3].strip(' ')[:12]
            print '<pubDate>', fields[1], '</pubDate>'
示例#45
0
 def build(self):
     with cd('src/LuaJIT-%s' % self.version):
         run('make')