mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
Fix translation pot files when creating dist tarballs
Add version as per Translation Project requirements and also add a .pot file without the ABI suffix. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3711>
This commit is contained in:
parent
22917b140f
commit
a1672ec004
10 changed files with 105 additions and 25 deletions
|
@ -21,11 +21,13 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dist_root = os.environ['MESON_DIST_ROOT']
|
dist_root = os.environ['MESON_DIST_ROOT']
|
||||||
build_root = os.environ['MESON_BUILD_ROOT']
|
build_root = os.environ['MESON_BUILD_ROOT']
|
||||||
source_root = os.environ['MESON_SOURCE_ROOT']
|
source_root = os.environ['MESON_SOURCE_ROOT']
|
||||||
|
project_version = sys.argv[1]
|
||||||
pwd = os.environ['PWD']
|
pwd = os.environ['PWD']
|
||||||
tmpdir = tempfile.gettempdir()
|
tmpdir = tempfile.gettempdir()
|
||||||
|
|
||||||
|
@ -35,8 +37,22 @@ if __name__ == "__main__":
|
||||||
print('Generating pot file ...')
|
print('Generating pot file ...')
|
||||||
subprocess.run(['ninja', '-C', build_root, module + '-1.0-pot'], check=True)
|
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')
|
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)
|
# Dist pot file in tarball, and fix up version in POT file to match
|
||||||
|
# Translation Project requirements as part of the copying.
|
||||||
|
with open(pot_src, 'r') as f:
|
||||||
|
pot_file = f.read()
|
||||||
|
|
||||||
|
pot_file = pot_file.replace(f'Project-Id-Version: {module}-1.0',
|
||||||
|
f'Project-Id-Version: {module}-{project_version}', 1)
|
||||||
|
|
||||||
|
print('Copying pot file into dist staging directory ...')
|
||||||
|
dist_pot_with_suffix = os.path.join(dist_root, 'po', f'{module}-1.0.pot')
|
||||||
|
with open(dist_pot_with_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
||||||
|
# And another copy without the 1.0 suffix
|
||||||
|
dist_pot_without_suffix = os.path.join(dist_root, 'po', f'{module}.pot')
|
||||||
|
with open(dist_pot_without_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# dist scripts
|
# dist scripts
|
||||||
if not meson.is_subproject()
|
if not meson.is_subproject()
|
||||||
meson.add_dist_script('dist-translations.py')
|
meson.add_dist_script('dist-translations.py', meson.project_version())
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -21,11 +21,13 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dist_root = os.environ['MESON_DIST_ROOT']
|
dist_root = os.environ['MESON_DIST_ROOT']
|
||||||
build_root = os.environ['MESON_BUILD_ROOT']
|
build_root = os.environ['MESON_BUILD_ROOT']
|
||||||
source_root = os.environ['MESON_SOURCE_ROOT']
|
source_root = os.environ['MESON_SOURCE_ROOT']
|
||||||
|
project_version = sys.argv[1]
|
||||||
pwd = os.environ['PWD']
|
pwd = os.environ['PWD']
|
||||||
tmpdir = tempfile.gettempdir()
|
tmpdir = tempfile.gettempdir()
|
||||||
|
|
||||||
|
@ -35,8 +37,22 @@ if __name__ == "__main__":
|
||||||
print('Generating pot file ...')
|
print('Generating pot file ...')
|
||||||
subprocess.run(['ninja', '-C', build_root, module + '-1.0-pot'], check=True)
|
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')
|
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)
|
# Dist pot file in tarball, and fix up version in POT file to match
|
||||||
|
# Translation Project requirements as part of the copying.
|
||||||
|
with open(pot_src, 'r') as f:
|
||||||
|
pot_file = f.read()
|
||||||
|
|
||||||
|
pot_file = pot_file.replace(f'Project-Id-Version: {module}-1.0',
|
||||||
|
f'Project-Id-Version: {module}-{project_version}', 1)
|
||||||
|
|
||||||
|
print('Copying pot file into dist staging directory ...')
|
||||||
|
dist_pot_with_suffix = os.path.join(dist_root, 'po', f'{module}-1.0.pot')
|
||||||
|
with open(dist_pot_with_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
||||||
|
# And another copy without the 1.0 suffix
|
||||||
|
dist_pot_without_suffix = os.path.join(dist_root, 'po', f'{module}.pot')
|
||||||
|
with open(dist_pot_without_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# dist scripts
|
# dist scripts
|
||||||
if not meson.is_subproject()
|
if not meson.is_subproject()
|
||||||
meson.add_dist_script('dist-translations.py')
|
meson.add_dist_script('dist-translations.py', meson.project_version())
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -21,11 +21,13 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dist_root = os.environ['MESON_DIST_ROOT']
|
dist_root = os.environ['MESON_DIST_ROOT']
|
||||||
build_root = os.environ['MESON_BUILD_ROOT']
|
build_root = os.environ['MESON_BUILD_ROOT']
|
||||||
source_root = os.environ['MESON_SOURCE_ROOT']
|
source_root = os.environ['MESON_SOURCE_ROOT']
|
||||||
|
project_version = sys.argv[1]
|
||||||
pwd = os.environ['PWD']
|
pwd = os.environ['PWD']
|
||||||
tmpdir = tempfile.gettempdir()
|
tmpdir = tempfile.gettempdir()
|
||||||
|
|
||||||
|
@ -35,8 +37,22 @@ if __name__ == "__main__":
|
||||||
print('Generating pot file ...')
|
print('Generating pot file ...')
|
||||||
subprocess.run(['ninja', '-C', build_root, module + '-1.0-pot'], check=True)
|
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')
|
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)
|
# Dist pot file in tarball, and fix up version in POT file to match
|
||||||
|
# Translation Project requirements as part of the copying.
|
||||||
|
with open(pot_src, 'r') as f:
|
||||||
|
pot_file = f.read()
|
||||||
|
|
||||||
|
pot_file = pot_file.replace(f'Project-Id-Version: {module}-1.0',
|
||||||
|
f'Project-Id-Version: {module}-{project_version}', 1)
|
||||||
|
|
||||||
|
print('Copying pot file into dist staging directory ...')
|
||||||
|
dist_pot_with_suffix = os.path.join(dist_root, 'po', f'{module}-1.0.pot')
|
||||||
|
with open(dist_pot_with_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
||||||
|
# And another copy without the 1.0 suffix
|
||||||
|
dist_pot_without_suffix = os.path.join(dist_root, 'po', f'{module}.pot')
|
||||||
|
with open(dist_pot_without_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# dist scripts
|
# dist scripts
|
||||||
if not meson.is_subproject()
|
if not meson.is_subproject()
|
||||||
meson.add_dist_script('dist-translations.py')
|
meson.add_dist_script('dist-translations.py', meson.project_version())
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -21,11 +21,13 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dist_root = os.environ['MESON_DIST_ROOT']
|
dist_root = os.environ['MESON_DIST_ROOT']
|
||||||
build_root = os.environ['MESON_BUILD_ROOT']
|
build_root = os.environ['MESON_BUILD_ROOT']
|
||||||
source_root = os.environ['MESON_SOURCE_ROOT']
|
source_root = os.environ['MESON_SOURCE_ROOT']
|
||||||
|
project_version = sys.argv[1]
|
||||||
pwd = os.environ['PWD']
|
pwd = os.environ['PWD']
|
||||||
tmpdir = tempfile.gettempdir()
|
tmpdir = tempfile.gettempdir()
|
||||||
|
|
||||||
|
@ -35,8 +37,22 @@ if __name__ == "__main__":
|
||||||
print('Generating pot file ...')
|
print('Generating pot file ...')
|
||||||
subprocess.run(['ninja', '-C', build_root, module + '-1.0-pot'], check=True)
|
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')
|
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)
|
# Dist pot file in tarball, and fix up version in POT file to match
|
||||||
|
# Translation Project requirements as part of the copying.
|
||||||
|
with open(pot_src, 'r') as f:
|
||||||
|
pot_file = f.read()
|
||||||
|
|
||||||
|
pot_file = pot_file.replace(f'Project-Id-Version: {module}-1.0',
|
||||||
|
f'Project-Id-Version: {module}-{project_version}', 1)
|
||||||
|
|
||||||
|
print('Copying pot file into dist staging directory ...')
|
||||||
|
dist_pot_with_suffix = os.path.join(dist_root, 'po', f'{module}-1.0.pot')
|
||||||
|
with open(dist_pot_with_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
||||||
|
# And another copy without the 1.0 suffix
|
||||||
|
dist_pot_without_suffix = os.path.join(dist_root, 'po', f'{module}.pot')
|
||||||
|
with open(dist_pot_without_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# dist scripts
|
# dist scripts
|
||||||
if not meson.is_subproject()
|
if not meson.is_subproject()
|
||||||
meson.add_dist_script('dist-translations.py')
|
meson.add_dist_script('dist-translations.py', meson.project_version())
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -21,11 +21,13 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dist_root = os.environ['MESON_DIST_ROOT']
|
dist_root = os.environ['MESON_DIST_ROOT']
|
||||||
build_root = os.environ['MESON_BUILD_ROOT']
|
build_root = os.environ['MESON_BUILD_ROOT']
|
||||||
source_root = os.environ['MESON_SOURCE_ROOT']
|
source_root = os.environ['MESON_SOURCE_ROOT']
|
||||||
|
project_version = sys.argv[1]
|
||||||
pwd = os.environ['PWD']
|
pwd = os.environ['PWD']
|
||||||
tmpdir = tempfile.gettempdir()
|
tmpdir = tempfile.gettempdir()
|
||||||
|
|
||||||
|
@ -35,8 +37,22 @@ if __name__ == "__main__":
|
||||||
print('Generating pot file ...')
|
print('Generating pot file ...')
|
||||||
subprocess.run(['ninja', '-C', build_root, module + '-1.0-pot'], check=True)
|
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')
|
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)
|
# Dist pot file in tarball, and fix up version in POT file to match
|
||||||
|
# Translation Project requirements as part of the copying.
|
||||||
|
with open(pot_src, 'r') as f:
|
||||||
|
pot_file = f.read()
|
||||||
|
|
||||||
|
pot_file = pot_file.replace(f'Project-Id-Version: {module}-1.0',
|
||||||
|
f'Project-Id-Version: {module}-{project_version}', 1)
|
||||||
|
|
||||||
|
print('Copying pot file into dist staging directory ...')
|
||||||
|
dist_pot_with_suffix = os.path.join(dist_root, 'po', f'{module}-1.0.pot')
|
||||||
|
with open(dist_pot_with_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
||||||
|
# And another copy without the 1.0 suffix
|
||||||
|
dist_pot_without_suffix = os.path.join(dist_root, 'po', f'{module}.pot')
|
||||||
|
with open(dist_pot_without_suffix, 'w') as f:
|
||||||
|
f.write(pot_file)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# dist scripts
|
# dist scripts
|
||||||
if not meson.is_subproject()
|
if not meson.is_subproject()
|
||||||
meson.add_dist_script('dist-translations.py')
|
meson.add_dist_script('dist-translations.py', meson.project_version())
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue