Skip to content

Commit 49fa58e

Browse files
authored
Merge pull request #303 from okurz/fix/deprecated_code
Fix 'SyntaxWarning' about invalid escape sequence
2 parents 8550204 + 4e819b6 commit 49fa58e

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

script/cfg.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
'''
2727

2828
read_files_repo_media = '''rsync -4 $rsync_pwd_option PRODUCTREPOPATH/*Media1/media.1/media __envsub/Media1.lst'''
29-
read_files_repo_media_convert = ''' && echo "Snapshot$(grep -oP '[\d]{8}' __envsub/products)" >> __envsub/destlst'''
29+
read_files_repo_media_convert = r''' && echo "Snapshot$(grep -oP '[\d]{8}' __envsub/products)" >> __envsub/destlst'''
3030

3131
read_files_repo_link = '''cp __envdir/REPOLINK/files_repo*.lst __envsub/
3232
'''
@@ -70,7 +70,7 @@ def rsync_commands(checksum):
7070
''' + rsync_iso_fix_src(archs) + '''
7171
[ ! -z "$src" ] || continue
7272
dest=$src
73-
''' + rsync_fix_dest(distri, version, staging, use_staging_patterns) + '''
73+
''' + rsync_fix_dest(distri, version, staging, use_staging_patterns) + r'''
7474
asset_folder=other
7575
[[ ! $dest =~ \.iso$ ]] || asset_folder=iso
7676
[[ ! $dest =~ \.spdx\.json$ ]] || asset_folder=iso
@@ -168,7 +168,7 @@ def pre_rsync_repo(repos):
168168
[[ ! $src =~ .*\.license ]] || [[ $dest == *license* ]] || dest=$dest.license'''
169169

170170
def rsync_repodir2():
171-
return '''
171+
return r'''
172172
dest=${dest//-Media2/}
173173
Mdia=Media2
174174
[[ ! $src =~ .*\.license ]] || Mdia=Media2.license
@@ -201,7 +201,7 @@ def rsync_repomultiarch(destpath, debug, source):
201201

202202
return res
203203

204-
rsync_repodir1_dest = lambda dest: '''
204+
rsync_repodir1_dest = lambda dest: r'''
205205
archs=(ARCHITECTURREPO)
206206
buildid=$(cat __envsub/files_iso.lst | grep -E 'FLAVORORS' | grep -o -E '(Build|Snapshot)[^-]*' | head -n 1)
207207
@@ -266,11 +266,11 @@ def pre_openqa_call_start(repos):
266266
version=VERSIONVALUE
267267
if [ -z "${norsync_filter[$flavor]}" ] || [ -z $build1 ]; then {
268268
iso=$(grep "$filter" __envsub/files_iso.lst 2>/dev/null | grep $arch | head -n 1)
269-
''' + openqa_call_start_fix_iso(archs) + '''
269+
''' + openqa_call_start_fix_iso(archs) + r'''
270270
build=$(echo $iso | grep -o -E '(Build|Snapshot)[^-]*' | grep -o -E '[0-9]\.?[0-9]+(\.[0-9]+)*' | tail -n 1) || :
271271
buildex=$(echo $iso | grep -o -E '(Build|Snapshot)[^-]*') || :
272-
[ -n "$iso" ] || [ "$flavor" != "''' + assets_flavor + '''" ] || build=$(grep -o -E '(Build|Snapshot)[^-]*' __envsub/files_asset.lst | grep -o -E '[0-9]\.?[0-9]+(\.[0-9]+)*' | head -n 1)
273-
[ -n "$iso" ] || [ "$flavor" != "''' + assets_flavor + '''" ] || buildex=$(grep -o -E '(Build|Snapshot)[^-]*' __envsub/files_asset.lst | head -n 1)
272+
[ -n "$iso" ] || [ "$flavor" != "''' + assets_flavor + r'''" ] || build=$(grep -o -E '(Build|Snapshot)[^-]*' __envsub/files_asset.lst | grep -o -E '[0-9]\.?[0-9]+(\.[0-9]+)*' | head -n 1)
273+
[ -n "$iso" ] || [ "$flavor" != "''' + assets_flavor + r'''" ] || buildex=$(grep -o -E '(Build|Snapshot)[^-]*' __envsub/files_asset.lst | head -n 1)
274274
[ -n "$iso$build" ] || build=$(grep -h -o -E '(Build|Snapshot)[^-]*' __envsub/Media1*.lst 2>/dev/null | head -n 1 | grep -o -E '[0-9]\.?[0-9]+(\.[0-9]+)*')|| :
275275
[ -n "$build" ] || continue
276276
buildex=${buildex/.install.iso/}
@@ -301,38 +301,38 @@ def pre_openqa_call_start(repos):
301301

302302
def openqa_call_start_iso(checksum):
303303
if checksum:
304-
return ''' [ -z "$destiso" ] || echo \" ISO=${destiso} \\\\
305-
CHECKSUM_ISO=\$(cut -b-64 /var/lib/openqa/factory/other/${destiso}.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\
306-
ASSET_256=${destiso}.sha256 \\\\\"'''
304+
return r''' [ -z "$destiso" ] || echo " ISO=${destiso} \\
305+
CHECKSUM_ISO=\$(cut -b-64 /var/lib/openqa/factory/other/${destiso}.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\
306+
ASSET_256=${destiso}.sha256 \\"'''
307307
return ''' [ -z "$destiso]" || echo \" ISO=${destiso} \\\\
308308
ASSET_256=${destiso}.sha256 \\\\\"'''
309309

310310
def openqa_call_start_ex1(checksum, tag):
311311
res = tag + '=${destiso} \\\\'
312312
if checksum:
313313
res += '''
314-
CHECKSUM_''' + tag + '''=\$(cut -b-64 /var/lib/openqa/factory/other/${destiso}.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\
315-
ASSET_256=${destiso}.sha256 \\\\'''
314+
CHECKSUM_''' + tag + r'''=\$(cut -b-64 /var/lib/openqa/factory/other/${destiso}.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\
315+
ASSET_256=${destiso}.sha256 \\'''
316316
return res
317317

318318

319319
def openqa_call_start_ex(checksum):
320-
return ''' if [[ ${norsync_filter[$filter]} == 1 ]]; then
320+
return r''' if [[ ${norsync_filter[$filter]} == 1 ]]; then
321321
:
322322
elif [[ $destiso =~ \.iso$ ]]; then
323-
echo \" ''' + openqa_call_start_ex1(checksum, 'ISO') + '''\"
323+
echo " ''' + openqa_call_start_ex1(checksum, 'ISO') + r'''"
324324
elif [[ $destiso =~ \.spdx.json$ ]]; then
325-
echo \" ''' + openqa_call_start_ex1(checksum, 'ISO') + '''\"
325+
echo " ''' + openqa_call_start_ex1(checksum, 'ISO') + r'''"
326326
elif [[ $destiso =~ \.tar$ ]]; then
327-
echo \" ''' + openqa_call_start_ex1(checksum, 'ISO') + '''\"
327+
echo " ''' + openqa_call_start_ex1(checksum, 'ISO') + r'''"
328328
elif [[ $destiso =~ \.(hdd|qcow2|raw|raw\.xz|raw\.gz|vhdx\.xz|vmdk|vmdk\.xz)$ ]]; then
329-
echo \" ''' + openqa_call_start_ex1(checksum, 'HDD_1') + '''\"
329+
echo " ''' + openqa_call_start_ex1(checksum, 'HDD_1') + r'''"
330330
elif [ -n "$destiso" ]; then
331-
echo \" ''' + openqa_call_start_ex1(checksum, 'ASSET_1') + '''\"
331+
echo " ''' + openqa_call_start_ex1(checksum, 'ASSET_1') + r'''"
332332
fi
333333
'''
334334

335-
openqa_call_start_hdds='''
335+
openqa_call_start_hdds=r'''
336336
i=1
337337
while read src; do
338338
folder=""
@@ -343,13 +343,13 @@ def openqa_call_start_ex(checksum):
343343
fi
344344
done
345345
n=$((i++))
346-
echo " ASSET_$((n+255))=$src.sha256 \\\\"
346+
echo " ASSET_$((n+255))=$src.sha256 \\"
347347
if [[ $src =~ .iso$ ]]; then
348-
echo " ISO=$src \\\\"
349-
echo " CHECKSUM_ISO=\$(cut -b-64 /var/lib/openqa/factory/other/$src.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\"
348+
echo " ISO=$src \\"
349+
echo " CHECKSUM_ISO=\$(cut -b-64 /var/lib/openqa/factory/other/$src.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\"
350350
else
351-
echo " HDD_$n=$src \\\\"
352-
echo " CHECKSUM_HDD_$n=\$(cut -b-64 /var/lib/openqa/factory/other/$src.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\"
351+
echo " HDD_$n=$src \\"
352+
echo " CHECKSUM_HDD_$n=\$(cut -b-64 /var/lib/openqa/factory/other/$src.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\"
353353
fi
354354
done < <(grep ${arch} __envsub/files_iso.lst | sort)
355355
'''
@@ -399,13 +399,13 @@ def openqa_call_repot_part3():
399399
def openqa_call_build_id_from_iso1(build_id_from_iso):
400400
if not build_id_from_iso:
401401
return ""
402-
return '''build2=$(grep $repot __envsub/files_iso_buildid.lst | grep $arch | grep -o -E '(Build|Snapshot)[^-]*' | grep -o -E '[0-9]+.?[0-9]+(\.[0-9]+)?' | head -n 1)
402+
return r'''build2=$(grep $repot __envsub/files_iso_buildid.lst | grep $arch | grep -o -E '(Build|Snapshot)[^-]*' | grep -o -E '[0-9]+.?[0-9]+(\.[0-9]+)?' | head -n 1)
403403
[ -z "$build2" ] || build1=$build2'''
404404

405405
def openqa_call_build_id_from_iso2(build_id_from_iso):
406406
if not build_id_from_iso:
407407
return ""
408-
return '''[ "$repoKey" != LIVE_PATCHING ] || repoKey=LIVE
408+
return r'''[ "$repoKey" != LIVE_PATCHING ] || repoKey=LIVE
409409
[[ $repoDest != *Media1* ]] || [[ $repo =~ license ]] || [ -z "$build2" ] || echo " BUILD_$repoKey=$build2 \\\\"'''
410410

411411
def openqa_call_extra(repos):
@@ -477,7 +477,7 @@ def openqa_call_repot1_debugsource():
477477
openqa_call_repot1_dest = lambda dest: '''
478478
while read src; do
479479
[[ ''' + dest + ''' =~ $arch ]] || [[ ''' + dest + ''' =~ ${arch//i686/i586} ]] || [[ "ARCHITECTURREPO" == . ]] || break
480-
dest=''' + dest + '''
480+
dest=''' + dest + r'''
481481
[[ ! $src =~ .*\.license ]] || dest=$dest.license
482482
dest=$dest-$buildex
483483
repoKey=REPOKEY

script/scriptgen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ def parse_dir(root, d, files):
12061206
continue
12071207

12081208
rootXml = ElementTree.parse(root + "/" + f).getroot()
1209-
if not rootXml:
1209+
if rootXml is None:
12101210
print("Ignoring [" + f + "]: Cannot parse xml", file=sys.stderr)
12111211
continue
12121212

0 commit comments

Comments
 (0)