[dak/master] Use os.path.lexists instead of exists
scripts/debian/link_morgue.sh replaces files present on snapshot.d.o
with symlinks that are not valid on ftp-master.d.o.
---
dak/clean_suites.py | 2 +-
daklib/utils.py | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dak/clean_suites.py b/dak/clean_suites.py
index 4fe2c5f..d5b0fc4 100755
--- a/dak/clean_suites.py
+++ b/dak/clean_suites.py
@@ -296,7 +296,7 @@ def clean(now_date, archives, max_delete, session):
dest_filename = dest + '/' + os.path.basename(filename)
# If the destination file exists; try to find another filename to use
- if os.path.exists(dest_filename):
+ if os.path.lexists(dest_filename):
dest_filename = utils.find_next_free(dest_filename)
if not Options["No-Action"]:
diff --git a/daklib/utils.py b/daklib/utils.py
index fbe3b1a..655e381 100755
--- a/daklib/utils.py
+++ b/daklib/utils.py
@@ -720,7 +720,7 @@ def move (src, dest, overwrite = 0, perms = 0o664):
dest_dir = dest
else:
dest_dir = os.path.dirname(dest)
- if not os.path.exists(dest_dir):
+ if not os.path.lexists(dest_dir):
umask = os.umask(00000)
os.makedirs(dest_dir, 0o2775)
os.umask(umask)
@@ -728,7 +728,7 @@ def move (src, dest, overwrite = 0, perms = 0o664):
if os.path.exists(dest) and os.path.isdir(dest):
dest += '/' + os.path.basename(src)
# Don't overwrite unless forced to
- if os.path.exists(dest):
+ if os.path.lexists(dest):
if not overwrite:
fubar("Can't move %s to %s - file already exists." % (src, dest))
else:
@@ -751,7 +751,7 @@ def copy (src, dest, overwrite = 0, perms = 0o664):
if os.path.exists(dest) and os.path.isdir(dest):
dest += '/' + os.path.basename(src)
# Don't overwrite unless forced to
- if os.path.exists(dest):
+ if os.path.lexists(dest):
if not overwrite:
raise FileExistsError
else:
@@ -894,7 +894,7 @@ def changes_compare (a, b):
def find_next_free (dest, too_many=100):
extra = 0
orig_dest = dest
- while os.path.exists(dest) and extra < too_many:
+ while os.path.lexists(dest) and extra < too_many:
dest = orig_dest + '.' + repr(extra)
extra += 1
if extra >= too_many:
--
1.7.10.4
Reply to: