diff options
| author | sid <sidtosh4@gmail.com> | 2024-08-15 16:41:43 +0100 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-09-04 23:12:00 +0300 |
| commit | 49a58cf7433e8438f9151d7b84fd2620c7e95632 (patch) | |
| tree | 46dc73e1ba34ddc8e16ec73db79034326e7f0932 /mesonbuild/modules | |
| parent | 7071ee632c291a2caa1c73ca003d9829ba630a09 (diff) | |
| download | meson-49a58cf7433e8438f9151d7b84fd2620c7e95632.tar.gz | |
modules/gnome: Make 'gnome.yelp()' install actual media with symlinks
In cases, when localized media files are provided by some languages,
we need to use 'gnome.yelp ()' with 'symlink_media: false' which
copies all files from 'C' locale in addition to the localized
media. This wastes storage space. The alternative is to use
'symlink_media: true' which symlinks entirely to 'C' media files
ignoring localized media files.
As a middle ground, if the localized media file exists in the source
tree for a language, we use that file rather than symlinking to 'C'
media with the same filename even when 'symlink_media: true'. This
saves storage space.
If there are no localized media files in non-C language, the existing
behaviour is maintained.
Diffstat (limited to 'mesonbuild/modules')
| -rw-r--r-- | mesonbuild/modules/gnome.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 24ab50efc..e0c1214d0 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -1335,15 +1335,18 @@ class GnomeModule(ExtensionModule): for i, m in enumerate(media): m_dir = os.path.dirname(m) m_install_dir = os.path.join(l_install_dir, m_dir) + try: + m_file: T.Optional[mesonlib.File] = mesonlib.File.from_source_file(state.environment.source_dir, l_subdir, m) + except MesonException: + m_file = None + l_data: T.Union[build.Data, build.SymlinkData] - if symlinks: + if symlinks and not m_file: link_target = os.path.join(os.path.relpath(c_install_dir, start=m_install_dir), m) l_data = build.SymlinkData(link_target, os.path.basename(m), m_install_dir, state.subproject, install_tag='doc') else: - try: - m_file = mesonlib.File.from_source_file(state.environment.source_dir, l_subdir, m) - except MesonException: + if not m_file: m_file = media_files[i] l_data = build.Data([m_file], m_install_dir, m_install_dir, mesonlib.FileMode(), state.subproject, install_tag='doc') |
