本文整理汇总了Python中pisi.uri.URI.is_absolute_path方法的典型用法代码示例。如果您正苦于以下问题:Python URI.is_absolute_path方法的具体用法?Python URI.is_absolute_path怎么用?Python URI.is_absolute_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pisi.uri.URI
的用法示例。
在下文中一共展示了URI.is_absolute_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_name
# 需要导入模块: from pisi.uri import URI [as 别名]
# 或者: from pisi.uri.URI import is_absolute_path [as 别名]
def from_name(name, authinfo = None):
# download package and return an installer object
# find package in repository
sf, reponame = ctx.sourcedb.get_spec_repo(name)
src = sf.source
if src:
src_uri = URI(src.sourceURI)
if src_uri.is_absolute_path():
pkg_path = str(src_uri)
else:
repo = ctx.repodb.get_repo(reponame)
src_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
str(src_uri.path()))
ctx.ui.debug(_("Source URI: %s") % src_path)
return Builder(src_path, authinfo)
else:
raise Error(_("Source %s not found in any active repository.") % name)
示例2: from_name
# 需要导入模块: from pisi.uri import URI [as 别名]
# 或者: from pisi.uri.URI import is_absolute_path [as 别名]
def from_name(name):
# download package and return an installer object
# find package in repository
repo = packagedb.which_repo(name)
if repo:
repo = ctx.repodb.get_repo(repo)
pkg = packagedb.get_package(name)
# FIXME: let pkg.packageURI be stored as URI type rather than string
pkg_uri = URI(pkg.packageURI)
if pkg_uri.is_absolute_path():
pkg_path = str(pkg.packageURI)
else:
pkg_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
str(pkg_uri.path()))
ctx.ui.debug(_("Package URI: %s") % pkg_path)
return Install(pkg_path)
else:
raise Error(_("Package %s not found in any active repository.") % name)
示例3: install_single_name
# 需要导入模块: from pisi.uri import URI [as 别名]
# 或者: from pisi.uri.URI import is_absolute_path [as 别名]
def install_single_name(name, upgrade = False):
"""install a single package from ID"""
# find package in repository
repo = packagedb.which_repo(name)
if repo:
repo = ctx.repodb.get_repo(repo)
pkg = packagedb.get_package(name)
# FIXME: let pkg.packageURI be stored as URI type rather than string
pkg_uri = URI(pkg.packageURI)
if pkg_uri.is_absolute_path():
pkg_path = str(pkg.packageURI)
else:
pkg_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
str(pkg_uri.path()))
ctx.ui.debug(_("Package URI: %s") % pkg_path)
# Package will handle remote file for us!
install_single_file(pkg_path, upgrade)
else:
raise Error(_("Package %s not found in any active repository.") % name)