summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2020-09-07 22:39:02 +0100
committerTim-Philipp Müller <tim@centricular.com>2020-09-07 22:39:02 +0100
commitd1ef0e892ccb8b00f9bf140baced51cc85695009 (patch)
treed63d0da7fc1aa25fba900f69e2f7202bd8cef366
parent47c43b29eb707492ff959dd44c804d8a19ad1d1b (diff)
meson: dist pot file in tarballs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/716>
-rw-r--r--meson.build2
-rwxr-xr-xscripts/dist-translations.py42
-rw-r--r--scripts/meson.build4
3 files changed, 48 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 5823b61b3..d341abcc4 100644
--- a/meson.build
+++ b/meson.build
@@ -467,6 +467,8 @@ if find_program('xgettext', required : get_option('nls')).found()
subdir('po')
endif
+subdir('scripts')
+
# Set release date
if gst_version_nano == 0
extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
diff --git a/scripts/dist-translations.py b/scripts/dist-translations.py
new file mode 100755
index 000000000..65148d6ec
--- /dev/null
+++ b/scripts/dist-translations.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2020 Tim-Philipp Müller <tim centricular net>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+import os
+import subprocess
+import shutil
+import tempfile
+
+if __name__ == "__main__":
+ dist_root = os.environ['MESON_DIST_ROOT']
+ build_root = os.environ['MESON_BUILD_ROOT']
+ source_root = os.environ['MESON_SOURCE_ROOT']
+ pwd = os.environ['PWD']
+ tmpdir = tempfile.gettempdir()
+
+ module = os.path.basename(os.path.normpath(source_root))
+
+ # Generate pot file
+ print('Generating pot file ...')
+ subprocess.run(['ninja', '-C', build_root, module + '-1.0-pot'], check=True)
+
+ # Dist pot file in tarball
+ print('Copying pot file into dist staging directory ...')
+ pot_src = os.path.join(source_root, 'po', module + '-1.0.pot')
+ dist_po_dir = os.path.join(dist_root, 'po')
+ shutil.copy2(pot_src, dist_po_dir)
diff --git a/scripts/meson.build b/scripts/meson.build
new file mode 100644
index 000000000..f5d910627
--- /dev/null
+++ b/scripts/meson.build
@@ -0,0 +1,4 @@
+# dist scripts
+if not meson.is_subproject()
+ meson.add_dist_script('dist-translations.py')
+endif