Merge pull request #1924 from mesonbuild/tingping/yelp-fixes

Various yelp fixes
pull/1978/head
Jussi Pakkanen 8 years ago committed by GitHub
commit 2d659b649b
  1. 4
      docs/markdown/Gnome-module.md
  2. 2
      mesonbuild/modules/gnome.py
  3. 15
      mesonbuild/scripts/yelphelper.py
  4. 3
      run_project_tests.py
  5. 8
      test cases/frameworks/13 yelp/help/meson.build
  6. 7
      test cases/frameworks/13 yelp/installed_files.txt

@ -127,9 +127,11 @@ This also creates two targets for translations `help-$project-update-po` and `he
* `sources`: list of pages
* `media`: list of media such as images
* `symlink_media`: if media should be symlinked (requires newish yelp) defaults to `false`
* `symlink_media`: if media should be symlinked not copied (defaults to `true` since 0.41.0)
* `languages`: list of languages for translations
Note that very old versions of yelp may not support symlinked media; At least 3.10 should work.
*Added 0.36.0*
### gnome.gtkdoc()

@ -619,7 +619,7 @@ class GnomeModule(ExtensionModule):
langs = mesonlib.stringlistify(kwargs.pop('languages', []))
media = mesonlib.stringlistify(kwargs.pop('media', []))
symlinks = kwargs.pop('symlink_media', False)
symlinks = kwargs.pop('symlink_media', True)
if not isinstance(symlinks, bool):
raise MesonException('symlink_media must be a boolean')

@ -74,13 +74,24 @@ def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, pr
if not os.path.exists(infile):
if lang == 'C':
mlog.warning('Media file "%s" did not exist in C directory' % m)
continue
elif symlinks:
srcfile = os.path.join(c_install_dir, m)
mlog.log('Symlinking %s to %s.' % (outfile, srcfile))
if '/' in m or '\\' in m:
os.makedirs(os.path.dirname(outfile), exist_ok=True)
os.symlink(srcfile, outfile)
continue
try:
try:
os.symlink(srcfile, outfile)
except FileExistsError:
os.remove(outfile)
os.symlink(srcfile, outfile)
continue
except (NotImplementedError, OSError):
mlog.warning('Symlinking not supported, falling back to copying')
else:
# Lang doesn't have media file so copy it over 'C' one
infile = os.path.join(srcdir, 'C', m)
mlog.log('Installing %s to %s' % (infile, outfile))
if '/' in m or '\\' in m:
os.makedirs(os.path.dirname(outfile), exist_ok=True)

@ -214,7 +214,8 @@ def validate_install(srcdir, installdir, compiler):
expected[platform_fix_name(line.strip())] = False
# Check if expected files were found
for fname in expected:
if os.path.exists(os.path.join(installdir, fname)):
file_path = os.path.join(installdir, fname)
if os.path.exists(file_path) or os.path.islink(file_path):
expected[fname] = True
for (fname, found) in expected.items():
if not found:

@ -3,5 +3,13 @@ gnome = import('gnome')
gnome.yelp('meson',
sources: 'index.page',
media: 'media/test.txt',
symlink_media: false,
languages: ['de', 'es'],
)
gnome.yelp('meson-symlink',
sources: 'index.page',
media: 'media/test.txt',
symlink_media: true,
languages: ['de', 'es'],
)

@ -3,3 +3,10 @@ usr/share/help/C/meson/media/test.txt
usr/share/help/es/meson/index.page
usr/share/help/es/meson/media/test.txt
usr/share/help/de/meson/index.page
usr/share/help/de/meson/media/test.txt
usr/share/help/C/meson-symlink/index.page
usr/share/help/C/meson-symlink/media/test.txt
usr/share/help/es/meson-symlink/media/test.txt
usr/share/help/es/meson-symlink/index.page
usr/share/help/de/meson-symlink/index.page
usr/share/help/de/meson-symlink/media/test.txt

Loading…
Cancel
Save