31 lines
880 B
Python
31 lines
880 B
Python
import os
|
|
import sys
|
|
import argparse
|
|
|
|
|
|
parser = argparse.ArgumentParser(description='Optional app description')
|
|
|
|
# Switch
|
|
parser.add_argument('--overwrite', action='store_true',
|
|
help='write to transport file')
|
|
|
|
args = parser.parse_args()
|
|
|
|
print args.overwrite
|
|
|
|
|
|
foamTranFile = "transport30.foam"
|
|
|
|
with open("transport.dat") as tranlibFile:
|
|
for line in tranlibFile:
|
|
name = line[:19].strip(" ")
|
|
params = "( {} );".format(line[19:70])
|
|
checkCmd = 'foamDictionary -entry "{}" ' + foamTranFile + ' &> /dev/null'
|
|
dictCmd = 'foamDictionary -entry "{}.transport.tranlib" -set "{}" ' + foamTranFile + ' &> /dev/null'
|
|
if os.system(checkCmd.format(name)) == 0:
|
|
res = os.system(dictCmd.format(name, params))
|
|
if res != 0:
|
|
print "Error! processing ", name
|
|
exit(-1)
|
|
|
|
|