def goodheader(x): basename, dirname = x # for root and FairRoot, we enforce class prefixes. # for R3BROOT, people don't care, so we don't. classbypath = {"root6": "T", "R3BRoot": "", "FairRoot": "Fair"} ok = False for k, v in classbypath.items(): ok |= dirname.find(k) != -1 and basename.startswith(v) # header files in the macros subdir are probably autogenerated # by us, ignore them. ok &= dirname.find("/macros/") == -1 if not ok: print "Ignoring header %s" % (x, ) return ok
def _is_modis_file(filename): """ Does the given file match a Modis NetCDF file? (we could make this more extensive in the future, but it's directly derived from the old find_files() logic. :type filename: str :rtype: bool >>> d = '/g/data/u39/public/data/modis/datacube/mod09-swath/terra/2010/12/31' >>> f = 'MOD09_L2.2010365.2300.20130130162407.remapped_swath_500mbands_0.005deg.nc' >>> _is_modis_file(f) True >>> _is_modis_file(os.path.join(d, f)) True >>> _is_modis_file(d) False """ basename = os.path.basename(filename).lower() return basename.startswith('mod') and filename.endswith(".nc")
def PostProcessEditorBuilds(out_dir): """Post-process the created RCP builds""" PrintSeparator('Post-process RCP builds') for zipFile in _FindRcpZipFiles(out_dir): basename = os.path.basename(zipFile) print(' processing %s' % basename) # post-process the info.plist file if (basename.startswith('darteditor-macos-')): infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') subprocess.call(['unzip', zipFile, infofile], env=os.environ) ReplaceInFiles([infofile], [('<dict>', '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) os.remove(infofile)
def PostProcessEditorBuilds(out_dir): """Post-process the created RCP builds""" PrintSeparator('Post-process RCP builds') for zipFile in _FindRcpZipFiles(out_dir): basename = os.path.basename(zipFile) print(' processing %s' % basename) # post-process the info.plist file if (basename.startswith('darteditor-macos-')): infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') subprocess.call(['unzip', zipFile, infofile], env=os.environ) ReplaceInFiles([infofile], [ ('<dict>', '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>') ]) subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) os.remove(infofile)