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


Python Pkg.grep方法代码示例

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


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

示例1: check

# 需要导入模块: import Pkg [as 别名]
# 或者: from Pkg import grep [as 别名]

#.........这里部分代码省略.........
                    if arch == 'sparc' and sparc_regex.search(i[1]):
                        yield NonSparc32Binary(pkg, i[0])

		    # stripped ?
		    if not unstrippable.search(i[0]):
			if not_stripped.search(i[1]):
			    yield UnstrippedBinaryOrObject(pkg, i[0])

			# inspect binary file
			bin_info=BinaryInfo(pkg.dirName()+i[0], i[0])

                        # so name in library
                        if so_regex.search(i[0]):
                            has_lib.append(i[0])
                            if not bin_info.soname:
                                yield NoSoname(pkg, i[0])
                            else:
                                if not validso_regex.search(bin_info.soname):
                                    yield InvalidSoname(pkg, i[0], bin_info.soname)
                                else:
                                    (dir, base) = dir_base(i[0])
                                    try:
                                        symlink = dir + bin_info.soname
                                        (perm, owner, group, link, size, md5, mtime, rdev) = files[symlink]
                                        if link != i[0] and link != base and link != '':
                                            yield InvalidLdconfigSymlink(pkg, i[0], link)
                                    except KeyError:
                                        yield NoLdconfigSymlink(pkg, i[0])
                                res=soversion_regex.search(bin_info.soname)
                                if res:
                                    soversion=res.group(1) or res.group(2)
                                    if version == None:
                                        version = soversion
                                    elif version != soversion:
                                        version = -1
                                    
                            if bin_info.non_pic:
                                yield ShlibWithNonPicCode(pkg, i[0])
			# rpath ?
			if bin_info.rpath:
                            for p in bin_info.rpath:
                                if p in system_lib_paths or \
                                   not usr_lib_regex.search(p):
                                    yield BinaryOrShlibDefinesRpath(pkg, i[0], bin_info.rpath)
                                    break

			# statically linked ?
                        is_exec=executable_regex.search(i[1])
			if shared_object_regex.search(i[1]) or \
			   is_exec:

                            if is_exec and bin_regex.search(i[0]):
                                exec_files.append(i[0])
                                
			    if not bin_info.needed and \
                               not (bin_info.soname and \
                                    ldso_soname_regex.search(bin_info.soname)):
				if shared_object_regex.search(i[1]):
				    yield SharedLibWithoutDependencyInformation(pkg, i[0])
				else:
				    yield StaticallyLinkedBinary(pkg, i[0])
			    else:
				# linked against libc ?
				if not libc_regex.search(i[0]) and \
				   ( not bin_info.soname or \
				     ( not libc_regex.search(bin_info.soname) and \
				       not ldso_soname_regex.search(bin_info.soname))):
				    found_libc=0
				    for lib in bin_info.needed:
					if libc_regex.search(lib):
					    found_libc=1
					    break
				    if not found_libc:
					if shared_object_regex.search(i[1]):
					    yield LibraryNotLinkedAgainstLibc(pkg, i[0])
					else:
					    yield ProgramNotLinkedAgainstLibc(pkg, i[0])
            else:
                if reference_regex.search(i[0]):
                    if Pkg.grep('tmp|home', pkg.dirname + '/' + i[0]):
                        yield InvalidDirectoryReference(pkg, i[0])

        if has_lib != []:
            if exec_files != []:
                for f in exec_files:
                    yield ExecutableInLibraryPackage(pkg, f)
            for f in files.keys():
                res=numeric_dir_regex.search(f)
                fn=res and res.group(1) or f
                if not f in exec_files and not so_regex.search(f) and not versioned_dir_regex.search(fn):
                    yield NonVersionedFileInLibraryPackage(pkg, f)
            if version and version != -1 and string.find(pkg.name, version) == -1:
                yield IncoherentVersionInName(pkg, version)

        if arch != 'noarch' and not multi_pkg:
            if binary == 0:
                yield NoBinary(pkg)

        if has_usr_lib_file and not binary_in_usr_lib:
            yield OnlyNonBinaryInUsrLib(pkg)
开发者ID:bhdn,项目名称:scrutiny,代码行数:104,代码来源:BinariesCheck.py

示例2: ExecutableMenuFile

# 需要导入模块: import Pkg [as 别名]
# 或者: from Pkg import grep [as 别名]
             if mode & 0111 != 0:
                 yield ExecutableMenuFile(pkg, f)
             menus.append(f)
     else:
         # Check old menus from KDE and GNOME
         res=old_menu_file_regex.search(f)
         if res:
             mode=files[f][0]
             if stat.S_ISREG(mode):
                 yield OldMenuEntry(pkg, f)
         else:
             # Check non transparent xpm files
             res=xpm_ext_regex.search(f)
             if res:
                 mode=files[f][0]
                 if stat.S_ISREG(mode) and not Pkg.grep('None",', dirname + '/' + f):
                     yield NonTransparentXpm(pkg, f)
 if len(menus) > 0:
     dir=pkg.dirName()
     if menus != []:
         postin=pkg[rpm.RPMTAG_POSTIN] or pkg[rpm.RPMTAG_POSTINPROG]
         if not postin:
             yield MenuWithoutPostin(pkg)
         else:
             if not update_menus_regex.search(postin):
                 yield PostinWithoutUpdateMenus(pkg)                    
             
         postun=pkg[rpm.RPMTAG_POSTUN] or pkg[rpm.RPMTAG_POSTUNPROG]
         if not postun:
             yield MenuWithoutPostun(pkg)
         else:
开发者ID:bhdn,项目名称:scrutiny,代码行数:33,代码来源:MenuCheck.py


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