Skip to content

Commit 89bfaae

Browse files
committed
2 parents 0003e3c + 56b4290 commit 89bfaae

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/update_cfg_file.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,21 @@ def fix_desktop_image_in_thema_callback(install_dir_for_grub,
365365
dir_, fname):
366366
if not fname.lower().endswith('.txt'):
367367
return
368-
log("Probing '%s'!" % fname)
369368
theme_file = os.path.join(dir_, fname)
370369
updated = False
371370
with open(theme_file, 'r', encoding='utf-8') as f:
372-
lines = []
373371
pattern = re.compile(r'^desktop-image\s*:\s*(.*)$')
374-
for line in f.readlines():
372+
try:
373+
src_lines = f.readlines()
374+
except UnicodeDecodeError:
375+
log("Unexpected encoding in %s" % theme_file)
376+
return
377+
lines = []
378+
for line in src_lines:
375379
line = line.rstrip()
376380
m = pattern.match(line)
377381
if m and m.group(1).startswith(('/', '"/')):
378-
log("Updating '%s'" % line)
382+
log("Updating '%s' in %s" % (line,theme_file))
379383
updated = True
380384
partial_path = m.group(1).strip('"').lstrip('/')
381385
line = 'desktop-image: "%s/%s"' % \

0 commit comments

Comments
 (0)