def __getitem__(self, cpv):
fp = os.path.join(self.location, cpv)
- try:
- def curry(*args):
- def callit(*args2):
- return args[0](*args[1:]+args2)
- return callit
- return ProtectedDict(LazyLoad(curry(self._pull, fp, cpv),
- initial_items=[("_mtime_", long(os.stat(fp).st_mtime))]))
- except OSError:
- raise KeyError(cpv)
- return self._getitem(cpv)
+ return self._pull(fp, cpv)
def _pull(self, fp, cpv):
try:
raise cache_errors.CacheCorruption(cpv, e)
try:
d = self._parse_data(myf, cpv)
+ d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
except (OSError, ValueError), e:
myf.close()
raise cache_errors.CacheCorruption(cpv, e)
return d
- def _parse_data(self, data, cpv, mtime=0):
+ def _parse_data(self, data, cpv):
d = dict(map(lambda x:x.rstrip().split("=", 1), data))
- if mtime != 0:
- d["_mtime_"] = long(mtime)
if "_eclasses_" in d:
d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"])
return d
return flat_hash.database.__getitem__(self, cpv)
- def _parse_data(self, data, mtime):
+ def _parse_data(self, data, cpv):
# easy attempt first.
data = list(data)
if len(data) != magic_line_count:
- d = flat_hash.database._parse_data(self, data, mtime)
+ d = flat_hash.database._parse_data(self, data)
else:
# this one's interesting.
d = {}