当前位置: 首页>>代码示例>>Python>>正文


Python uri.URI类代码示例

本文整理汇总了Python中pisi.uri.URI的典型用法代码示例。如果您正苦于以下问题:Python URI类的具体用法?Python URI怎么用?Python URI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了URI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_spec_file

 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
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:7,代码来源:build.py

示例2: __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

示例3: prepare_for_build

def prepare_for_build(pspecfile, authInfo=None):

    # FIXME: there is a function named "build" in this module which
    # makes it impossible to use build module directly.
    from build import PisiBuild

    url = URI(pspecfile)
    if url.is_remote_file():
        from sourcefetcher import SourceFetcher
        fs = SourceFetcher(url, authInfo)
        url.uri = fs.fetch_all()

    pb = PisiBuild(url.uri)

    # find out the build dependencies that are not satisfied...
    dep_unsatis = []
    for dep in pb.spec.source.buildDeps:
        if not dependency.installed_satisfies_dep(dep):
            dep_unsatis.append(dep)

    # FIXME: take care of the required buildDeps...
    # For now just report an error!
    if dep_unsatis:
        ctx.ui.error(_("Unsatisfied Build Dependencies:"))
        for dep in dep_unsatis:
            ctx.ui.warning(dep.package)

    # FIXME: Don't exit for now! It's annoying to test on a system that
    # doesn't has all packages made with pisi.
    # Will be enabled on the full-pisi system.
    #        sys.exit(1)

    return pb
开发者ID:Tayyib,项目名称:uludag,代码行数:33,代码来源:api.py

示例4: __init__

    def __init__(self, packagefn, mode='r'):
        self.filepath = packagefn
        url = URI(packagefn)

        if url.is_remote_file():
            self.fetch_remote_file(url)

        self.impl = archive.ArchiveZip(self.filepath, 'zip', mode)
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:8,代码来源:package.py

示例5: __init__

    def __init__(self, url, dest):
        if not isinstance(url, URI):
            url = URI(url)
 
        self.scheme = url.scheme()
        self.url = url
        self.filedest = dest
        util.check_dir(self.filedest)
        self.percent = 0
        self.rate = 0.0
        self.progress = None
        self.existsize = 0
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:12,代码来源:fetcher.py

示例6: install_single

def install_single(pkg, upgrade = False):
    """install a single package from URI or ID"""
    url = URI(pkg)
    # Check if we are dealing with a remote file or a real path of
    # package filename. Otherwise we'll try installing a package from
    # the package repository.
    if url.is_remote_file() or os.path.exists(url.uri):
        install_single_file(pkg, upgrade)
    else:
        install_single_name(pkg, upgrade)
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:10,代码来源:atomicoperations.py

示例7: prepare_for_build

def prepare_for_build(pspecfile, authInfo=None):

    url = URI(pspecfile)
    if url.is_remote_file():
        from sourcefetcher import SourceFetcher
        fs = SourceFetcher(url, authInfo)
        url.uri = fs.fetch_all()

    import pisi.build
    pb = pisi.build.Builder(url.uri)

    return pb
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:12,代码来源:api.py

示例8: prepare_for_build

def prepare_for_build(pspecfile, authInfo=None):

    # FIXME: there is a function named "build" in this module which
    # makes it impossible to use build module directly.
    from build import PisiBuild

    url = URI(pspecfile)
    if url.is_remote_file():
        from sourcefetcher import SourceFetcher
        fs = SourceFetcher(url, authInfo)
        url.uri = fs.fetch_all()

    pb = PisiBuild(url.uri)
    return pb
开发者ID:Tayyib,项目名称:uludag,代码行数:14,代码来源:api.py

示例9: __init__

    def __init__(self, url, destdir, resume = True):
        if not isinstance(url, URI):
            url = URI(url)
 
        self.resume = resume
        self.scheme = url.scheme()
        self.url = url
        self.destdir = destdir
        util.check_dir(self.destdir)
        self.eta = '??:??:??'
        self.percent = 0
        self.rate = 0.0
        self.progress = None
        self.exist_size = 0
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:14,代码来源:fetcher.py

示例10: __init__

 def __init__(self, bctx):
     self.url = URI(bctx.spec.source.archiveUri)
     self.archiveFile = join(ctx.config.archives_dir(), self.url.filename())
     self.archiveName = bctx.spec.source.archiveName
     self.archiveType = bctx.spec.source.archiveType
     self.archiveSHA1 = bctx.spec.source.archiveSHA1
     self.bctx = bctx
开发者ID:Tayyib,项目名称:uludag,代码行数:7,代码来源:sourcearchive.py

示例11: read_uri

    def read_uri(self, filename, repo = None):
        """Read PSPEC file"""

        self.filepath = filename
        url = URI(filename)
        if url.is_remote_file():
            from fetcher import fetch_url
            assert repo
            dest = os.path.join(ctx.config.index_dir(), repo)
            if not os.path.exists(dest):
                os.makedirs(dest)
            fetch_url(url, dest, ctx.ui.Progress)

            self.filepath = os.path.join(dest, url.filename())

        self.read(self.filepath)
开发者ID:Tayyib,项目名称:uludag,代码行数:16,代码来源:index.py

示例12: __init__

class SourceArchive:
    """source archive. this is a class responsible for fetching
    and unpacking a source archive"""
    def __init__(self, spec, pkg_work_dir):
        self.url = URI(spec.source.archive.uri)
        self.pkg_work_dir = pkg_work_dir
        self.archiveFile = join(ctx.config.archives_dir(), self.url.filename())
        self.archive = spec.source.archive

    def fetch(self, interactive=True):
        if not self.is_cached(interactive):
            if interactive:
                progress = ctx.ui.Progress
            else:
                progress = None
            try:
                fetch_url(self.url, ctx.config.archives_dir(), progress)
            except pisi.fetcher.FetchError:
                # if archive can not be reached from the url, try the fallback 
                # address.
                if ctx.config.values.build.fallback:
                    archive = basename(self.url.get_uri())
                    src = join(ctx.config.values.build.fallback, archive)
                    fetch_url(src, ctx.config.archives_dir(), progress)
                else:
                    raise

    def is_cached(self, interactive=True):
        if not access(self.archiveFile, R_OK):
            return False

        # check hash
        if util.check_file_hash(self.archiveFile, self.archive.sha1sum):
            if interactive:
                ctx.ui.info(_('%s [cached]') % self.archive.name)
            return True

        return False

    def unpack(self, clean_dir=True):

        # check archive file's integrity
        if not util.check_file_hash(self.archiveFile, self.archive.sha1sum):
            raise Error, _("unpack: check_file_hash failed")
            
        archive = Archive(self.archiveFile, self.archive.type)
        archive.unpack(self.pkg_work_dir, clean_dir)
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:47,代码来源:sourcearchive.py

示例13: rebuild_repo

def rebuild_repo(repo):
    ctx.ui.info(_('* Rebuilding \'%s\' named repo... ') % repo)
    
    if ctx.repodb.has_repo(repo):
        repouri = URI(ctx.repodb.get_repo(repo).indexuri.get_uri())
        indexname = repouri.filename()
        index = Index()
        indexpath = pisi.util.join_path(ctx.config.index_dir(), repo, indexname)
        tmpdir = os.path.join(ctx.config.tmp_dir(), 'index')
        pisi.util.clean_dir(tmpdir)
        pisi.util.check_dir(tmpdir)
        try:
            index.read_uri(indexpath, tmpdir, force=True) # don't look for sha1sum there
        except IOError, e:
            ctx.ui.warning(_("Input/Output error while reading %s: %s") % (indexpath, unicode(e)))
            return
        ctx.txn_proc(lambda txn : index.update_db(repo, txn=txn))
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:17,代码来源:api.py

示例14: __init__

    def __init__(self, url, destdir, resume = True):
        if not isinstance(url, URI):
            url = URI(url)
 
        if ctx.config.get_option("authinfo"):
            url.set_auth_info(ctx.config.get_option("authinfo"))

        self.resume = resume
        self.scheme = url.scheme()
        self.url = url
        self.destdir = destdir
        util.check_dir(self.destdir)
        self.eta = '??:??:??'
        self.percent = 0
        self.rate = 0.0
        self.progress = None
        self.exist_size = 0
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:17,代码来源:fetcher.py

示例15: __init__

    def __init__(self, packagefn, mode='r'):
        self.filepath = packagefn
        url = URI(packagefn)

        if url.is_remote_file():
            from fetcher import fetch_url
            dest = ctx.config.packages_dir()
            self.filepath = join(dest, url.filename())
            
            # FIXME: exists is not enough, also sha1sum check needed \
            #        when implemented in pisi-index.xml
            if not exists(self.filepath):
                fetch_url(url, dest, ctx.ui.Progress)
            else:
                ctx.ui.info(_('%s [cached]') % url.filename())
                
        self.impl = archive.ArchiveZip(self.filepath, 'zip', mode)
开发者ID:Tayyib,项目名称:uludag,代码行数:17,代码来源:package.py


注:本文中的pisi.uri.URI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。