mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 01:43:24 +00:00
build/windows: Port .po tests of test-installer-langs.sh to Python
Also, they are now run on list-installer-langs.py before ninja test, since this was technically possible to implement.
This commit is contained in:
parent
8e81ed9572
commit
ae514268b5
2 changed files with 14 additions and 33 deletions
|
@ -24,6 +24,7 @@ root = tree.getroot()
|
|||
## Create list of lang [Languages]
|
||||
if sys.argv[1] == 'msg':
|
||||
msg_list = []
|
||||
faultingmsg_list = ''
|
||||
for po in po_inno_array:
|
||||
# Change po
|
||||
po = po.replace('\\', '').replace('//', '').replace('..', '').replace('po-windows-installer', '')
|
||||
|
@ -33,6 +34,8 @@ if sys.argv[1] == 'msg':
|
|||
if entry.get('dl_code') == po:
|
||||
inno_code = entry.get('inno_code').replace('\\\\', '\\')
|
||||
break
|
||||
if inno_code is None:
|
||||
faultingmsg_list = faultingmsg_list + f"{po} "
|
||||
# Create line
|
||||
if inno_code is not None:
|
||||
msg_line = f'Name: "{po}"; MessagesFile: "compiler:{inno_code},{{#ASSETS_DIR}}\\lang\\{po}.setup.isl"'
|
||||
|
@ -40,10 +43,15 @@ if sys.argv[1] == 'msg':
|
|||
output_file = os.path.join(MESON_BUILD_ROOT, 'build/windows/installer/base_po-msg.list')
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
f.write('\n'.join(msg_list))
|
||||
if faultingmsg_list != '':
|
||||
print("Error: languages listed in iso_639_custom.xml do not match the .po files in po-windows-installer/.")
|
||||
print(f"- Faulting 'inno_code' on iso_639_custom.xml: {faultingmsg_list}")
|
||||
sys.exit(1)
|
||||
|
||||
## Create list of lang [Components]
|
||||
elif sys.argv[1] == 'cmp':
|
||||
cmp_list = []
|
||||
faultingcmp_list = ''
|
||||
for po in po_array:
|
||||
# Change po
|
||||
po = po.replace('\\', '').replace('//', '').replace('..', '').replace('po', '')
|
||||
|
@ -54,6 +62,8 @@ elif sys.argv[1] == 'cmp':
|
|||
if entry.get('dl_code') == po:
|
||||
desc = entry.get('name')
|
||||
break
|
||||
if desc is None:
|
||||
faultingcmp_list = faultingcmp_list + f"{po} "
|
||||
# Create line
|
||||
if desc is not None:
|
||||
cmp_line = f'Name: loc\\{po_clean}; Description: "{desc}"; Types: full custom'
|
||||
|
@ -61,6 +71,10 @@ elif sys.argv[1] == 'cmp':
|
|||
output_file = os.path.join(MESON_BUILD_ROOT, 'build/windows/installer/base_po-cmp.list')
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
f.write('\n'.join(cmp_list))
|
||||
if faultingcmp_list != '':
|
||||
print("Error: languages listed in iso_639_custom.xml do not match the .po files in po/.")
|
||||
print(f"- Faulting 'dl_code' on iso_639_custom.xml: {faultingcmp_list}")
|
||||
sys.exit(1)
|
||||
|
||||
## Create list of lang [Files]
|
||||
elif sys.argv[1] == 'files':
|
||||
|
|
|
@ -4,25 +4,6 @@
|
|||
# translations present. This check step is necessary to not forget new
|
||||
# installer translations because we have a manual step.
|
||||
|
||||
INSTALLER_LANGS=`grep -rI '^Name:.*MessagesFile' build/windows/installer/base_po-msg.list | \
|
||||
sed 's/^Name: *"\([a-zA-Z_]*\)".*$/\1/' | sort`
|
||||
# 'en' doesn't have a gettext file because it is the default.
|
||||
INSTALLER_LANGS=`echo "$INSTALLER_LANGS" | tr '\n\r' ' ' | sed 's/\<en\> //'`
|
||||
|
||||
PO_INSTALLER_LANGS=`ls ${GIMP_TESTING_ABS_TOP_SRCDIR}/po-windows-installer/*.po | \
|
||||
sed 's%.*/po-windows-installer/\([a-zA-Z_]*\).po%\1%' | sort`
|
||||
PO_INSTALLER_LANGS=`echo "$PO_INSTALLER_LANGS" | tr '\n\r' ' '`
|
||||
|
||||
if [ "$PO_INSTALLER_LANGS" != "$INSTALLER_LANGS" ]; then
|
||||
echo "Error: languages listed in generated 'base_po-msg.list' do not match the .po files in po-windows-installer/."
|
||||
echo "- PO languages: $PO_INSTALLER_LANGS"
|
||||
echo "- Installer languages: $INSTALLER_LANGS"
|
||||
echo "Please verify: build/windows/installer/lang/iso_639_custom.xml"
|
||||
echo "You probably will need to add an 'inno_path' to the faulting lang"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
MESON_LANGS=`grep "'code':" ${GIMP_TESTING_ABS_TOP_SRCDIR}/build/windows/installer/lang/meson.build | \
|
||||
sed "s/^.*'code': *'\([^']*\)'.*$/\1/" |sort`
|
||||
MESON_LANGS=`echo "$MESON_LANGS" | tr '\n\r' ' ' | sed 's/\<en\> //'`
|
||||
|
@ -34,17 +15,3 @@ if [ "$PO_INSTALLER_LANGS" != "$MESON_LANGS" ]; then
|
|||
echo "Please verify: build/windows/installer/lang/meson.build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PO_LANGS=`ls ${GIMP_TESTING_ABS_TOP_SRCDIR}/po/*.po | sed 's%.*/po/\([a-zA-Z@_]*\).po%\1%' | sort`
|
||||
PO_LANGS=`echo "$PO_LANGS" | tr '\n\r' ' '`
|
||||
|
||||
ISO_639_CUSTOM_LANGS=`grep dl_code= ${GIMP_TESTING_ABS_TOP_SRCDIR}/build/windows/installer/lang/iso_639_custom.xml | sed 's/^.*dl_code="\([^"]*\)".*$/\1/' |sort`
|
||||
ISO_639_CUSTOM_LANGS=`echo "$ISO_639_CUSTOM_LANGS" | tr '\n\r' ' '`
|
||||
|
||||
if [ "$ISO_639_CUSTOM_LANGS" != "$PO_LANGS" ]; then
|
||||
echo "Error: languages listed in iso_639_custom.xml do not match the .po files in po/."
|
||||
echo "- PO languages: $PO_LANGS"
|
||||
echo "- iso_639_custom.xml languages: $ISO_639_CUSTOM_LANGS"
|
||||
echo "Please verify: build/windows/installer/lang/iso_639_custom.xml"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue