diff options
author | Josh Morman <mormjb@gmail.com> | 2020-04-23 15:03:55 -0400 |
---|---|---|
committer | Josh Morman <mormjb@gmail.com> | 2020-06-04 10:05:48 -0400 |
commit | 999c0e723240ee783bca17942f77a9d05bbfc168 (patch) | |
tree | 3661aeb0ef10bad228df014a20e5b0a63627c833 /gr-utils/modtool/core/disable.py | |
parent | a4e6d4d55b35ac36dd5915dec5145073d8ec3b9a (diff) |
utils: add functionality to generate bindings
This currently exists in two places
1) Bindtool (longevity TBD) which calls blocktool to parse the public
header file in the include directory
2) Modtool - binding of headers added to add and bind. rm, update,
info, etc still TODO
Diffstat (limited to 'gr-utils/modtool/core/disable.py')
-rw-r--r-- | gr-utils/modtool/core/disable.py | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/gr-utils/modtool/core/disable.py b/gr-utils/modtool/core/disable.py index 2047a49935..9b2f428b31 100644 --- a/gr-utils/modtool/core/disable.py +++ b/gr-utils/modtool/core/disable.py @@ -78,41 +78,6 @@ class ModToolDisable(ModTool): cmake.comment_out_lines('GR_ADD_TEST.*'+os.path.splitext(fname)[0]) self.scm.mark_file_updated(cmake.filename) return True - def _handle_h_swig(cmake, fname): - """ Comment out include files from the SWIG file, - as well as the block magic """ - with open(self._file['swig']) as f: - swigfile = f.read() - (swigfile, nsubs) = re.subn(f'(.include\s+"({self.info["modname"]}/)?{fname}")', - r'//\1', swigfile) - if nsubs > 0: - logger.info(f"Changing {self._file['swig']}...") - if nsubs > 1: # Need to find a single BLOCK_MAGIC - blockname = os.path.splitext(fname[len(self.info['modname'])+1:])[0] - if self.info['version'] in ('37', '38'): - blockname = os.path.splitext(fname)[0] - (swigfile, nsubs) = re.subn(f'(GR_SWIG_BLOCK_MAGIC2?.+{blockname}.+;)', r'//\1', swigfile) - if nsubs > 1: - logger.warning(f"Hm, changed more then expected while editing {self._file['swig']}.") - with open(self._file['swig'], 'w') as f: - f.write(swigfile) - self.scm.mark_file_updated(self._file['swig']) - return False - def _handle_i_swig(cmake, fname): - """ Comment out include files from the SWIG file, - as well as the block magic """ - with open(self._file['swig']) as f: - swigfile = f.read() - blockname = os.path.splitext(fname[len(self.info['modname'])+1:])[0] - if self.info['version'] in ('37', '38'): - blockname = os.path.splitext(fname)[0] - swigfile = re.sub(r'(%include\s+"'+fname+'")', r'//\1', swigfile) - logger.info(f"Changing {self._file['swig']}...") - swigfile = re.sub('(GR_SWIG_BLOCK_MAGIC2?.+'+blockname+'.+;)', r'//\1', swigfile) - with open(self._file['swig'], 'w') as f: - f.write(swigfile) - self.scm.mark_file_updated(self._file['swig']) - return False # This portion will be covered by the CLI if not self.cli: @@ -123,10 +88,7 @@ class ModToolDisable(ModTool): special_treatments = ( ('python', r'qa.+py$', _handle_py_qa), ('python', r'^(?!qa).+py$', _handle_py_mod), - ('lib', r'qa.+\.cc$', _handle_cc_qa), - (f'include/{self.info["modname"]}', r'.+\.h$', _handle_h_swig), - ('include', r'.+\.h$', _handle_h_swig), - ('swig', r'.+\.i$', _handle_i_swig) + ('lib', r'qa.+\.cc$', _handle_cc_qa) ) for subdir in self._subdirs: if self.skip_subdirs[subdir]: |