Go to the documentation of this file.
4 Rewrite the seadas configuration file (usually
5 $SEADAS/config/seadas.config), changing the value
6 of the seadas.ocssw.root line to a value passed
7 in via the command line call.
15 Reads the input file then writes it to a temporary file,
16 changing the appropriate entry. Then it copies the temporary
17 file over the original.
19 with open(seadas_config,
'rt')
as in_file:
20 in_content = in_file.readlines()
22 with open(
'seadas_config.tmp',
'wt')
as out_file:
23 for line
in in_content:
24 if line.startswith(
'seadas.ocssw.root'):
25 out_line =
'seadas.ocssw.root = ' + install_dir +
'\n'
28 out_file.write(out_line)
29 shutil.copy(
'seadas_config.tmp', seadas_config)
34 parser = argparse.ArgumentParser(prog=
"rewrite_seadas_config")
35 parser.add_argument(
'--version', action=
'version', version=
'%(prog)s ' + version)
36 parser.add_argument(
"seadasConfig",
37 help=
"SeaADAS config file to edit", metavar=
"CONFIGFILE")
38 parser.add_argument(
"OCSSWROOT",
39 help=
"OCSSW root directory", metavar=
"OCSSWROOT")
41 args = parser.parse_args()
42 if args.seadasConfig
is None or args.OCSSWROOT
is None:
49 if __name__ ==
'__main__':
def rewrite_seadas_config(seadas_config, install_dir)