当前位置: 首页>>代码示例>>Python>>正文


Python CMakeFileEditor.append_value方法代码示例

本文整理汇总了Python中cmakefile_editor.CMakeFileEditor.append_value方法的典型用法代码示例。如果您正苦于以下问题:Python CMakeFileEditor.append_value方法的具体用法?Python CMakeFileEditor.append_value怎么用?Python CMakeFileEditor.append_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmakefile_editor.CMakeFileEditor的用法示例。


在下文中一共展示了CMakeFileEditor.append_value方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _make_grc_xml_from_block_data

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import append_value [as 别名]
 def _make_grc_xml_from_block_data(self, params, iosig, blockname):
     """ Take the return values from the parser and call the XML
     generator. Also, check the makefile if the .xml file is in there.
     If necessary, add. """
     fname_xml = '%s_%s.xml' % (self._info['modname'], blockname)
     # Some adaptions for the GRC
     for inout in ('in', 'out'):
         if iosig[inout]['max_ports'] == '-1':
             iosig[inout]['max_ports'] = '$num_%sputs' % inout
             params.append({'key': 'num_%sputs' % inout,
                            'type': 'int',
                            'name': 'Num %sputs' % inout,
                            'default': '2',
                            'in_constructor': False})
     if os.path.isfile(os.path.join('grc', fname_xml)):
         if not self._info['yes']:
             if not ask_yes_no('Overwrite existing GRC file?', False):
                 return
         else:
             print "Warning: Overwriting existing GRC file."
     grc_generator = GRCXMLGenerator(
             modname=self._info['modname'],
             blockname=blockname,
             params=params,
             iosig=iosig
     )
     grc_generator.save(os.path.join('grc', fname_xml))
     if not self._skip_subdirs['grc']:
         ed = CMakeFileEditor(self._file['cmgrc'])
         if re.search(fname_xml, ed.cfile) is None and not ed.check_for_glob('*.xml'):
             print "Adding GRC bindings to grc/CMakeLists.txt..."
             ed.append_value('install', fname_xml, to_ignore_end='DESTINATION[^()]+')
             ed.write()
开发者ID:232675,项目名称:gnuradio,代码行数:35,代码来源:modtool_makexml.py

示例2: _run_python_hierblock

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import append_value [as 别名]
 def _run_python_hierblock(self):
     """ Do everything that needs doing in the subdir 'python' to add
     a Python hier_block.
     - add .py file
     - include in CMakeLists.txt
     """
     print "Traversing python..."
     fname_py = self._info['blockname'] + '.py'
     self._write_tpl('hier_python', 'python', fname_py)
     ed = CMakeFileEditor('python/CMakeLists.txt')
     ed.append_value('GR_PYTHON_INSTALL', fname_py, 'DESTINATION[^()]+')
     ed.write()
开发者ID:gr-mueller,项目名称:gr-modtool,代码行数:14,代码来源:modtool_add.py

示例3: _run_grc

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import append_value [as 别名]
 def _run_grc(self):
     """ Do everything that needs doing in the subdir 'grc' to add
     a GRC bindings XML file.
     - add .xml file
     - include in CMakeLists.txt
     """
     print "Traversing grc..."
     fname_grc = self._info['fullblockname'] + '.xml'
     self._write_tpl('grc_xml', 'grc', fname_grc)
     print "Editing grc/CMakeLists.txt..."
     ed = CMakeFileEditor('grc/CMakeLists.txt', '\n    ')
     ed.append_value('install', fname_grc, 'DESTINATION[^()]+')
     ed.write()
开发者ID:gr-mueller,项目名称:gr-modtool,代码行数:15,代码来源:modtool_add.py

示例4: _run_grc

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import append_value [as 别名]
 def _run_grc(self):
     """ Do everything that needs doing in the subdir 'grc' to add
     a GRC bindings XML file.
     - add .xml file
     - include in CMakeLists.txt
     """
     fname_grc = self._info['fullblockname'] + '.xml'
     self._write_tpl('grc_xml', 'grc', fname_grc)
     ed = CMakeFileEditor(self._file['cmgrc'], '\n    ')
     if self.options.skip_cmakefiles or ed.check_for_glob('*.xml'):
         return
     print "Editing grc/CMakeLists.txt..."
     ed.append_value('install', fname_grc, to_ignore_end='DESTINATION[^()]+')
     ed.write()
开发者ID:FalconJeff,项目名称:gnuradio,代码行数:16,代码来源:modtool_add.py

示例5: _run_python

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import append_value [as 别名]
 def _run_python(self):
     """ Do everything that needs doing in the subdir 'python' to add
     a Python block.
     - add .py file
     - include in CMakeLists.txt
     - include in __init__.py
     """
     fname_py = self._info['blockname'] + '.py'
     self._write_tpl('block_python', 'python', fname_py)
     append_re_line_sequence(self._file['pyinit'],
                             '(^from.*import.*\n|# import any pure.*\n)',
                             'from %s import %s' % (self._info['blockname'], self._info['blockname']))
     if self.options.skip_cmakefiles:
         return
     ed = CMakeFileEditor(self._file['cmpython'])
     ed.append_value('GR_PYTHON_INSTALL', fname_py, to_ignore_end='DESTINATION[^()]+')
     ed.write()
开发者ID:FalconJeff,项目名称:gnuradio,代码行数:19,代码来源:modtool_add.py

示例6: _run_lib

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import append_value [as 别名]
    def _run_lib(self):
        """ Do everything that needs doing in the subdir 'lib' and 'include'.
        - add .cc and .h files
        - include them into CMakeLists.txt
        - check if C++ QA code is req'd
        - if yes, create qa_*.{cc,h} and add them to CMakeLists.txt
        """
        print "Traversing lib..."
        fname_h = self._info['fullblockname'] + '.h'
        fname_cc = self._info['fullblockname'] + '.cc'
        if self._info['blocktype'] in ('source', 'sink', 'sync', 'decimator',
                                       'interpolator', 'general', 'hiercpp'):
            self._write_tpl('block_h', 'include', fname_h)
            self._write_tpl('block_cpp', 'lib', fname_cc)
        elif self._info['blocktype'] == 'impl':
            self._write_tpl('impl_h', 'include', fname_h)
            self._write_tpl('impl_cpp', 'lib', fname_cc)
        if not self.options.skip_cmakefiles:
            ed = CMakeFileEditor('lib/CMakeLists.txt')
            ed.append_value('add_library', fname_cc)
            ed.write()
            ed = CMakeFileEditor('include/CMakeLists.txt', '\n    ')
            ed.append_value('install', fname_h, 'DESTINATION[^()]+')
            ed.write()

        if not self._add_cc_qa:
            return
        fname_qa_cc = 'qa_%s' % fname_cc
        self._write_tpl('qa_cpp', 'lib', fname_qa_cc)
        if not self.options.skip_cmakefiles:
            open('lib/CMakeLists.txt', 'a').write(Template.substitute(Templates['qa_cmakeentry'],
                                          {'basename': os.path.splitext(fname_qa_cc)[0],
                                           'filename': fname_qa_cc,
                                           'modname': self._info['modname']}))
            ed = CMakeFileEditor('lib/CMakeLists.txt')
            ed.remove_double_newlines()
            ed.write()
开发者ID:gr-mueller,项目名称:gr-modtool,代码行数:39,代码来源:modtool_add.py

示例7: _run_lib

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import append_value [as 别名]
 def _run_lib(self):
     """ Do everything that needs doing in the subdir 'lib' and 'include'.
     - add .cc and .h files
     - include them into CMakeLists.txt
     - check if C++ QA code is req'd
     - if yes, create qa_*.{cc,h} and add them to CMakeLists.txt
     """
     def _add_qa():
         " Add C++ QA files for 3.7 API "
         fname_qa_h  = 'qa_%s.h'  % self._info['blockname']
         fname_qa_cc = 'qa_%s.cc' % self._info['blockname']
         self._write_tpl('qa_cpp', 'lib', fname_qa_cc)
         self._write_tpl('qa_h',   'lib', fname_qa_h)
         if not self.options.skip_cmakefiles:
             try:
                 append_re_line_sequence(self._file['cmlib'],
                                         '\$\{CMAKE_CURRENT_SOURCE_DIR\}/qa_%s.cc.*\n' % self._info['modname'],
                                         '    ${CMAKE_CURRENT_SOURCE_DIR}/qa_%s.cc' % self._info['blockname'])
                 append_re_line_sequence(self._file['qalib'],
                                         '#include.*\n',
                                         '#include "%s"' % fname_qa_h)
                 append_re_line_sequence(self._file['qalib'],
                                         '(addTest.*suite.*\n|new CppUnit.*TestSuite.*\n)',
                                         '  s->addTest(gr::%s::qa_%s::suite());' % (self._info['modname'],
                                                                                    self._info['blockname'])
                                         )
             except IOError:
                 print "Can't add C++ QA files."
     def _add_qa36():
         " Add C++ QA files for pre-3.7 API (not autotools) "
         fname_qa_cc = 'qa_%s.cc' % self._info['fullblockname']
         self._write_tpl('qa_cpp36', 'lib', fname_qa_cc)
         if not self.options.skip_cmakefiles:
             open(self._file['cmlib'], 'a').write(
                     str(
                         Cheetah.Template.Template(
                             Templates['qa_cmakeentry36'],
                             searchList={'basename': os.path.splitext(fname_qa_cc)[0],
                                         'filename': fname_qa_cc,
                                         'modname': self._info['modname']
                                        }
                         )
                      )
             )
             ed = CMakeFileEditor(self._file['cmlib'])
             ed.remove_double_newlines()
             ed.write()
     fname_cc = None
     fname_h  = None
     if self._info['version']  == '37':
         fname_h  = self._info['blockname'] + '.h'
         fname_cc = self._info['blockname'] + '.cc'
         if self._info['blocktype'] in ('source', 'sink', 'sync', 'decimator',
                                        'interpolator', 'general', 'hier', 'tagged_stream'):
             fname_cc = self._info['blockname'] + '_impl.cc'
             self._write_tpl('block_impl_h',   'lib', self._info['blockname'] + '_impl.h')
         self._write_tpl('block_impl_cpp', 'lib', fname_cc)
         self._write_tpl('block_def_h',    self._info['includedir'], fname_h)
     else: # Pre-3.7 or autotools
         fname_h  = self._info['fullblockname'] + '.h'
         fname_cc = self._info['fullblockname'] + '.cc'
         self._write_tpl('block_h36',   self._info['includedir'], fname_h)
         self._write_tpl('block_cpp36', 'lib',                    fname_cc)
     if not self.options.skip_cmakefiles:
         ed = CMakeFileEditor(self._file['cmlib'])
         if not ed.append_value('list', fname_cc, to_ignore_start='APPEND %s_sources' % self._info['modname']):
             ed.append_value('add_library', fname_cc)
         ed.write()
         ed = CMakeFileEditor(self._file['cminclude'])
         ed.append_value('install', fname_h, to_ignore_end='DESTINATION[^()]+')
         ed.write()
     if self._add_cc_qa:
         if self._info['version'] == '37':
             _add_qa()
         elif self._info['version'] == '36':
             _add_qa36()
         elif self._info['version'] == 'autofoo':
             print "Warning: C++ QA files not supported for autotools."
开发者ID:FalconJeff,项目名称:gnuradio,代码行数:80,代码来源:modtool_add.py


注:本文中的cmakefile_editor.CMakeFileEditor.append_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。