aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-06-21 04:36:30 -0400
committerGitHub <noreply@github.com>2017-06-21 04:36:30 -0400
commit2d659b649bf43963791cc6e9896da6ef46370743 (patch)
tree333ef612d1677be434a06a40a1fb74a12d8d482f
parentf171faee32b877aec064a1bc4ab91adda632299d (diff)
parent733aee123d79e9540395150fb5aecc43dd46068b (diff)
downloadmeson-2d659b649bf43963791cc6e9896da6ef46370743.zip
meson-2d659b649bf43963791cc6e9896da6ef46370743.tar.gz
meson-2d659b649bf43963791cc6e9896da6ef46370743.tar.bz2
Merge pull request #1924 from mesonbuild/tingping/yelp-fixes
Various yelp fixes
-rw-r--r--docs/markdown/Gnome-module.md4
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/scripts/yelphelper.py15
-rwxr-xr-xrun_project_tests.py3
-rw-r--r--test cases/frameworks/13 yelp/help/meson.build8
-rw-r--r--test cases/frameworks/13 yelp/installed_files.txt7
6 files changed, 34 insertions, 5 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md
index 61b88ad..805ceaa 100644
--- a/docs/markdown/Gnome-module.md
+++ b/docs/markdown/Gnome-module.md
@@ -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()
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 6ec7040..6c22976 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -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')
diff --git a/mesonbuild/scripts/yelphelper.py b/mesonbuild/scripts/yelphelper.py
index 47dfb71..978a870 100644
--- a/mesonbuild/scripts/yelphelper.py
+++ b/mesonbuild/scripts/yelphelper.py
@@ -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)
diff --git a/run_project_tests.py b/run_project_tests.py
index 66d7eb0..3c89d75 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -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:
diff --git a/test cases/frameworks/13 yelp/help/meson.build b/test cases/frameworks/13 yelp/help/meson.build
index 7c6f01d..85bc980 100644
--- a/test cases/frameworks/13 yelp/help/meson.build
+++ b/test cases/frameworks/13 yelp/help/meson.build
@@ -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'],
)
diff --git a/test cases/frameworks/13 yelp/installed_files.txt b/test cases/frameworks/13 yelp/installed_files.txt
index 59d2158..9fc097d 100644
--- a/test cases/frameworks/13 yelp/installed_files.txt
+++ b/test cases/frameworks/13 yelp/installed_files.txt
@@ -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