X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils.py;h=193deafc6238f3ee6fa159afef42257c1ba82f3d;hb=e0e87158dc6558cce66c233a27713009a3d6bec8;hp=6326806f92441c9ca5a145b72e1e99d2096e88cf;hpb=bb8283ad6274e461fc78a00b2a52c6594c53e13d;p=dak.git diff --git a/utils.py b/utils.py index 6326806f..193deafc 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000 James Troup -# $Id: utils.py,v 1.7 2000-12-05 04:27:48 troup Exp $ +# $Id: utils.py,v 1.9 2000-12-18 07:11:25 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -188,6 +188,9 @@ def send_mail (message, filename): def poolify (source, component): if component != "": component = component + '/'; + # FIXME: this is nasty + component = string.lower(component); + component = string.replace(component, 'non-us/', 'non-US/'); if source[:3] == "lib": return component + source[:4] + '/' + source + '/' else: @@ -265,3 +268,12 @@ def regex_safe (s): ###################################################################################### +def size_type (c): + t = " b"; + if c > 10000: + c = c / 1000; + t = " Kb"; + if c > 10000: + c = c / 1000; + t = " Mb"; + return ("%d%s" % (c, t))