HWRF
trunk@4391
Main Page
Guides
Packages
Classes
Python Files
Configuration Files
File List
ush
hwrf_stream_parse.py
1
#! /usr/bin/env python
2
3
##@namespace ush.hwrf_stream_parse
4
# This is a wrapper around produtil.atparse.AtParser, a simple preparser
5
#
6
# This script reads in a file with special control symbols, performs
7
# string replacements, file insertions, etc. and outputs the result to
8
# stdout.
9
# @code{.sh}
10
# hwrf_stream_parse.py [--] file1 [file2 [file3 [...] ]]
11
# @endcode
12
#
13
# The special filename "-" requests reading of stdin. The "--" option
14
# requests termination of option parsing. Hence, to read the actual
15
# file "-", you would do "hwrf_stream_parse.py -- -" whereas to read
16
# stdin, you do "hwrf_stream_parse.py -"
17
18
import
sys, logging
19
from
produtil.atparse
import
ATParser
20
21
def
main():
22
p=ATParser(logger=logging.getLogger(
'streamparse'
))
23
nodash=
False
24
logging.basicConfig()
25
for
file
in
sys.argv[1:]:
26
if
not
nodash:
27
if
file==
'--'
:
28
nodash=
True
29
continue
30
elif
file==
'-'
:
31
p.parse_stream(sys.stdin,
'(stdin)'
)
32
continue
33
p.parse_file(file)
34
35
if
__name__==
'__main__'
: main()
produtil.atparse
ATParser is a text parser that replaces strings with variables and function output.
Definition:
atparse.py:1
Generated by
1.8.10