From a4b8b36b896c1ae5f8dbd04e75cb6a8d9d7f358b 2013-12-16 01:07:46 From: Thomas Kluyver Date: 2013-12-16 01:07:46 Subject: [PATCH] Also check that existing symlink has desired target before allowing it. --- diff --git a/setupbase.py b/setupbase.py index 219b1cb..6426d7b 100644 --- a/setupbase.py +++ b/setupbase.py @@ -381,7 +381,8 @@ class install_lib_symlink(Command): try: os.symlink(pkg, dest) except OSError as e: - if e.errno == errno.EEXIST and os.path.islink(dest): + if e.errno == errno.EEXIST and os.path.islink(dest) \ + and os.path.realpath(dest) == pkg: print('Symlink already exists') else: raise