#!/usr/bin/python3 exlude=['rtma', 'urma', 'VLab', '.git'] # release="comGSIv3.7_EnKFv1.3_fix_global.tar.gz" GSI="/glade/work/geguo/MPMC/ProdGSI" basefixlist='/glade/work/geguo/MPMC/releases/fix.list' # remove old tarball and its directory import os os.system("rm -rf "+release+" global; mkdir -p global") os.chdir("global") # get basic fix file list with open(basefixlist) as f: fixbasic = f.read().splitlines() # get all fix file list from os import walk for (dirpath, dirnames, filenames) in walk(GSI+"/fix"): fixglobal=filenames break # link fix files not exluded and not in fbasic for x in fixglobal: excluded=False for y in exlude: if x.find(y)>=0: excluded=True if not excluded and not (x in fixbasic): os.system("ln -sf "+GSI+"/fix/"+x+" .") # get Big_Endian file list os.system("mkdir -p Big_Endian") BigEdnBasic=['cmaq_berror_big_endian','cmaq_pm2_5_reg_berror_12z.bin', \ 'global_berror.l64y96.f77','nam_glb_berror.f77.gcv','nam_nmmstat_na.gcv', \ 'wrf_chem_berror_big_endian'] for (dirpath, dirnames, filenames) in walk(GSI+"/fix/Big_Endian"): fixBigEndian=filenames break for x in fixBigEndian: excluded=False for y in exlude: if x.find(y)>=0: excluded=True if not excluded and not (x in BigEdnBasic): os.system("ln -sf "+GSI+"/fix/Big_Endian/"+x+" Big_Endian") #make a tar ball os.system("tar cvfzh ../"+release+" .")