From cd498e08c4a09f9897c22806ab3abed9a7a2a0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Mon, 20 Jun 2005 12:17:59 +0000 Subject: [PATCH] =?UTF-8?q?dosya/dizin=20boyutunu=20hesaplamak=20zor=20i?= =?UTF-8?q?=C5=9F=20:(.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/util.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pisi/util.py b/pisi/util.py index 68945415..74657aae 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -37,12 +37,15 @@ def clean_dir(top): def dir_size(dir): """ calculate the size of files under a dir based on the os module example""" + # It's really hard to give an approximate value for package's + # installed size. Gettin a sum of all files' sizes if far from + # being true. Using 'du' command (like Debian does) can be a + # better solution :(. getsize = os.path.getsize join = os.path.join def sizes(): for root, dirs, files in os.walk(dir): - print sum([getsize(join(root, name)) for name in files]) - yield sum([getsize(join(root, name)) for name in files]) + yield sum([getsize(join(root, name)) for name in files]) return sum( sizes() ) def copy_file(src,dest):