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


Python sourcearchive.SourceArchive類代碼示例

本文整理匯總了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
開發者ID:dhirajkhatiwada1,項目名稱:uludag,代碼行數:26,代碼來源:build.py

示例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
開發者ID:Tayyib,項目名稱:uludag,代碼行數:11,代碼來源:build.py

示例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()
#.........這裏部分代碼省略.........
開發者ID:dhirajkhatiwada1,項目名稱:uludag,代碼行數:101,代碼來源:build.py


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