aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/gettext.py
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2016-09-25 20:06:02 +0100
committerTim-Philipp Müller <tim@centricular.com>2016-09-25 20:06:02 +0100
commit5ebc77f72223d15fae869ffcc26c0b0020198fc4 (patch)
tree6e3494ac2fff69c3f1237e27be056be8805915a0 /mesonbuild/scripts/gettext.py
parent5fee7331cbb776abe5056ef3c7d89cd01810dd3d (diff)
downloadmeson-5ebc77f72223d15fae869ffcc26c0b0020198fc4.zip
meson-5ebc77f72223d15fae869ffcc26c0b0020198fc4.tar.gz
meson-5ebc77f72223d15fae869ffcc26c0b0020198fc4.tar.bz2
i18n: use POTFILES.in as fallback if there's no POTFILES in po dir
In autotools POTFILES is generated at configure time from POTFILES.in, but Meson only looks for a po/POTFILES in the source directory, which is awkward when trying to maintain both build systems in parallel. Instead just use POTFILES.in as fallback if it exists but POTFILES does not. Also print an error if neither exists. Fixes #818
Diffstat (limited to 'mesonbuild/scripts/gettext.py')
-rw-r--r--mesonbuild/scripts/gettext.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/mesonbuild/scripts/gettext.py b/mesonbuild/scripts/gettext.py
index 4677d5f..1f0a391 100644
--- a/mesonbuild/scripts/gettext.py
+++ b/mesonbuild/scripts/gettext.py
@@ -19,6 +19,12 @@ from mesonbuild.scripts import destdir_join
def run_potgen(src_sub, pkgname, args):
listfile = os.path.join(src_sub, 'POTFILES')
+ if not os.path.exists(listfile):
+ listfile = os.path.join(src_sub, 'POTFILES.in')
+ if not os.path.exists(listfile):
+ print('Could not find file POTFILES in %s' % src_sub)
+ return 1
+
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)