X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils.py;h=3d83da0193fd4d2a5fa90753047de376ab32f7d9;hb=bc42cb4cc69e8cd2bca50cf26e786d04492966af;hp=1ad6a4e7762dcc6888b5679a732dae8eca2f566c;hpb=f2f237c936b5d5727c2b70be85cdacd2903c05b2;p=dak.git diff --git a/utils.py b/utils.py index 1ad6a4e7..3d83da01 100644 --- a/utils.py +++ b/utils.py @@ -2,7 +2,7 @@ # Utility functions # Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup -# $Id: utils.py,v 1.66 2004-04-03 02:49:46 troup Exp $ +# $Id: utils.py,v 1.69 2004-06-24 00:41:39 troup Exp $ ################################################################################ @@ -327,10 +327,12 @@ switched to 'email (name)' format.""" if not maintainer: return ('', '', '', ''); - if maintainer.find("<") == -1 or (maintainer[0] == "<" and \ - maintainer[-1:] == ">"): + if maintainer.find("<") == -1: email = maintainer; name = ""; + elif (maintainer[0] == "<" and maintainer[-1:] == ">"): + email = maintainer[1:-1]; + name = ""; else: m = re_parse_maintainer.match(maintainer); if not m: @@ -499,13 +501,13 @@ def whoami (): ################################################################################ def size_type (c): - t = " b"; - if c > 10000: - c = c / 1000; - t = " Kb"; - if c > 10000: - c = c / 1000; - t = " Mb"; + t = " B"; + if c > 10240: + c = c / 1024; + t = " KB"; + if c > 10240: + c = c / 1024; + t = " MB"; return ("%d%s" % (c, t)) ################################################################################ @@ -635,6 +637,19 @@ def join_with_commas_and(list): ################################################################################ +def pp_dep (deps): + pp_deps = []; + for atom in deps: + (pkg, version, constraint) = atom; + if constraint: + pp_dep = "%s (%s %s)" % (pkg, constraint, version); + else: + pp_dep = pkg; + pp_deps.append(pp_dep); + return " |".join(pp_deps); + +################################################################################ + def get_conf(): return Cnf;