From 047c5476f20796ee13755cbcf1ea47ce37fa92fc Mon Sep 17 00:00:00 2001 From: "A. Murat Eren" Date: Fri, 10 Mar 2006 12:40:11 +0000 Subject: [PATCH] unittestleri seviyoruz. iki tane daha bug temizledik.. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sevgili paket geliştiricisi arkadaşlar, lütfen shelltools.copy kullandığınızda paketlerin içeriğinin doğru olup olmadığını test etmeyi ihmal etmeyiniz. python'un standart library'si içerisindeki copy gerçekten çok kötü. actionsapi içerisinde mükemmele yaklaşıyoruz, fakat test etmemiz gerekli. --- pisi/actionsapi/shelltools.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pisi/actionsapi/shelltools.py b/pisi/actionsapi/shelltools.py index 7411c0da..2f5a8de3 100644 --- a/pisi/actionsapi/shelltools.py +++ b/pisi/actionsapi/shelltools.py @@ -138,7 +138,10 @@ def copy(source, destination, sym = True): os.remove(destination) os.symlink(os.readlink(filePath), destination) elif isLink(filePath) and not sym: - shutil.copy(os.readlink(filePath), destination) + if isDirectory(os.readlink(filePath)): + copytree(os.readlink(filePath), destination) + else: + shutil.copy(os.readlink(filePath), destination) elif isDirectory(filePath): copytree(filePath, destination, sym) else: @@ -148,8 +151,12 @@ def copytree(source, destination, sym = True): '''recursively copy an entire directory tree rooted at source''' if isDirectory(source): if os.path.exists(destination): - copytree(source, join_path(destination, os.path.basename(source))) - return + if isDirectory(destination): + copytree(source, join_path(destination, os.path.basename(source.strip('/')))) + return + else: + copytree(source, join_path(destination, os.path.basename(source))) + return try: shutil.copytree(source, destination, sym) except OSError, e: