コード例 #1
0
def create_depend(package, dep_str, deptype='D'):
    depend = Depend(pkg=package, deptype=deptype)
    # lop off any description first, don't get confused by epoch
    parts = dep_str.split(': ', 1)
    if len(parts) > 1:
        depend.description = parts[1].strip()
    match = DEPEND_RE.match(parts[0].strip())
    if match:
        depend.name = match.group(1)
        if match.group(3):
            depend.comparison = match.group(3)
        if match.group(4):
            depend.version = match.group(4)
    else:
        logger.warning('Package %s had unparsable depend string %s',
                package.pkgname, dep_str)
        return None
    return depend
コード例 #2
0
ファイル: reporead.py プロジェクト: fidget77/test
def create_depend(package, dep_str, deptype='D'):
    depend = Depend(pkg=package, deptype=deptype)
    # lop off any description first
    parts = dep_str.split(':', 1)
    if len(parts) > 1:
        depend.description = parts[1].strip()
    match = DEPEND_RE.match(parts[0].strip())
    if match:
        depend.name = match.group(1)
        if match.group(3):
            depend.comparison = match.group(3)
        if match.group(4):
            depend.version = match.group(4)
    else:
        logger.warning('Package %s had unparsable depend string %s',
                       package.pkgname, dep_str)
        return None
    return depend