- return int(shell.Shell().eval("du", "--exclude=.git", "-s", dir).split()[0])
+ sum_sizes = 0
+ for root, _, files in os.walk(dir):
+ for name in files:
+ if not os.path.join(root, name).startswith(dir + excluded_dir):
+ file = os.path.join(root, name)
+ try:
+ if os.path.islink(file): continue
+ sum_sizes += os.path.getsize(file)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ logging.warning("%s disappeared before we could stat", file)
+ else:
+ raise
+ return sum_sizes
+
+class QuotaParseError(wizard.Error):
+ """Could not parse quota information."""
+ def __init__(self, msg):
+ self.msg = msg
+ def __str__(self):
+ return """