diff options
author | Tom Rondeau <tom@trondeau.com> | 2014-07-07 12:18:00 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-07-07 12:18:00 -0400 |
commit | 597b93798a804cde1783d6d2ab53b348d57c44cd (patch) | |
tree | b65e73bb0de634ff5d209b15971ebdabf369a45c /volk/python | |
parent | 1151e5502ccd440ebd89599cf7e4be4fb5ed8334 (diff) |
Removing trailing/extra whitespaces before release.
We should be more careful about letting these into the code in the future. In emacs, we can use (add-hook 'before-save-hook 'delete-trailing-whitespace).
Diffstat (limited to 'volk/python')
-rw-r--r-- | volk/python/volk_modtool/README | 4 | ||||
-rw-r--r-- | volk/python/volk_modtool/__init__.py | 10 | ||||
-rw-r--r-- | volk/python/volk_modtool/cfg.py | 30 | ||||
-rwxr-xr-x | volk/python/volk_modtool/volk_modtool | 26 | ||||
-rw-r--r-- | volk/python/volk_modtool/volk_modtool_generate.py | 96 |
5 files changed, 83 insertions, 83 deletions
diff --git a/volk/python/volk_modtool/README b/volk/python/volk_modtool/README index 5413ff1f1a..5445ed9462 100644 --- a/volk/python/volk_modtool/README +++ b/volk/python/volk_modtool/README @@ -97,7 +97,7 @@ Options for Adding and Removing Kernels: Optional: -b -x, --remove_kernel - Remove kernel from module. + Remove kernel from module. Required: -n. Optional: -b @@ -105,7 +105,7 @@ Options for Listing Kernels: -l, --list Lists all kernels available in the base VOLK module. - -k, --kernels + -k, --kernels Lists all kernels in this VOLK module. -r, --remote-list diff --git a/volk/python/volk_modtool/__init__.py b/volk/python/volk_modtool/__init__.py index 6ddf48da05..e66bb0ac87 100644 --- a/volk/python/volk_modtool/__init__.py +++ b/volk/python/volk_modtool/__init__.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. -# +# from cfg import volk_modtool_config from volk_modtool_generate import volk_modtool 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 - - + + diff --git a/volk/python/volk_modtool/volk_modtool b/volk/python/volk_modtool/volk_modtool index 74b71adde2..9f31b9ea54 100755 --- a/volk/python/volk_modtool/volk_modtool +++ b/volk/python/volk_modtool/volk_modtool @@ -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. -# +# from volk_modtool import volk_modtool, volk_modtool_config from optparse import OptionParser, OptionGroup @@ -47,7 +47,7 @@ if __name__ == '__main__': actions.add_option('-l', '--list', action='store_true', help='List all kernels in the base.') actions.add_option('-k', '--kernels', action='store_true', - help='List all kernels in the module.') + help='List all kernels in the module.') actions.add_option('-r', '--remote_list', action='store_true', help='List all available kernels in remote volk module. Requires: -b.') actions.add_option('-m', '--moo', action='store_true', @@ -57,7 +57,7 @@ if __name__ == '__main__': (options, args) = parser.parse_args(); if len(sys.argv) < 2: parser.print_help() - + elif options.moo: print " (__) " print " (oo) " @@ -65,18 +65,18 @@ if __name__ == '__main__': print " / | || " print " * /\---/\ " print " ~~ ~~ " - + else: my_cfg = volk_modtool_config(options.config_file); - + my_modtool = volk_modtool(my_cfg.get_map(my_cfg.config_name)); - + if options.install: my_modtool.make_module_skeleton(); my_modtool.write_default_cfg(my_cfg.cfg); - + if options.add_kernel: if not options.kernel_name: raise exceptions.IOError("This action requires the -n option."); @@ -96,7 +96,7 @@ if __name__ == '__main__': my_modtool.remove_kernel(name); if options.add_all_kernels: - + if options.base_path: base = options.base_path; else: @@ -115,7 +115,7 @@ if __name__ == '__main__': print i; if options.list: - kernelset = my_modtool.get_current_kernels(); + kernelset = my_modtool.get_current_kernels(); for i in kernelset: print i; diff --git a/volk/python/volk_modtool/volk_modtool_generate.py b/volk/python/volk_modtool/volk_modtool_generate.py index 637d4892ae..746dc01ec8 100644 --- a/volk/python/volk_modtool/volk_modtool_generate.py +++ b/volk/python/volk_modtool/volk_modtool_generate.py @@ -1,23 +1,23 @@ # # 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 os import glob @@ -62,13 +62,13 @@ class volk_modtool: else: hdr_files = glob.glob(os.path.join(base, "kernels/volk_" + name + "/*.h")); begins = re.compile("(?<=volk_" + name + "_).*") - + datatypes = []; functions = []; - - + + for line in hdr_files: - + subline = re.search(".*\.h.*", os.path.basename(line)) if subline: subsubline = begins.search(subline.group(0)); @@ -77,8 +77,8 @@ class volk_modtool: subdtype = re.search("[0-9]+[A-z]+", dtype); if subdtype: datatypes.append(subdtype.group(0)); - - + + datatypes = set(datatypes); for line in hdr_files: @@ -88,11 +88,11 @@ class volk_modtool: subline = re.search(begins.pattern[:-2] + dt + ".*(?=\.h)", line); if subline: functions.append(subline.group(0)); - + return set(functions); def make_module_skeleton(self): - + dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name']) if os.path.exists(dest): raise exceptions.IOError("Destination %s already exits!"%(dest)); @@ -118,7 +118,7 @@ class volk_modtool: if not os.path.exists(os.path.dirname(dest)): os.makedirs(os.path.dirname(dest)) open(dest, 'w+').write(outstring); - + infile = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc'); instring = open(infile, 'r').read(); @@ -140,17 +140,17 @@ class volk_modtool: outfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'volk_modtool.cfg'), 'wb'); cfg.write(outfile); outfile.close(); - - - def convert_kernel(self, oldvolk, name, base, inpath, top): + + + def convert_kernel(self, oldvolk, name, base, inpath, top): infile = os.path.join(inpath, 'kernels/' + top[:-1] + '/' + top + name + '.h'); instring = open(infile, 'r').read(); outstring = re.sub(oldvolk, 'volk_' + self.my_dict['name'], instring); newname = 'volk_' + self.my_dict['name'] + '_' + name + '.h'; relpath = os.path.relpath(infile, base); - newrelpath = re.sub(oldvolk, 'volk_' + self.my_dict['name'], relpath); - dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], os.path.dirname(newrelpath), newname); - + newrelpath = re.sub(oldvolk, 'volk_' + self.my_dict['name'], relpath); + dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], os.path.dirname(newrelpath), newname); + if not os.path.exists(os.path.dirname(dest)): os.makedirs(os.path.dirname(dest)) open(dest, 'w+').write(outstring); @@ -178,23 +178,23 @@ class volk_modtool: base = os.path.join(self.my_dict['destination'], top[:-1]) ; if not name in self.get_current_kernels(): - + raise exceptions.IOError("Requested kernel %s is not in module %s"%(name,base)); - - - + + + inpath = os.path.abspath(base); - - + + kernel = re.compile(name) search_kernels = Set([kernel]) profile = re.compile('^\s*VOLK_PROFILE') puppet = re.compile('^\s*VOLK_PUPPET') src_dest = os.path.join(inpath, 'apps/', top[:-1] + '_profile.cc'); - infile = open(src_dest); + infile = open(src_dest); otherlines = infile.readlines(); open(src_dest, 'w+').write(''); - + for otherline in otherlines: write_okay = True; if kernel.search(otherline): @@ -207,22 +207,22 @@ class volk_modtool: if write_okay: open(src_dest, 'a').write(otherline); - + src_dest = os.path.join(inpath, 'lib/testqa.cc') infile = open(src_dest); otherlines = infile.readlines(); open(src_dest, 'w+').write(''); - + for otherline in otherlines: write_okay = True; - + for kernel in search_kernels: if kernel.search(otherline): write_okay = False; - + if write_okay: open(src_dest, 'a').write(otherline); - + for kernel in search_kernels: infile = os.path.join(inpath, 'kernels/' + top[:-1] + '/' + top + kernel.pattern + '.h'); print "Removing kernel %s"%(kernel.pattern) @@ -235,7 +235,7 @@ class volk_modtool: print orcfile if(os.path.exists(orcfile)): os.remove(orcfile); - + def import_kernel(self, name, base): if not (base): base = self.my_dict['base']; @@ -244,24 +244,24 @@ class volk_modtool: basename = self.get_basename(base); if not name in self.get_current_kernels(base): raise exceptions.IOError("Requested kernel %s is not in module %s"%(name,base)); - + inpath = os.path.abspath(base); if len(basename) > 0: top = 'volk_' + basename + '_'; else: top = 'volk_' oldvolk = re.compile(top[:-1]); - + self.convert_kernel(oldvolk, name, base, inpath, top); - + kernel = re.compile(name) search_kernels = Set([kernel]) profile = re.compile('^\s*VOLK_PROFILE') puppet = re.compile('^\s*VOLK_PUPPET') infile = open(os.path.join(inpath, 'apps/', oldvolk.pattern + '_profile.cc')); - otherinfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'apps/volk_' + self.my_dict['name'] + '_profile.cc')); - dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'apps/volk_' + self.my_dict['name'] + '_profile.cc'); + otherinfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'apps/volk_' + self.my_dict['name'] + '_profile.cc')); + dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'apps/volk_' + self.my_dict['name'] + '_profile.cc'); lines = infile.readlines(); otherlines = otherinfile.readlines(); open(dest, 'w+').write(''); @@ -295,19 +295,19 @@ class volk_modtool: for kernel in search_kernels: print "Adding kernel %s from module %s"%(kernel.pattern,base) - + infile = open(os.path.join(inpath, 'lib/testqa.cc')); - otherinfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc')); - dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc'); + otherinfile = open(os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc')); + dest = os.path.join(self.my_dict['destination'], 'volk_' + self.my_dict['name'], 'lib/testqa.cc'); lines = infile.readlines(); otherlines = otherinfile.readlines(); open(dest, 'w+').write(''); inserted = False; insert = False for otherline in otherlines: - + if (re.match('\s*', otherline) == None or re.match('\s*#.*', otherline) == None): - + insert = True; if insert and not inserted: inserted = True; @@ -323,8 +323,8 @@ class volk_modtool: write_okay = False if write_okay: open(dest, 'a').write(otherline); - - - - + + + + |