• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python portage.pkgsplit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中portage.pkgsplit函数的典型用法代码示例。如果您正苦于以下问题:Python pkgsplit函数的具体用法?Python pkgsplit怎么用?Python pkgsplit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: revisionMatch

def revisionMatch(revisionAtom, portdb, match_type="default"):
	"""
	handler for the special >~, >=~, <=~ and <~ atoms that are supposed to behave
	as > and < except that they are limited to the same version, the range only
	applies to the revision part.

	@type	revisionAtom: string
	@param	revisionAtom: a <~ or >~ atom that contains the atom to match against
	@type	portdb: portage.dbapi
	@param	portdb:	one of the portage databases to use as information source
	@type	match_type: string
	@param	match_type: if != "default" passed as first argument to portdb.xmatch
				to apply the wanted visibility filters

	@rtype:		list of strings
	@return:	a list with the matching versions
	"""
	if match_type == "default" or not hasattr(portdb, "xmatch"):
		if ":" in revisionAtom:
			mylist = portdb.match(re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
		else:
			mylist = portdb.match(re.sub("-r[0-9]+$", "", revisionAtom[2:]))
	else:
		if ":" in revisionAtom:
			mylist = portdb.xmatch(match_type, re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
		else:
			mylist = portdb.xmatch(match_type, re.sub("-r[0-9]+$", "", revisionAtom[2:]))
	rValue = []
	for v in mylist:
		r1 = portage.pkgsplit(v)[-1][1:]
		r2 = portage.pkgsplit(revisionAtom[3:])[-1][1:]
		if eval(r1+" "+revisionAtom[0:2]+" "+r2):
			rValue.append(v)
	return rValue
开发者ID:zmedico,项目名称:gentoolkit,代码行数:34,代码来源:__init__.py


示例2: get_max_version

    def get_max_version(self, category, name):
        """
        Get the recent available version of a package.

        Args:
            category: Category name.
            name: package name.

        Returns:
            The recent version of a package.
        """
        if not category or (not category in self.categories):
            raise InvalidKeyError('No such category: ' + category)

        if not category in self.database \
           or not name in self.database[category]['packages']:
            raise InvalidKeyError('No such package: ' + category + '/' + name)

        pkgname = category + '/' + name
        versions = list(self.database[category]['packages'][name])
        max_ver = versions[0]
        for version in versions[1:]:
            if portage.pkgcmp(portage.pkgsplit(pkgname + '-' + version),
                              portage.pkgsplit(pkgname + '-' + max_ver)) > 0:
                max_ver = version
        return max_ver
开发者ID:jauhien,项目名称:g-sorcery,代码行数:26,代码来源:package_db.py


示例3: search_ebuilds

def search_ebuilds(path, portdir=True, searchdef="", repo_num="",
        config=None, data=None):
    pv = ""
    pkgs = []
    nr = len(data['ebuilds']) + 1

    if portdir:
        rep = darkgreen("Portage    ")
    else:
        rep = red("Overlay "+str(repo_num)+"  ")

    if isdir(path):
        filelist = listdir(path)

        for file in filelist:
            if file[-7:] == ".ebuild":
                pv = file[:-7]
                pkgs.append(list(pkgsplit(pv)))
                pkgs[-1].append(path + file)
                if searchdef != "" and pv == searchdef:
                    data['defebuild'] = (searchdef, pkgs[-1][3])
        if not portdir:
            config['found_in_overlay'] = True
        pkgs.sort(key=cmp_sort_key(mypkgcmp))
        for pkg in pkgs:
            rev = ""
            if pkg[2] != "r0":
                rev = "-" + pkg[2]
            data['output'].append(" " + rep + " [" + bold(str(nr)) + "] " +
                pkg[0] + "-" + pkg[1] + rev + "\n")
            data['ebuilds'].append(pkg[len(pkg)-1])
            nr += 1
开发者ID:magical,项目名称:esearch,代码行数:32,代码来源:search.py


示例4: scan_upstream_urls

def scan_upstream_urls(cpv, urls):
    versions = []

    for filename in urls:
        for url in urls[filename]:
            if not CONFIG['quiet']:
                pp.uprint()
            euscan.output.einfo("SRC_URI is '%s'" % url)

            if '://' not in url:
                euscan.output.einfo("Invalid url '%s'" % url)
                continue

            ''' Try normal scan '''
            if CONFIG["scan-dir"]:
                versions.extend(handlers.scan(cpv, url))

            if versions and CONFIG['oneshot']:
                break

            ''' Brute Force '''
            if CONFIG["brute-force"] > 0:
                versions.extend(handlers.brute_force(cpv, url))

            if versions and CONFIG['oneshot']:
                break

    cp, ver, rev = portage.pkgsplit(cpv)
    return filter_versions(cp, versions)
开发者ID:tomspur,项目名称:euscan,代码行数:29,代码来源:scan.py


示例5: scan_pkg

def scan_pkg(pkg, options):
    cp, ver, rev = portage.pkgsplit(pkg.cpv)

    package = options['data'].strip()

    output.einfo("Using FreeCode handler: " + package)

    fp = urllib.urlopen("http://freecode.com/projects/%s/releases" % package)
    content = fp.read()

    result = re.findall(
        r'<a href="/projects/%s/releases/(\d+)">([^<]+)</a>' % package,
        content
    )

    ret = []
    for release_id, up_pv in result:
        pv = mangling.mangle_version(up_pv, options)
        if helpers.version_filtered(cp, ver, pv):
            continue
        fp = urllib.urlopen("http://freecode.com/projects/%s/releases/%s" %
                            (package, release_id))
        content = fp.read()
        download_page = re.findall(r'<a href="(/urls/[^"]+)"', content)[0]
        fp = urllib.urlopen("http://freecode.com%s" % download_page)
        content = fp.read()
        url = re.findall(
            r'In case it doesn\'t, click here: <a href="([^"]+)"',
            content
        )[0]
        ret.append((url, pv, HANDLER_NAME, CONFIDENCE))
    return ret
开发者ID:EvaSDK,项目名称:euscan,代码行数:32,代码来源:freecode.py


示例6: scan_pkg

def scan_pkg(pkg, options):
    gem = options['data']
    url = 'http://rubygems.org/api/v1/versions/%s.json' % gem

    try:
        fp = helpers.urlopen(url)
    except urllib2.URLError:
        return []
    except IOError:
        return []

    if not fp:
        return []

    data = fp.read()
    versions = json.loads(data)

    cp, ver, rev = portage.pkgsplit(pkg.cpv)

    ret = []
    for version in versions:
        up_pv = version['number']
        pv = mangling.mangle_version(up_pv, options)
        if helpers.version_filtered(cp, ver, pv):
            continue
        url = 'http://rubygems.org/gems/%s-%s.gem' % (gem, up_pv)
        url = mangling.mangle_url(url, options)
        ret.append((url, pv, HANDLER_NAME, CONFIDENCE))
    return ret
开发者ID:EvaSDK,项目名称:euscan,代码行数:29,代码来源:rubygems.py


示例7: scan

def scan(cpv, url):
    'http://developer.github.com/v3/repos/downloads/'

    user, project, filename = guess_package(cpv, url)

    # find out where version is expected to be found
    cp, ver, rev = portage.pkgsplit(cpv)
    if ver not in filename:
        return

    # now create a filename-matching regexp
    # XXX: supposedly replace first with (?P<foo>...)
    # and remaining ones with (?P=foo)
    fnre = re.compile('^%s$' % re.escape(filename).replace(re.escape(ver), '(.*?)'))

    output.einfo("Using github API for: " + '/'.join(package))

    dlreq = urllib2.urlopen('https://api.github.com/repos/%s/%s/downloads' % (user, project))
    dls = json.load(dlreq)

    for dl in dls:
        m = fnre.match(dl['name'])

        if m:
            pv = helpers.gentoo_mangle_version(m.group(1))
            if helpers.version_filtered(cp, ver, pv):
                continue
            yield (dl['html_url'], pv, HANDLER_NAME, CONFIDENCE)
开发者ID:mgorny,项目名称:euscan,代码行数:28,代码来源:github.py


示例8: scan

def scan(cpv, url):
    'http://wiki.python.org/moin/PyPiXmlRpc'

    package = guess_package(cpv, url)

    output.einfo("Using PyPi XMLRPC: " + package)

    client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
    versions = client.package_releases(package)

    if not versions:
        return versions

    versions.reverse()

    cp, ver, rev = portage.pkgsplit(cpv)

    ret = []

    for up_pv in versions:
        pv = helpers.gentoo_mangle_version(up_pv)
        if helpers.version_filtered(cp, ver, pv):
            continue
        urls = client.release_urls(package, up_pv)
        urls = " ".join([infos['url'] for infos in urls])
        ret.append((urls, pv, HANDLER_NAME, CONFIDENCE))

    return ret
开发者ID:mgorny,项目名称:euscan,代码行数:28,代码来源:pypi.py


示例9: scan_pkg

def scan_pkg(pkg, options):
    package = options['data']

    output.einfo("Using PyPi XMLRPC: " + package)

    client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
    versions = client.package_releases(package)

    if not versions:
        return versions

    versions.reverse()

    cp, ver, rev = portage.pkgsplit(pkg.cpv)

    ret = []
    for up_pv in versions:
        pv = mangling.mangle_version(up_pv, options)
        if helpers.version_filtered(cp, ver, pv):
            continue
        urls = client.release_urls(package, up_pv)
        urls = " ".join([mangling.mangle_url(infos['url'], options)
                         for infos in urls])
        ret.append((urls, pv, HANDLER_NAME, CONFIDENCE))
    return ret
开发者ID:EvaSDK,项目名称:euscan,代码行数:25,代码来源:pypi.py


示例10: scan_pkg

def scan_pkg(pkg, options):
    cp, ver, rev = portage.pkgsplit(pkg.cpv)

    packages_url, package_name = options['data'].strip().split(" ", 1)

    output.einfo("Using Debian Packages: " + packages_url)

    fp = urllib.urlopen(packages_url)
    content = fp.read()

    # Support for .gz and .bz2 Packages file
    if packages_url.endswith(".bz2"):
        content = bz2.decompress(content)
    if packages_url.endswith(".gz"):
        content = zlib.decompress(content, 16 + zlib.MAX_WBITS)

    content = content.split("\n\n")

    result = []

    for package_info in content:
        package_line = re.search(r"^Package: (.*)$", package_info, re.M)
        version_line = re.search(r"^Version: (.*)$", package_info, re.M)
        if package_line and package_line.group(1) == package_name:
            if version_line:
                result.append(version_line.group(1))

    ret = []
    for up_pv in result:
        url = ""  # TODO: How to find the url?
        pv = mangling.mangle_version(up_pv, options)
        if helpers.version_filtered(cp, ver, pv):
            continue
        ret.append((url, pv, HANDLER_NAME, CONFIDENCE))
    return ret
开发者ID:EvaSDK,项目名称:euscan,代码行数:35,代码来源:deb.py


示例11: scan

def scan(cpv, url):
    for bu in SCANDIR_BLACKLIST_URLS:
        if re.match(bu, url):
            euscan.output.einfo("%s is blacklisted by rule %s" % (url, bu))
            return []

    resolved_url = helpers.parse_mirror(url)
    if not resolved_url:
        return []

    cp, ver, rev = portage.pkgsplit(cpv)

    # 'Hack' for _beta/_rc versions where _ is used instead of -
    if ver not in resolved_url:
        newver = helpers.version_change_end_sep(ver)
        if newver and newver in resolved_url:
            euscan.output.einfo(
                "Version: using %s instead of %s" % (newver, ver)
            )
            ver = newver

    template = helpers.template_from_url(resolved_url, ver)
    if '${' not in template:
        euscan.output.einfo(
            "Url doesn't seems to depend on version: %s not found in %s" %
            (ver, resolved_url)
        )
        return []
    else:
        euscan.output.einfo("Scanning: %s" % template)

    steps = helpers.generate_scan_paths(template)
    return scan_directory_recursive(cp, ver, rev, "", steps, url)
开发者ID:bacher09,项目名称:euscan,代码行数:33,代码来源:generic.py


示例12: scan_url

def scan_url(pkg, url, options):
    cp, ver, rev = portage.pkgsplit(pkg.cpv)
    remote_pkg = guess_package(cp, url)

    output.einfo("Using CPAN API: %s", remote_pkg)

    return scan_pkg(pkg, {"data": remote_pkg})
开发者ID:EvaSDK,项目名称:euscan,代码行数:7,代码来源:cpan.py


示例13: scan

def scan(cpv, url):
    'http://wiki.python.org/moin/PyPiXmlRpc'


    package = guess_package(cpv, url)

    euscan.output.einfo("Using PyPi XMLRPC: " + package)

    client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
    versions = client.package_releases(package)

    if not versions:
        return versions

    versions.reverse()

    cp, ver, rev = portage.pkgsplit(cpv)

    ret = []

    for version in versions:
        if helpers.version_filtered(cp, ver, version):
            continue
        urls = client.release_urls(package, version)
        urls = " ".join([ infos['url'] for infos in urls ])
        ret.append(( urls, version ))

    return ret
开发者ID:tomspur,项目名称:euscan,代码行数:28,代码来源:pypi.py


示例14: scan_url

def scan_url(pkg, url, options):
    'http://developer.github.com/v3/repos/downloads/'

    user, project, filename = guess_package(pkg.cpv, url)

    # find out where version is expected to be found
    cp, ver, rev = portage.pkgsplit(pkg.cpv)
    if ver not in filename:
        return

    # now create a filename-matching regexp
    # XXX: supposedly replace first with (?P<foo>...)
    # and remaining ones with (?P=foo)
    fnre = re.compile('^%s$' % \
                      re.escape(filename).replace(re.escape(ver), '(.*?)'))

    output.einfo("Using github API for: project=%s user=%s filename=%s" % \
                 (project, user, filename))

    dlreq = urllib2.urlopen('https://api.github.com/repos/%s/%s/downloads' % \
                            (user, project))
    dls = json.load(dlreq)

    ret = []
    for dl in dls:
        m = fnre.match(dl['name'])

        if m:
            pv = mangling.mangle_version(m.group(1), options)
            if helpers.version_filtered(cp, ver, pv):
                continue

            url = mangling.mangle_url(dl['html_url'], options)
            ret.append((url, pv, HANDLER_NAME, CONFIDENCE))
    return ret
开发者ID:EvaSDK,项目名称:euscan,代码行数:35,代码来源:github.py


示例15: re_find_package_name

def re_find_package_name(package, regexps, uri):
    if not isinstance(regexps, (list, tuple)):
        regexps = ((regexps, 1),)

    match = None
    group = -1

    for regexp in regexps:
        if isinstance(regexp, (list, tuple)):
            regexp, group = regexp
        else:
            group = 1
        match = regexp.match(uri)
        if match:
            break

    if not match:
        sys.stderr.write(pp.warn("Can't find package name in '%s'" % uri))
        return None

    package_name = match.group(group)

    # Try to strip version, if present
    if "-%s" % package.version in package_name:
        package_name.replace("-%s" % package.version, "")
    cpv = "fake/" + package_name
    cpv = portage.pkgsplit(cpv)

    if cpv:
        package_name = cpv[0].replace("fake/", "", 1)
    return package_name
开发者ID:iksaif,项目名称:portage-janitor,代码行数:31,代码来源:remoteids.py


示例16: scan_url

def scan_url(pkg, url, options):
    output.einfo("Using BerliOS handler")

    cp, ver, rev = portage.pkgsplit(pkg.cpv)

    project, filename = re.search(berlios_regex, url).groups()

    project_page = "http://developer.berlios.de/projects/%s" % project
    content = urllib.urlopen(project_page).read()

    project_id = re.search(
        r"/project/filelist.php\?group_id=(\d+)",
        content
    ).group(1)

    base_url = (
        "http://developer.berlios.de/project/filelist.php?group_id=%s" %
        project_id
    )

    file_pattern = regex_from_template(
        filename.replace(ver, "${PV}")
    )

    result = url_scan(pkg, base_url, file_pattern)

    ret = []
    for found_url, pv, _, _ in result:
        found_url = found_url.replace("prdownload", "download")
        ret.append((found_url, pv, HANDLER_NAME, CONFIDENCE))
    return ret
开发者ID:EvaSDK,项目名称:euscan,代码行数:31,代码来源:berlios.py


示例17: get_v

def get_v(cpv):
    "cpv can be anything"
    if portage.isjustname(cpv):
        raise Exception('Input (%s) has no version!' % cpv)
    pv = portage.pkgsplit(cpv)[-2:]
    if pv[1] == 'r0':
        return pv[0]
    else:
        return '%s-%s' % (pv[0], pv[1])
开发者ID:Acidburn0zzz,项目名称:Manroswelloo-gnome,代码行数:9,代码来源:gst-plugins-bump.py


示例18: can_handle

def can_handle(pkg, url=None):
    if not url:
        return False

    cp, ver, rev = portage.pkgsplit(pkg.cpv)
    if ver not in url:
        return False

    return re.search(berlios_regex, url)
开发者ID:EvaSDK,项目名称:euscan,代码行数:9,代码来源:berlios.py


示例19: can_handle

def can_handle(pkg, url=None):
    if not url:
        return False

    cp, ver, rev = portage.pkgsplit(pkg.cpv)
    if ver not in url:
        return False

    return re.match(package_name_regex, url)
开发者ID:EvaSDK,项目名称:euscan,代码行数:9,代码来源:google_code.py


示例20: guess_gem

def guess_gem(cpv, url):
    match = re.search('mirror://rubygems/(.*).gem', url)
    if match:
        cpv = 'fake/%s' % match.group(1)

    cp, ver, rev = portage.pkgsplit(cpv)
    cat, pkg = cp.split("/")

    return pkg
开发者ID:tomspur,项目名称:euscan,代码行数:9,代码来源:rubygem.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python config.get_from_config函数代码示例发布时间:2022-05-27
下一篇:
Python portage.eapi_is_supported函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap