1#!/usr/bin/env python3 2# 3# Copyright (C) 2020 Tim-Philipp Müller <tim centricular net> 4# 5# This library is free software; you can redistribute it and/or 6# modify it under the terms of the GNU Library General Public 7# License as published by the Free Software Foundation; either 8# version 2 of the License, or (at your option) any later version. 9# 10# This library is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Library General Public License for more details. 14# 15# You should have received a copy of the GNU Library General Public 16# License along with this library; if not, write to the 17# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18# Boston, MA 02110-1301, USA. 19 20import os 21import subprocess 22import shutil 23import tempfile 24 25if __name__ == "__main__": 26 dist_root = os.environ['MESON_DIST_ROOT'] 27 build_root = os.environ['MESON_BUILD_ROOT'] 28 source_root = os.environ['MESON_SOURCE_ROOT'] 29 pwd = os.environ['PWD'] 30 tmpdir = tempfile.gettempdir() 31 32 module = os.path.basename(os.path.normpath(source_root)) 33 34 # Generate pot file 35 print('Generating pot file ...') 36 subprocess.run(['ninja', '-C', build_root, module + '-1.0-pot'], check=True) 37 38 # Dist pot file in tarball 39 print('Copying pot file into dist staging directory ...') 40 pot_src = os.path.join(source_root, 'po', module + '-1.0.pot') 41 dist_po_dir = os.path.join(dist_root, 'po') 42 shutil.copy2(pot_src, dist_po_dir) 43