pimp.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:oil 作者: oilshell 项目源码 文件源码
def appendURL(self, url, included=0):
        """Append packages from the database with the given URL.
        Only the first database should specify included=0, so the
        global information (maintainer, description) get stored."""

        if url in self._urllist:
            return
        self._urllist.append(url)
        fp = urllib2.urlopen(url).fp
        plistdata = plistlib.Plist.fromFile(fp)
        # Test here for Pimp version, etc
        if included:
            version = plistdata.get('Version')
            if version and version > self._version:
                sys.stderr.write("Warning: included database %s is for pimp version %s\n" %
                    (url, version))
        else:
            self._version = plistdata.get('Version')
            if not self._version:
                sys.stderr.write("Warning: database has no Version information\n")
            elif self._version > PIMP_VERSION:
                sys.stderr.write("Warning: database version %s newer than pimp version %s\n"
                    % (self._version, PIMP_VERSION))
            self._maintainer = plistdata.get('Maintainer', '')
            self._description = plistdata.get('Description', '').strip()
            self._url = url
        self._appendPackages(plistdata['Packages'], url)
        others = plistdata.get('Include', [])
        for o in others:
            o = urllib.basejoin(url, o)
            self.appendURL(o, included=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号