From a7c3835854b77b9d258c6ebb323e41a42c35ae08 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Fri, 9 Nov 2012 08:05:41 -0800 Subject: setup.py seems to be functional --- setup.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index b1d2d47..6d72cac 100644 --- a/setup.py +++ b/setup.py @@ -51,8 +51,11 @@ def makeLinks(dotfiles, prefix, nice, pretend): if type(src) is dict: try: - if not pretend and not os.path.isdir(realDest): - os.mkdir(realDest) + if not pretend: + if os.path.islink(realDest): + os.unlink(realDest) # Only remove symlinks. Don't try to replace a file with a directory. + if not os.path.isdir(realDest): + os.mkdir(realDest) print "%50s => " % (realDest) makeLinks(src, realDest + "/", nice, pretend) except OSError,e: @@ -65,7 +68,7 @@ def makeLinks(dotfiles, prefix, nice, pretend): print "%50s => %s" % (realDest, src) - except IOError,e + except IOError,e: print "Not linking %s to %s because IOError: %s" % (realDest, src, str(e)) """ Return a map of dest => source dotfiles """ @@ -99,8 +102,10 @@ def makeLink(src, realDest, nice = False): if os.path.lexists(realDest): if nice: return False - else: + if os.path.isdir(realDest) and not os.path.islink(realDest): shutil.rmtree(realDest) + else: + os.unlink(realDest) os.symlink(src, realDest) -- cgit v1.2.3