forked from kiss-community/repo
meson: make gettext/intltool optional.
This commit is contained in:
parent
1dcef535a7
commit
cf3f3df2ea
@ -1,5 +1,7 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
patch -p1 < no-gettext.patch
|
||||
|
||||
python setup.py build
|
||||
python setup.py install \
|
||||
--root="$1" \
|
||||
|
@ -1 +1,2 @@
|
||||
92cf7f095fe2d1c3f23824805480c29eaa381e71ae0a90ac85949d1e10f9041c 0.51.1.tar.gz
|
||||
be5f4ed1392b77d47b95c41d093105194eb48a258f7d924476fbeb9e1d26f100 no-gettext.patch
|
||||
|
75
extra/meson/patches/no-gettext.patch
Normal file
75
extra/meson/patches/no-gettext.patch
Normal file
@ -0,0 +1,75 @@
|
||||
From a87e69fa10544310f6e7ef60a01377c8c52b3b2c Mon Sep 17 00:00:00 2001
|
||||
From: Jussi Pakkanen <jpakkane@gmail.com>
|
||||
Date: Fri, 2 Aug 2019 19:25:19 +0300
|
||||
Subject: [PATCH] Make gettext targets no-ops if gettext is not installed.
|
||||
Closes: #821.
|
||||
|
||||
---
|
||||
docs/markdown/snippets/nogettext.md | 7 +++++++
|
||||
mesonbuild/modules/i18n.py | 16 ++++++++++++++--
|
||||
2 files changed, 21 insertions(+), 2 deletions(-)
|
||||
create mode 100644 docs/markdown/snippets/nogettext.md
|
||||
|
||||
diff --git a/docs/markdown/snippets/nogettext.md b/docs/markdown/snippets/nogettext.md
|
||||
new file mode 100644
|
||||
index 0000000000..5053226743
|
||||
--- /dev/null
|
||||
+++ b/docs/markdown/snippets/nogettext.md
|
||||
@@ -0,0 +1,7 @@
|
||||
+## Gettext targets are ignored if `gettext` is not installed
|
||||
+
|
||||
+Previously the `i18n` module has errored out when `gettext` tools are
|
||||
+not installed on the system. Starting with this version they will
|
||||
+become no-ops instead. This makes it easier to build projects on
|
||||
+minimal environments (such as when bootstrapping) that do not have
|
||||
+translation tools installed.
|
||||
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
|
||||
index 76b9d63018..1efc7b579f 100644
|
||||
--- a/mesonbuild/modules/i18n.py
|
||||
+++ b/mesonbuild/modules/i18n.py
|
||||
@@ -15,7 +15,7 @@
|
||||
import shutil
|
||||
|
||||
from os import path
|
||||
-from .. import coredata, mesonlib, build
|
||||
+from .. import coredata, mesonlib, build, mlog
|
||||
from ..mesonlib import MesonException
|
||||
from . import ModuleReturnValue
|
||||
from . import ExtensionModule
|
||||
@@ -55,8 +55,18 @@
|
||||
]
|
||||
}
|
||||
|
||||
+
|
||||
class I18nModule(ExtensionModule):
|
||||
|
||||
+ nogettext_warning_printed = False
|
||||
+
|
||||
+ @classmethod
|
||||
+ def nogettext_warning(cls):
|
||||
+ if not cls.nogettext_warning_printed:
|
||||
+ mlog.warning('Gettext not found, all translation targets will be ignored.')
|
||||
+ cls.nogettext_warning_printed = True
|
||||
+ return ModuleReturnValue(None, [])
|
||||
+
|
||||
@staticmethod
|
||||
def _get_data_dirs(state, dirs):
|
||||
"""Returns source directories of relative paths"""
|
||||
@@ -67,6 +77,8 @@ def _get_data_dirs(state, dirs):
|
||||
@FeatureNewKwargs('i18n.merge_file', '0.51.0', ['args'])
|
||||
@permittedKwargs(build.CustomTarget.known_kwargs | {'data_dirs', 'po_dir', 'type', 'args'})
|
||||
def merge_file(self, state, args, kwargs):
|
||||
+ if not shutil.which('xgettext'):
|
||||
+ return self.nogettext_warning()
|
||||
podir = kwargs.pop('po_dir', None)
|
||||
if not podir:
|
||||
raise MesonException('i18n: po_dir is a required kwarg')
|
||||
@@ -120,7 +132,7 @@ def gettext(self, state, args, kwargs):
|
||||
if len(args) != 1:
|
||||
raise coredata.MesonException('Gettext requires one positional argument (package name).')
|
||||
if not shutil.which('xgettext'):
|
||||
- raise coredata.MesonException('Can not do gettext because xgettext is not installed.')
|
||||
+ return self.nogettext_warning()
|
||||
packagename = args[0]
|
||||
languages = mesonlib.stringlistify(kwargs.get('languages', []))
|
||||
datadirs = self._get_data_dirs(state, mesonlib.stringlistify(kwargs.get('data_dirs', [])))
|
@ -1 +1,2 @@
|
||||
https://github.com/mesonbuild/meson/archive/0.51.1.tar.gz
|
||||
patches/no-gettext.patch
|
||||
|
@ -1 +1 @@
|
||||
0.51.1 1
|
||||
0.51.1 2
|
||||
|
Loading…
Reference in New Issue
Block a user