except ImportError:
from .global_version import __version__ as my_version
-__version__ = '0.4.2'
+__version__ = '0.4.3'
LOG = logging.getLogger(__name__)
eof = False
lnr = 0
+ total = 0
+ if six.PY2:
+ total = long(0)
+
while not eof:
lnr += 1
line = fh.readline()
line = line.strip()
if not line:
continue
- self.eval_line(line, lnr)
+ entry = self.eval_line(line, lnr)
+ if entry:
+ total += entry.size_kb
+
+ if self.total:
+ total_entry = DuEntry(
+ size_kb=total, path='total', appname=self.appname,
+ verbose=self.verbose, base_dir=self.base_dir)
+ if self.verbose > 1:
+ LOG.debug("Total entry:\n{}".format(pp(total_entry.as_dict())))
+ print(total_entry.to_str(unit=self.unit, precision=self.precision))
if self.verbose > 1:
LOG.debug("Finished reading.")
except DuParseError as e:
LOG.error("Could not parse line {lnr}: {e}".format(lnr=lnr, e=e))
LOG.debug("Parsing pattern: {!r}".format(DuEntry.parse_pattern))
- return
+ return None
- LOG.debug("Entry:\n{}".format(pp(entry.as_dict())))
+ if self.verbose > 1:
+ LOG.debug("Entry:\n{}".format(pp(entry.as_dict())))
print(entry.to_str(unit=self.unit, precision=self.precision))
+ return entry
+
# =============================================================================
if __name__ == "__main__":