diff options
author | Josh Blum | 2012-04-19 00:50:18 -0700 |
---|---|---|
committer | Josh Blum | 2012-04-19 18:13:23 -0700 |
commit | bb61c325dabfc80bbd8404b2892575948b77496b (patch) | |
tree | 71786d98c39bc9abfa05dce6b629c9aefd171cda /volk/gen | |
parent | 04adf90ea75de53551025cd442295d1d99b36f05 (diff) | |
download | gnuradio-bb61c325dabfc80bbd8404b2892575948b77496b.tar.gz gnuradio-bb61c325dabfc80bbd8404b2892575948b77496b.tar.bz2 gnuradio-bb61c325dabfc80bbd8404b2892575948b77496b.zip |
volk: code simplification, overrule macro and python opts
Diffstat (limited to 'volk/gen')
-rw-r--r-- | volk/gen/volk_compile_utils.py | 9 | ||||
-rw-r--r-- | volk/gen/volk_tmpl_utils.py | 18 |
2 files changed, 16 insertions, 11 deletions
diff --git a/volk/gen/volk_compile_utils.py b/volk/gen/volk_compile_utils.py index cd9f9f0a9..cf1357375 100644 --- a/volk/gen/volk_compile_utils.py +++ b/volk/gen/volk_compile_utils.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # # Copyright 2012 Free Software Foundation, Inc. # @@ -44,10 +45,10 @@ def do_machine_flags_list(compiler, machine_name): def main(): parser = optparse.OptionParser() - parser.add_option('--mode', type='string', default='') - parser.add_option('--compiler', type='string', default='') - parser.add_option('--archs', type='string', default='') - parser.add_option('--machine', type='string', default='') + parser.add_option('--mode', type='string') + parser.add_option('--compiler', type='string') + parser.add_option('--archs', type='string') + parser.add_option('--machine', type='string') (opts, args) = parser.parse_args() if opts.mode == 'arch_flags': return do_arch_flags_list(opts.compiler.lower()) diff --git a/volk/gen/volk_tmpl_utils.py b/volk/gen/volk_tmpl_utils.py index c215e389e..6c08a8213 100644 --- a/volk/gen/volk_tmpl_utils.py +++ b/volk/gen/volk_tmpl_utils.py @@ -23,6 +23,7 @@ import os import re import sys +import optparse import volk_arch_defs import volk_machine_defs import volk_kernel_defs @@ -60,11 +61,14 @@ def __parse_tmpl(_tmpl, **kwargs): """ + _tmpl return str(Template.Template(_tmpl, defs)) -if __name__ == '__main__': - input_file = sys.argv[1] - output_file = sys.argv[2] - try: which = sys.argv[3] - except: which = '' - output = __parse_tmpl(open(input_file).read(), which=which) - if output_file: open(output_file, 'w').write(output) +def main(): + parser = optparse.OptionParser() + parser.add_option('--input', type='string') + parser.add_option('--output', type='string') + (opts, args) = parser.parse_args() + + output = __parse_tmpl(open(opts.input).read(), args=args) + if opts.output: open(opts.output, 'w').write(output) else: print output + +if __name__ == '__main__': main() |