Skip to content

Commit

Permalink
Use a proper import alias for os.path.isdir
Browse files Browse the repository at this point in the history
  • Loading branch information
jrha committed Jul 16, 2024
1 parent d1622b3 commit 3adadf4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions mrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand All @@ -803,15 +804,15 @@ 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)
mkdir(os.path.dirname(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)


Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3adadf4

Please sign in to comment.