From bafa4ccba21d202e28f4ef44906566e509464933 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Thu, 2 Jan 2014 16:08:23 +0100 Subject: [PATCH] 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 4fe2c5fd..d5b0fc4e 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 fbe3b1a0..655e3817 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: -- 2.39.2