diff options
Diffstat (limited to 'volk/python/volk_modtool/cfg.py')
-rw-r--r-- | volk/python/volk_modtool/cfg.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/volk/python/volk_modtool/cfg.py b/volk/python/volk_modtool/cfg.py index c58dc59091..a7eb32a347 100644 --- a/volk/python/volk_modtool/cfg.py +++ b/volk/python/volk_modtool/cfg.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2013 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# import ConfigParser import sys @@ -37,7 +37,7 @@ class volk_modtool_config: def remap(self): for i in self.remapification: self.verify_section(i) - + def verify_section(self, section): stuff = self.cfg.items(section[0]) for i in range(len(section[1])): @@ -50,17 +50,17 @@ class volk_modtool_config: raise exceptions.ValueError('Verification function returns False... key:%s, val:%s'%(stuff[i][0], stuff[i][1])) except: raise exceptions.IOError('bad configuration... key:%s, val:%s'%(stuff[i][0], stuff[i][1])) - + def __init__(self, cfg=None): self.config_name = 'config' self.config_defaults = ['name', 'destination', 'base'] self.config_defaults_remap = ['1', - 'self.cfg.set(self.config_name, \'$k1\', os.path.realpath(os.path.expanduser(\'$1\')))', - 'self.cfg.set(self.config_name, \'$k2\', os.path.realpath(os.path.expanduser(\'$2\')))'] - + 'self.cfg.set(self.config_name, \'$k1\', os.path.realpath(os.path.expanduser(\'$1\')))', + 'self.cfg.set(self.config_name, \'$k2\', os.path.realpath(os.path.expanduser(\'$2\')))'] + self.config_defaults_verify = ['re.match(\'[a-zA-Z0-9]+$\', \'$0\')', - 'os.path.exists(\'$1\')', + 'os.path.exists(\'$1\')', 'os.path.exists(\'$2\')'] self.remapification = [(self.config_name, self.config_defaults_remap)] self.verification = [(self.config_name, self.config_defaults_verify)] @@ -79,8 +79,8 @@ class volk_modtool_config: self.cfg = icfg self.remap() self.verify() - - + + def read_map(self, name, inp): if self.cfg.has_section(name): @@ -96,9 +96,9 @@ class volk_modtool_config: retval[i[0]] = i[1] return retval - - + + |