本文整理汇总了Python中pisi.sourcearchive.SourceArchive类的典型用法代码示例。如果您正苦于以下问题:Python SourceArchive类的具体用法?Python SourceArchive怎么用?Python SourceArchive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SourceArchive类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, specuri, authinfo = None):
# process args
if not isinstance(specuri, URI):
specuri = URI(specuri)
if authinfo:
specuri.set_auth_info(authinfo)
self.authinfo = authinfo
# read spec file, we'll need it :)
self.set_spec_file(specuri)
if specuri.is_remote_file():
#make local here and fuck up
self.specdir = self.fetch_files()
else:
self.specdir = dirname(self.specuri.get_uri())
self.sourceArchive = SourceArchive(self.spec, self.pkg_work_dir())
self.set_environment_vars()
self.actionLocals = None
self.actionGlobals = None
self.srcDir = None
示例2: __init__
def __init__(self, pspec):
self.bctx = BuildContext(pspec)
self.pspecDir = os.path.dirname(os.path.realpath(self.bctx.pspecfile))
self.spec = self.bctx.spec
self.sourceArchive = SourceArchive(self.bctx)
self.set_environment_vars()
self.actionLocals = None
self.actionGlobals = None
self.srcDir = None
示例3: from_name
class Builder:
"""Provides the package build and creation routines"""
#FIXME: this class and every other class must use URLs as paths!
@staticmethod
def from_name(name):
# 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():
src_path = str(src_uri)
else:
repo = ctx.repodb.get_repo(reponame)
#FIXME: don't use dirname to work on URLs
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)
else:
raise Error(_("Source %s not found in any active repository.") % name)
def __init__(self, specuri):
# process args
if not isinstance(specuri, URI):
specuri = URI(specuri)
# read spec file, we'll need it :)
self.set_spec_file(specuri)
if specuri.is_remote_file():
#make local here and fuck up
self.specdir = self.fetch_files()
else:
self.specdir = dirname(self.specuri.get_uri())
self.sourceArchive = SourceArchive(self.spec, self.pkg_work_dir())
self.set_environment_vars()
self.actionLocals = None
self.actionGlobals = None
self.srcDir = None
def set_spec_file(self, specuri):
if not specuri.is_remote_file():
specuri = URI(os.path.realpath(specuri.get_uri())) # FIXME: doesn't work for file://
self.specuri = specuri
spec = SpecFile()
spec.read(specuri, ctx.config.tmp_dir())
self.spec = spec
# directory accessor functions
# pkg_x_dir: per package directory for storing info type x
def pkg_dir(self):
"package build directory"
packageDir = self.spec.source.name + '-' + \
self.spec.source.version + '-' + self.spec.source.release
return util.join_path(ctx.config.dest_dir(), ctx.config.values.dirs.tmp_dir,
packageDir)
def pkg_work_dir(self):
return self.pkg_dir() + ctx.const.work_dir_suffix
def pkg_debug_dir(self):
return self.pkg_dir() + ctx.const.debug_dir_suffix
def pkg_install_dir(self):
return self.pkg_dir() + ctx.const.install_dir_suffix
def set_state(self, state):
stateFile = util.join_path(self.pkg_work_dir(), "pisiBuildState")
open(stateFile, "w").write(state)
def get_state(self):
stateFile = util.join_path(self.pkg_work_dir(), "pisiBuildState")
if not os.path.exists(stateFile): # no state
return None
return open(stateFile, "r").read()
def build(self):
"""Build the package in one shot."""
ctx.ui.status(_("Building PISI source package: %s") % self.spec.source.name)
self.compile_action_script()
# check if all patch files exists, if there are missing no need to unpack!
self.patch_exists()
self.check_build_dependencies()
self.fetch_component()
#.........这里部分代码省略.........