Skip to content

Commit 27c5d9f

Browse files
lazkajpakkane
authored andcommitted
gnome.yelp(): Fix media symlink fallback path
When the media file for a specific language doesn't exist we try to symlink it to the C one. If symlinking fails we need to fall back to copying the C one like in the non-symlink case. The fallback code path didn't set the source so this always failed. Also check if the C fallback exists before trying to symlink/copy, otherwise we crash if C isn't the first lang we try.
1 parent 5065db8 commit 27c5d9f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mesonbuild/scripts/yelphelper.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, pr
7373
for m in media:
7474
infile = os.path.join(srcdir, lang, m)
7575
outfile = os.path.join(indir, m)
76+
c_infile = os.path.join(srcdir, 'C', m)
7677
if not os.path.exists(infile):
77-
if lang == 'C':
78+
if not os.path.exists(c_infile):
7879
mlog.warning('Media file "%s" did not exist in C directory' % m)
7980
continue
8081
elif symlinks:
@@ -91,9 +92,10 @@ def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, pr
9192
continue
9293
except (NotImplementedError, OSError):
9394
mlog.warning('Symlinking not supported, falling back to copying')
95+
infile = c_infile
9496
else:
9597
# Lang doesn't have media file so copy it over 'C' one
96-
infile = os.path.join(srcdir, 'C', m)
98+
infile = c_infile
9799
mlog.log('Installing %s to %s' % (infile, outfile))
98100
if has_path_sep(m):
99101
os.makedirs(os.path.dirname(outfile), exist_ok=True)

0 commit comments

Comments
 (0)