diff options
author | Nathan West <nathan.west@okstate.edu> | 2014-02-09 21:24:40 -0600 |
---|---|---|
committer | Nathan West <nathan.west@okstate.edu> | 2014-03-02 14:28:26 -0600 |
commit | 05161c9f48acf448d31abd88a5378608213e3574 (patch) | |
tree | 865e2400fd1fb0a921c2d0ba1fbeae0f88a56150 /volk/python | |
parent | 103ca46c2e08403c39918ef4917344d29e44f50c (diff) |
volk: add/remove ORC protokernels in volk_modtool
Diffstat (limited to 'volk/python')
-rw-r--r-- | volk/python/volk_modtool/volk_modtool_generate.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/volk/python/volk_modtool/volk_modtool_generate.py b/volk/python/volk_modtool/volk_modtool_generate.py index 80c2aed598..637d4892ae 100644 --- a/volk/python/volk_modtool/volk_modtool_generate.py +++ b/volk/python/volk_modtool/volk_modtool_generate.py @@ -20,6 +20,7 @@ # import os +import glob import sys import re import glob @@ -150,12 +151,24 @@ class volk_modtool: 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); + # copy orc proto-kernels if they exist + for orcfile in glob.glob(inpath + '/orc/' + top + name + '*.orc'): + if os.path.isfile(orcfile): + instring = open(orcfile, 'r').read(); + outstring = re.sub(oldvolk, 'volk_' + self.my_dict['name'], instring); + newname = 'volk_' + self.my_dict['name'] + '_' + name + '.orc'; + relpath = os.path.relpath(orcfile, 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); + if not os.path.exists(os.path.dirname(dest)): + os.makedirs(os.path.dirname(dest)); + open(dest, 'w+').write(outstring) + + def remove_kernel(self, name): basename = self.my_dict['name']; if len(basename) > 0: @@ -215,6 +228,13 @@ class volk_modtool: print "Removing kernel %s"%(kernel.pattern) if os.path.exists(infile): os.remove(infile); + # remove the orc proto-kernels if they exist. There are no puppets here + # so just need to glob for files matching kernel name + print glob.glob(inpath + '/orc/' + top + name + '*.orc'); + for orcfile in glob.glob(inpath + '/orc/' + top + name + '*.orc'): + print orcfile + if(os.path.exists(orcfile)): + os.remove(orcfile); def import_kernel(self, name, base): if not (base): |