當前位置: 首頁>>代碼示例>>Python>>正文


Python index.Link方法代碼示例

本文整理匯總了Python中pip._internal.index.Link方法的典型用法代碼示例。如果您正苦於以下問題:Python index.Link方法的具體用法?Python index.Link怎麽用?Python index.Link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pip._internal.index的用法示例。


在下文中一共展示了index.Link方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: from_editable

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import Link [as 別名]
def from_editable(cls, editable_req, comes_from=None, isolated=False,
                      options=None, wheel_cache=None, constraint=False):
        from pip._internal.index import Link

        name, url, extras_override = parse_editable(editable_req)
        if url.startswith('file:'):
            source_dir = url_to_path(url)
        else:
            source_dir = None

        if name is not None:
            try:
                req = Requirement(name)
            except InvalidRequirement:
                raise InstallationError("Invalid requirement: '%s'" % name)
        else:
            req = None
        return cls(
            req, comes_from, source_dir=source_dir,
            editable=True,
            link=Link(url),
            constraint=constraint,
            isolated=isolated,
            options=options if options else {},
            wheel_cache=wheel_cache,
            extras=extras_override or (),
        ) 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:29,代碼來源:req_install.py

示例2: get_location

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import Link [as 別名]
def get_location(self, dist, dependency_links):
        for url in dependency_links:
            egg_fragment = Link(url).egg_fragment
            if not egg_fragment:
                continue
            if '-' in egg_fragment:
                # FIXME: will this work when a package has - in the name?
                key = '-'.join(egg_fragment.split('-')[:-1]).lower()
            else:
                key = egg_fragment
            if key == dist.key:
                return url.split('#', 1)[0]
        return None 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:15,代碼來源:subversion.py

示例3: _link_for_candidate

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import Link [as 別名]
def _link_for_candidate(self, link, candidate):
        root = self.get_path_for_link(link)
        path = os.path.join(root, candidate)

        return index.Link(path_to_url(path)) 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:7,代碼來源:cache.py

示例4: download_url

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import Link [as 別名]
def download_url(url, download_dir, sha256=None):
    """Download and optionally verify a file.

    Returns the downloaded file path.

    If sha256 is not specified (default), the file is not verified.

    Raises HashMismatch if the file hash does not match the specified
    sha256 hash.

    If the file was already downloaded, returns its path after
    verifying it. If the file cannot be verified, raises HashMismatch
    without attempting download again. If the hash is valid but the
    download is not, the download must be deleted before trying
    again. This behavior is designed to preserve downloads at the cost
    of requiring that invalid files be explicitly deleted.
    """
    from pip._internal.index import Link

    link = Link(url)
    downloaded_path = _check_download_path(link, download_dir, sha256)
    if not downloaded_path:
        orig_path = _pip_download(link, download_dir)
        downloaded_path = _ensure_expected_download_path(orig_path, link)
        if sha256:
            _verify_and_cache_hash(downloaded_path, sha256)
    return downloaded_path 
開發者ID:guildai,項目名稱:guildai,代碼行數:29,代碼來源:pip_util.py

示例5: optimistic_wheel_search

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import Link [as 別名]
def optimistic_wheel_search(req, index_urls):
    name = req.name.replace('-', '_').lower()

    for index_url in index_urls:
        expected_location = os.path.join(
            CACHE.wheelhouse, index_url, ignorecase_glob(name) + '-*.whl',
        )
        for link in glob.glob(expected_location):
            link = Link('file:' + link)
            wheel = Wheel(link.filename)
            if req.specifier.contains(wheel.version) and wheel.supported():
                return link 
開發者ID:Yelp,項目名稱:venv-update,代碼行數:14,代碼來源:pip_faster.py

示例6: __init__

# 需要導入模塊: from pip._internal import index [as 別名]
# 或者: from pip._internal.index import Link [as 別名]
def __init__(self, req, comes_from, source_dir=None, editable=False,
                 link=None, update=True, markers=None,
                 isolated=False, options=None, wheel_cache=None,
                 constraint=False, extras=()):
        assert req is None or isinstance(req, Requirement), req
        self.req = req
        self.comes_from = comes_from
        self.constraint = constraint
        if source_dir is not None:
            self.source_dir = os.path.normpath(os.path.abspath(source_dir))
        else:
            self.source_dir = None
        self.editable = editable

        self._wheel_cache = wheel_cache
        if link is not None:
            self.link = self.original_link = link
        else:
            from pip._internal.index import Link
            self.link = self.original_link = req and req.url and Link(req.url)

        if extras:
            self.extras = extras
        elif req:
            self.extras = {
                pkg_resources.safe_extra(extra) for extra in req.extras
            }
        else:
            self.extras = set()
        if markers is not None:
            self.markers = markers
        else:
            self.markers = req and req.marker
        self._egg_info_path = None
        # This holds the pkg_resources.Distribution object if this requirement
        # is already available:
        self.satisfied_by = None
        # This hold the pkg_resources.Distribution object if this requirement
        # conflicts with another installed distribution:
        self.conflicts_with = None
        # Temporary build location
        self._temp_build_dir = TempDirectory(kind="req-build")
        # Used to store the global directory where the _temp_build_dir should
        # have been created. Cf _correct_build_location method.
        self._ideal_build_dir = None
        # True if the editable should be updated:
        self.update = update
        # Set to True after successful installation
        self.install_succeeded = None
        # UninstallPathSet of uninstalled distribution (for possible rollback)
        self.uninstalled_pathset = None
        self.options = options if options else {}
        # Set to True after successful preparation of this requirement
        self.prepared = False
        self.is_direct = False

        self.isolated = isolated
        self.build_env = BuildEnvironment(no_clean=True) 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:60,代碼來源:req_install.py


注:本文中的pip._internal.index.Link方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。