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


Python CMakeFileEditor.remove_value方法代码示例

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


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

示例1: _run_subdir

# 需要导入模块: from cmakefile_editor import CMakeFileEditor [as 别名]
# 或者: from cmakefile_editor.CMakeFileEditor import remove_value [as 别名]
 def _run_subdir(self, path, globs, makefile_vars, cmakeedit_func=None):
     """ Delete all files that match a certain pattern in path.
     path - The directory in which this will take place
     globs - A tuple of standard UNIX globs of files to delete (e.g. *.xml)
     makefile_vars - A tuple with a list of CMakeLists.txt-variables which
                     may contain references to the globbed files
     cmakeedit_func - If the CMakeLists.txt needs special editing, use this
     """
     # 1. Create a filtered list
     files = []
     for g in globs:
         files = files + sorted(glob.glob("%s/%s"% (path, g)))
     files_filt = []
     print "Searching for matching files in %s/:" % path
     for f in files:
         if re.search(self._info['pattern'], os.path.basename(f)) is not None:
             files_filt.append(f)
     if not files_filt:
         print "None found."
         return []
     # 2. Delete files, Makefile entries and other occurrences
     files_deleted = []
     ed = CMakeFileEditor('%s/CMakeLists.txt' % path)
     yes = self._info['yes']
     for f in files_filt:
         b = os.path.basename(f)
         if not yes:
             ans = raw_input("Really delete %s? [Y/n/a/q]: " % f).lower().strip()
             if ans == 'a':
                 yes = True
             if ans == 'q':
                 sys.exit(0)
             if ans == 'n':
                 continue
         files_deleted.append(b)
         print "Deleting %s." % f
         self.scm.remove_file(f)
         os.unlink(f)
         print "Deleting occurrences of %s from %s/CMakeLists.txt..." % (b, path)
         for var in makefile_vars:
             ed.remove_value(var, b)
         if cmakeedit_func is not None:
             cmakeedit_func(b, ed)
     ed.write()
     self.scm.mark_files_updated(('%s/CMakeLists.txt' % path,))
     return files_deleted
开发者ID:mmaroti,项目名称:gnuradio,代码行数:48,代码来源:modtool_rm.py


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