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)
评论列表
文章目录