From d2607973e1f0b5243e9df7cea8f4b45d28403ce0 Mon Sep 17 00:00:00 2001 From: "A. Murat Eren" Date: Wed, 19 Oct 2005 13:00:56 +0000 Subject: [PATCH] pspec/files altinda kati sekilde tanimlanmis dosyalar icin de metadata icerisinde kullanilacak installedsize bilgisini dogru hesaplayalim.. --- pisi/util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pisi/util.py b/pisi/util.py index 7488a314..f9b4dfa5 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -244,6 +244,13 @@ def dir_size(dir): getsize = os.path.getsize join = join_path islink = os.path.islink + isdir = os.path.isdir + exist = os.path.exists + + if exist(dir) and (not isdir(dir) and not islink(dir)): + #so, this is not a directory but file.. + return getsize(dir) + def sizes(): for root, dirs, files in os.walk(dir): yield sum([getsize(join(root, name)) for name in files if not islink(join(root,name))])