Skip to content

Commit

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

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


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

0 comments on commit d1622b3

Please sign in to comment.