aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/gettext.py
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-10-15 19:30:55 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2016-10-16 17:54:16 +0300
commitf30be6fb9232b297d9da73d01d8053bbf4b409fb (patch)
treed95b25a690a50a4113c915cdad5f538f0924a388 /mesonbuild/scripts/gettext.py
parenta417efdf2483e0a2cbb1a4f9ff51fab2cc051d91 (diff)
downloadmeson-f30be6fb9232b297d9da73d01d8053bbf4b409fb.zip
meson-f30be6fb9232b297d9da73d01d8053bbf4b409fb.tar.gz
meson-f30be6fb9232b297d9da73d01d8053bbf4b409fb.tar.bz2
gettext: Add ability to set GETTEXTDATADIRS
Some projects use this to allow using local its files
Diffstat (limited to 'mesonbuild/scripts/gettext.py')
-rw-r--r--mesonbuild/scripts/gettext.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py
index ba6b242..95fd45a 100644
--- a/mesonbuild/scripts/gettext.py
+++ b/mesonbuild/scripts/gettext.py
@@ -15,7 +15,7 @@
import os, subprocess, shutil
from mesonbuild.scripts import destdir_join
-def run_potgen(src_sub, pkgname, args):
+def run_potgen(src_sub, pkgname, datadirs, args):
listfile = os.path.join(src_sub, 'POTFILES')
if not os.path.exists(listfile):
listfile = os.path.join(src_sub, 'POTFILES.in')
@@ -23,9 +23,14 @@ def run_potgen(src_sub, pkgname, args):
print('Could not find file POTFILES in %s' % src_sub)
return 1
+ child_env = os.environ.copy()
+ if datadirs:
+ child_env['GETTEXTDATADIRS'] = datadirs
+
ofile = os.path.join(src_sub, pkgname + '.pot')
return subprocess.call(['xgettext', '--package-name=' + pkgname, '-p', src_sub, '-f', listfile,
- '-D', os.environ['MESON_SOURCE_ROOT'], '-k_', '-o', ofile] + args)
+ '-D', os.environ['MESON_SOURCE_ROOT'], '-k_', '-o', ofile] + args,
+ env=child_env)
def gen_gmo(src_sub, bld_sub, langs):
for l in langs:
@@ -47,9 +52,12 @@ def do_install(src_sub, bld_sub, dest, pkgname, langs):
def run(args):
subcmd = args[0]
if subcmd == 'pot':
+ pkgname = args[1]
+ datadirs = args[2][11:] if args[2].startswith('--datadirs=') else None
+ extra_args = args[3:] if datadirs is not None else args[2:]
src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR'])
bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], os.environ['MESON_SUBDIR'])
- return run_potgen(src_sub, args[1], args[2:])
+ return run_potgen(src_sub, pkgname, datadirs, extra_args)
elif subcmd == 'gen_gmo':
src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR'])
bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], os.environ['MESON_SUBDIR'])