diff --git a/mrepo.py b/mrepo.py index d87e434..c6313c2 100755 --- a/mrepo.py +++ b/mrepo.py @@ -19,6 +19,7 @@ import glob import os from os.path import exists as path_exists +from os.path import isdir as path_is_dir from os.path import join as path_join import re @@ -502,7 +503,7 @@ def addfile((filelist, ), path, files): def check(self): "Return what repositories require an update and write .newsha1sum" - if not os.path.isdir(self.wwwdir): + if not path_is_dir(self.wwwdir): return sha1file = path_join(self.wwwdir, '.sha1sum') remove(sha1file + '.tmp') @@ -605,13 +606,13 @@ def repomd(self): opts = ' -v' + opts if not self.dist.promoteepoch: opts = opts + ' -n' - if os.path.isdir(self.wwwdir): + if path_is_dir(self.wwwdir): repoopts = opts if cf.cachedir: cachedir = path_join(cf.cachedir, self.dist.nick, self.name) mkdir(cachedir) repoopts = repoopts + ' --cachedir "%s"' % cachedir - if os.path.isdir(path_join(self.wwwdir, '.olddata')): + if path_is_dir(path_join(self.wwwdir, '.olddata')): remove(path_join(self.wwwdir, '.olddata')) groupfile = path_join(cf.srcdir, self.dist.nick, self.name + '-comps.xml') if os.path.isfile(groupfile): @@ -779,8 +780,8 @@ def symlink(src, dst): if os.path.samefile(src, abspath(os.readlink(dst), src)): return os.unlink(dst) - elif os.path.isdir(dst): - if os.path.isdir(src): + elif path_is_dir(dst): + if path_is_dir(src): if os.path.samefile(src, dst): return else: @@ -794,7 +795,7 @@ def symlink(src, dst): src = relpath(src, dst) - if not os.path.isdir(os.path.dirname(dst)): + if not path_is_dir(os.path.dirname(dst)): mkdir(os.path.dirname(dst)) os.symlink(src, dst) @@ -803,7 +804,7 @@ def copy(src, dst): "Copy a file, force if dst exists" if op.dryrun: return - if os.path.isdir(dst): + if path_is_dir(dst): dst = path_join(dst, os.path.basename(src)) if os.path.islink(dst) or os.path.isfile(dst): os.unlink(dst) @@ -811,7 +812,7 @@ def copy(src, dst): if not path_exists(dst): if os.path.isfile(src): shutil.copy2(src, dst) - elif os.path.isdir(src): + elif path_is_dir(src): shutil.copytree(src, dst) @@ -822,7 +823,7 @@ def remove(file): return if os.path.islink(file): os.unlink(file) - elif os.path.isdir(file): + elif path_is_dir(file): try: os.rmdir(file) except: @@ -1026,7 +1027,7 @@ def mail(subject, msg): def readconfig(): cf = Config() - if cf.confdir and os.path.isdir(cf.confdir): + if cf.confdir and path_is_dir(cf.confdir): files = glob.glob(path_join(cf.confdir, '*.conf')) files.sort() for configfile in files: @@ -1092,7 +1093,6 @@ def listrpms(dirs, relative=''): dirs = (dirs,) if relative and not relative.endswith('/'): relative += '/' - isdir = os.path.isdir def processdir(rpms, path, files): if relative: @@ -1101,7 +1101,7 @@ def processdir(rpms, path, files): path2 = path for f in files: pf = path_join(path, f) - if f.endswith('.rpm') and path_exists(pf) and not isdir(pf): + if f.endswith('.rpm') and path_exists(pf) and not path_is_dir(pf): rpms.append((f, path2)) rpms = []