fix syntaxwarning error

This commit is contained in:
2023-12-19 15:50:36 +08:00
parent f2733eef4e
commit 03a68da029
5 changed files with 9 additions and 9 deletions

View File

@@ -133,7 +133,7 @@ class Command(sunhpc.commands.create.command):
mirrors = distro.getMirrors()
fullmirror = mirrors[0].getRollsPath()
# modify all dirs mode 755
os.system('find %s -type d ' % (fullmirror) + '-exec chmod -R 0755 {} \;')
os.system(r'find %s -type d ' % (fullmirror) + '-exec chmod -R 0755 {} \;')
if self.arch != arch and os.path.exists(dist):
shutil.move(os.path.join(tempdist, arch), os.path.join(dist, arch))

View File

@@ -27,7 +27,7 @@ class RollHandler(object):
subprocess.run('umount %s' % self.mntdir, shell=True)
def read_iso(self):
cmd = 'find %s -type f -name roll-\*.xml' % self.mntdir
cmd = r'find %s -type f -name roll-\*.xml' % self.mntdir
ret = self.cmd.shcmd(cmd, code=True)
try:
roll = sunhpc.core.files.RollInfoFile(ret['o'].strip())
@@ -104,7 +104,7 @@ class RollHandler(object):
os.chdir(os.path.join(self.mntdir, roll_name))
# 修改所有目录权限,确保所有人能够访问,例如Apache等.
self.cmd.shcmd("find %s -type d -exec chmod a+rx {} \;" % roll_dir, code=True)
self.cmd.shcmd(r"find %s -type d -exec chmod a+rx {} \;" % roll_dir, code=True)
# 插入roll信息到数据库,如果存在则放弃插入.
rows = self.cmd.db.search('select * from rolls where' \

View File

@@ -400,7 +400,7 @@ class DistributionBuilder(Builder):
#
os.chdir(self.dist.getReleasePath())
if self.calcmd5:
cmd = '/usr/bin/md5sum `find -L . -type f | sed "s/^\.\///" | '
cmd = r'/usr/bin/md5sum `find -L . -type f | sed "s/^\.\///" | '
cmd += 'egrep -v "^build|^SRPMS|^force" | egrep -v "rpm$"` '
cmd += '> %s/packages.md5' % (productfilesdir)
else:

View File

@@ -162,9 +162,9 @@ class Tree:
os.path.islink(filepath):
self.build(os.path.join(dir, f))
else:
if re.match('.*\.rpm$', f) != None:
if re.match(r'.*\.rpm$', f) != None:
v.append(RPMFile(filepath))
elif re.match('roll-.*\.iso$', f) != None:
elif re.match(r'roll-.*\.iso$', f) != None:
v.append(RollFile(filepath))
else:
v.append(File(filepath))
@@ -204,7 +204,7 @@ class RPMBaseFile(File):
def versionList(self, s):
list = []
for e in re.split('\.+|_+', s):
for e in re.split(r'\.+|_+', s):
l = []
num = ''
alpha = ''

View File

@@ -34,10 +34,10 @@ class Security(object):
self.masters = []
# A regex for our header search.
pattern = "\n*(?P<comment>.*?)\$110id\$"
pattern = r"\n*(?P<comment>.*?)\$110id\$"
self.header_pattern = re.compile(pattern)
pattern = "<a href=.+>(?P<filename>.+)</a> +(?P<date>\d+.*) +(?P<size>\d+.*)"
pattern = r"<a href=.+>(?P<filename>.+)</a> +(?P<date>\d+.*) +(?P<size>\d+.*)"
# Make the pattern matching engine case-insensitive.
self.dir_pattern = re.compile(pattern, re.I)