This commit is contained in:
Akkariin Meiko
2022-03-12 03:16:09 +08:00
Unverified
parent 12b76e0c7a
commit 27c4ec74a1
10075 changed files with 5122287 additions and 1 deletions
+42
View File
@@ -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)
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
#
# extract-release-date-from-doap-file.py VERSION DOAP-FILE
#
# Extract release date for the given release version from a DOAP file
#
# Copyright (C) 2020 Tim-Philipp Müller <tim centricular com>
#
# 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 sys
import xml.etree.ElementTree as ET
if len(sys.argv) != 3:
sys.exit('Usage: {} VERSION DOAP-FILE'.format(sys.argv[0]))
release_version = sys.argv[1]
doap_fn = sys.argv[2]
tree = ET.parse(doap_fn)
root = tree.getroot()
namespaces = {'doap': 'http://usefulinc.com/ns/doap#'}
for v in root.findall('doap:release/doap:Version', namespaces=namespaces):
if v.findtext('doap:revision', namespaces=namespaces) == release_version:
release_date = v.findtext('doap:created', namespaces=namespaces)
if release_date:
print(release_date)
sys.exit(0)
sys.exit('Could not find a release with version {} in {}'.format(release_version, doap_fn))
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
#
# meson-pkg-config-file-fixup.py PC_FILE VAR1,VAR2,VAR3
#
# Fix up escaping of custom variables in meson-generated .pc file
#
# Copyright (C) 2021 Tim-Philipp Müller <tim centricular com>
#
# 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 sys
if len(sys.argv) < 3:
sys.exit('Usage: {} PC_FILE_BASE_NAME VAR1 [VAR2 [VAR3 ..]]'.format(sys.argv[0]))
pc_name = sys.argv[1]
pc_vars = sys.argv[2:]
build_root = os.environ['MESON_BUILD_ROOT']
# Poking into the private dir is not entirely kosher of course..
pc_files = [
os.path.join(build_root, 'meson-private', pc_name + '.pc'),
os.path.join(build_root, 'meson-uninstalled', pc_name + '-uninstalled.pc')
]
for pc_file in pc_files:
out_lines = ''
with open(pc_file, 'r') as f:
for line in f:
r = line.strip().split('=', 1)
if len(r) == 2 and r[0] in pc_vars:
out_lines += '{}={}\n'.format(r[0], r[1].replace('\\ ', ' '))
else:
out_lines += line
with open(pc_file, 'w') as f_new:
f_new.write(out_lines)
sys.exit(0)
@@ -0,0 +1,4 @@
# dist scripts
if not meson.is_subproject()
meson.add_dist_script('dist-translations.py')
endif
@@ -0,0 +1,49 @@
#!/usr/bin/env python3
#
# update-orc-dist-files.py ORC-FILE GENERATED-HEADER GENERATED-SOURCE
#
# Copies generated orc .c and .h files into source dir as -dist.[ch] backups,
# based on location of passed .orc file.
#
# Copyright (C) 2020 Tim-Philipp Müller <tim centricular com>
#
# 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 shutil
import subprocess
import sys
assert(len(sys.argv) == 4)
orc_file = sys.argv[1]
gen_header = sys.argv[2]
gen_source = sys.argv[3]
# split off .orc suffix
assert(orc_file.endswith('.orc'))
orc_src_base = sys.argv[1][:-4]
# figure out names of disted backup files
dist_h = orc_src_base + "-dist.h"
dist_c = orc_src_base + "-dist.c"
# copy generated files from build dir into source dir
shutil.copyfile(gen_header, dist_h)
shutil.copyfile(gen_source, dist_c)
# run gst-indent on the .c files (twice, because gnu indent)
subprocess.run(['gst-indent', dist_c])
subprocess.run(['gst-indent', dist_c])