diff --git a/mrepo.py b/mrepo.py index 38e555c..adb4943 100755 --- a/mrepo.py +++ b/mrepo.py @@ -18,6 +18,7 @@ import getopt import glob import os +from os.path import exists as path_exists from os.path import join as path_join import re @@ -492,7 +493,7 @@ def rpmlist(self): def addfile((filelist, ), path, files): for file in files: - if os.path.exists(path_join(path, file)) and file.endswith('.rpm'): + if path_exists(path_join(path, file)) and file.endswith('.rpm'): size = os.stat(path_join(path, file)).st_size filelist.add((file, size)) @@ -545,9 +546,9 @@ def lock(self, action): os.close(fd) return True except: - if os.path.exists(lockfile): + if path_exists(lockfile): pid = open(lockfile).read() - if os.path.exists('/proc/%s' % pid): + if path_exists('/proc/%s' % pid): error(0, '%s: Found existing lock %s owned by pid %s' % (self.dist.nick, lockfile, pid)) else: info(6, '%s: Removing stale lock %s' % (self.dist.nick, lockfile)) @@ -563,7 +564,7 @@ def unlock(self, action): return True lockfile = path_join(cf.lockdir, self.dist.nick, action + '-' + self.name + '.lock') info(6, '%s: Removing lock %s' % (self.dist.nick, lockfile)) - if os.path.exists(lockfile): + if path_exists(lockfile): pid = open(lockfile).read() if pid == '%s' % os.getpid(): os.unlink(lockfile) @@ -807,7 +808,7 @@ def copy(src, dst): if os.path.islink(dst) or os.path.isfile(dst): os.unlink(dst) mkdir(os.path.dirname(dst)) - if not os.path.exists(dst): + if not path_exists(dst): if os.path.isfile(src): shutil.copy2(src, dst) elif os.path.isdir(src): @@ -845,7 +846,7 @@ def mkdir(path): return if os.path.islink(path): os.unlink(path) - if not os.path.exists(path): + if not path_exists(path): os.makedirs(path) @@ -1092,7 +1093,6 @@ def listrpms(dirs, relative=''): if relative and not relative.endswith('/'): relative += '/' isdir = os.path.isdir - pathexists = os.path.exists def processdir(rpms, path, files): if relative: