diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-03-27 01:05:07 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-03-27 01:05:07 +0000 |
commit | ec068b63ecf069e4e11afc2dca817cc44c257f49 (patch) | |
tree | d4928e02aeb64c5507d0555c7dc47b38d0950a73 | |
parent | bf83ca7067ccbb9cacc758fea461875298956376 (diff) | |
download | portage-ec068b63ecf069e4e11afc2dca817cc44c257f49.tar.gz portage-ec068b63ecf069e4e11afc2dca817cc44c257f49.tar.bz2 portage-ec068b63ecf069e4e11afc2dca817cc44c257f49.zip |
Split out a reusable Manifest._parseDigests() method.
svn path=/main/trunk/; revision=3017
-rw-r--r-- | pym/portage_manifest.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index 5208cde7f..89edc1aca 100644 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -83,6 +83,11 @@ class Manifest(object): mylines = fd.readlines() fd.close() mylines.extend(self._readDigests().split("\n")) + self._parseDigests(mylines, myhashdict=self.fhashdict) + + def _parseDigests(self, mylines, myhashdict=None): + if myhashdict is None: + myhashdict = {} for l in mylines: myname = "" mysplit = l.split() @@ -102,10 +107,11 @@ class Manifest(object): myhashes = dict(zip(mysplit[3::2], mysplit[4::2])) if len(myname) == 0: continue - if not self.fhashdict[mytype].has_key(myname): - self.fhashdict[mytype][myname] = {} - self.fhashdict[mytype][myname].update(myhashes) - self.fhashdict[mytype][myname]["size"] = mysize + myhashdict.setdefault(mytype, {}) + myhashdict[mytype].setdefault(myname, {}) + myhashdict.update(myhashes) + myhashdict[mytype][myname]["size"] = mysize + return myhashdict def _writeDigests(self): """ Create old style digest files for this Manifest instance """ |