本文整理汇总了Python中pip.index.Link方法的典型用法代码示例。如果您正苦于以下问题:Python index.Link方法的具体用法?Python index.Link怎么用?Python index.Link使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip.index
的用法示例。
在下文中一共展示了index.Link方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_editable
# 需要导入模块: from pip import index [as 别名]
# 或者: from pip.index import Link [as 别名]
def from_editable(cls, editable_req, comes_from=None, default_vcs=None,
isolated=False, options=None, wheel_cache=None,
constraint=False):
from pip.index import Link
name, url, extras_override = parse_editable(
editable_req, default_vcs)
if url.startswith('file:'):
source_dir = url_to_path(url)
else:
source_dir = None
res = cls(name, comes_from, source_dir=source_dir,
editable=True,
link=Link(url),
constraint=constraint,
isolated=isolated,
options=options if options else {},
wheel_cache=wheel_cache)
if extras_override is not None:
res.extras = _safe_extras(extras_override)
return res
示例2: from_editable
# 需要导入模块: from pip import index [as 别名]
# 或者: from pip.index import Link [as 别名]
def from_editable(cls, editable_req, comes_from=None, default_vcs=None,
isolated=False, options=None, wheel_cache=None,
constraint=False):
from pip.index import Link
name, url, extras_override = parse_editable(
editable_req, default_vcs)
if url.startswith('file:'):
source_dir = url_to_path(url)
else:
source_dir = None
res = cls(name, comes_from, source_dir=source_dir,
editable=True,
link=Link(url),
constraint=constraint,
isolated=isolated,
options=options if options else {},
wheel_cache=wheel_cache)
if extras_override is not None:
res.extras = extras_override
return res
示例3: _get_vcs_version
# 需要导入模块: from pip import index [as 别名]
# 或者: from pip.index import Link [as 别名]
def _get_vcs_version(self, url, rev):
tmp_dir = tempfile.mkdtemp()
current_dir = self._poet.base_dir
try:
unpack_url(Link(url), tmp_dir, download_dir=tmp_dir, only_download=True)
os.chdir(tmp_dir)
call(['git', 'checkout', rev])
revision = call(['git', 'rev-parse', rev])
# Getting info
revision = revision.strip()
version = {
'git': url,
'rev': revision
}
except Exception:
raise
finally:
shutil.rmtree(tmp_dir)
# Going back to current directory
os.chdir(current_dir)
return version
示例4: from_editable
# 需要导入模块: from pip import index [as 别名]
# 或者: from pip.index import Link [as 别名]
def from_editable(cls, editable_req, comes_from=None, default_vcs=None,
isolated=False, options=None, wheel_cache=None,
constraint=False):
from pip.index import Link
name, url, extras_override, editable_options = parse_editable(
editable_req, default_vcs)
if url.startswith('file:'):
source_dir = url_to_path(url)
else:
source_dir = None
res = cls(name, comes_from, source_dir=source_dir,
editable=True,
link=Link(url),
constraint=constraint,
editable_options=editable_options,
isolated=isolated,
options=options if options else {},
wheel_cache=wheel_cache)
if extras_override is not None:
res.extras = extras_override
return res
示例5: from_editable
# 需要导入模块: from pip import index [as 别名]
# 或者: from pip.index import Link [as 别名]
def from_editable(cls, editable_req, comes_from=None, default_vcs=None,
isolated=False, options=None, wheel_cache=None):
from pip.index import Link
name, url, extras_override, editable_options = parse_editable(
editable_req, default_vcs)
if url.startswith('file:'):
source_dir = url_to_path(url)
else:
source_dir = None
res = cls(name, comes_from, source_dir=source_dir,
editable=True,
link=Link(url),
editable_options=editable_options,
isolated=isolated,
options=options if options else {},
wheel_cache=wheel_cache)
if extras_override is not None:
res.extras = extras_override
return res
示例6: get_location
# 需要导入模块: from pip import index [as 别名]
# 或者: from pip.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