chore: include extension in scritps filename

This allows to better lint the files.
This commit is contained in:
Michal Čihař 2025-04-01 08:49:00 +02:00
parent 76c994ead7
commit 3c04fcc193
33 changed files with 49 additions and 49 deletions

View file

@ -15,6 +15,6 @@ jobs:
with: with:
python-version: '3.13' python-version: '3.13'
- name: Lint - name: Lint
run: ./scripts/lint run: ./scripts/lint.py
permissions: permissions:
contents: read contents: read

View file

@ -4,59 +4,59 @@


all: weblate_language_data/languages.py weblate_language_data/plural_tags.py PLURALS_DIFF.md $(wildcard weblate_language_data/locale/*/LC_MESSAGES/django.po) $(filter-out $(patsubst modules/cldr-json/cldr-json/cldr-localenames-full/main/%/languages.json,languages-po/%.po,$(wildcard modules/cldr-json/cldr-json/cldr-localenames-full/main/*/languages.json)),languages-po/en.po) all: weblate_language_data/languages.py weblate_language_data/plural_tags.py PLURALS_DIFF.md $(wildcard weblate_language_data/locale/*/LC_MESSAGES/django.po) $(filter-out $(patsubst modules/cldr-json/cldr-json/cldr-localenames-full/main/%/languages.json,languages-po/%.po,$(wildcard modules/cldr-json/cldr-json/cldr-localenames-full/main/*/languages.json)),languages-po/en.po)


weblate_language_data/languages.py: languages.csv aliases.csv cldr.csv extraplurals.csv default_countries.csv population.csv qt.csv rtl.csv case-insensitive.csv $(wildcard modules/iso-codes/data/iso_*.json) scripts/generate-language-data weblate_language_data/languages.py: languages.csv aliases.csv cldr.csv extraplurals.csv default_countries.csv population.csv qt.csv rtl.csv case-insensitive.csv $(wildcard modules/iso-codes/data/iso_*.json) scripts/generate-language-data.py
./scripts/generate-language-data ./scripts/generate-language-data.py


PLURALS_DIFF.md: languages.csv cldr.csv gettext.csv l10n-guide.csv translate.csv scripts/list-diff PLURALS_DIFF.md: languages.csv cldr.csv gettext.csv l10n-guide.csv translate.csv scripts/list-diff.py
./scripts/list-diff ./scripts/list-diff.py
pre-commit run --files PLURALS_DIFF.md || true pre-commit run --files PLURALS_DIFF.md || true


cldr.csv: modules/cldr-json/cldr-json/cldr-core/supplemental/plurals.json modules/cldr-json/cldr-json/cldr-localenames-full/main/en/languages.json scripts/export-cldr cldr.csv: modules/cldr-json/cldr-json/cldr-core/supplemental/plurals.json modules/cldr-json/cldr-json/cldr-localenames-full/main/en/languages.json scripts/export-cldr.py
./scripts/export-cldr ./scripts/export-cldr.py


rtl.csv: modules/cldr-json/cldr-json/cldr-misc-full/main/*/layout.json scripts/export-cldr-orientation languages.csv rtl.csv: modules/cldr-json/cldr-json/cldr-misc-full/main/*/layout.json scripts/export-cldr-orientation.py languages.csv
./scripts/export-cldr-orientation ./scripts/export-cldr-orientation.py


case-insensitive.csv: modules/cldr-json/cldr-json/cldr-core/scriptMetadata.json modules/cldr-json/cldr-json/cldr-core/supplemental/languageData.json scripts/export-cldr-case languages.csv case-insensitive.csv: modules/cldr-json/cldr-json/cldr-core/scriptMetadata.json modules/cldr-json/cldr-json/cldr-core/supplemental/languageData.json scripts/export-cldr-case.py languages.csv
./scripts/export-cldr-case ./scripts/export-cldr-case.py


qt.csv: modules/qttools/src/linguist/shared/numerus.cpp scripts/export-qt languages.csv qt.csv: modules/qttools/src/linguist/shared/numerus.cpp scripts/export-qt.py languages.csv
./scripts/export-qt ./scripts/export-qt.py


gettext.csv: modules/gettext/gettext-tools/src/plural-table.c scripts/export-gettext gettext.csv: modules/gettext/gettext-tools/src/plural-table.c scripts/export-gettext.py
./scripts/export-gettext ./scripts/export-gettext.py


.PRECIOUS: languages-po/%.po .PRECIOUS: languages-po/%.po
languages-po/%.po: modules/cldr-json/cldr-json/cldr-localenames-full/main/en/languages.json modules/cldr-json/cldr-json/cldr-localenames-full/main/%/languages.json scripts/export-languages-po languages-po/%.po: modules/cldr-json/cldr-json/cldr-localenames-full/main/en/languages.json modules/cldr-json/cldr-json/cldr-localenames-full/main/%/languages.json scripts/export-languages-po.py
./scripts/export-languages-po $* ./scripts/export-languages-po.py $*


l10n-guide.csv: modules/l10n-guide/docs/l10n/pluralforms.rst scripts/export-l10n-guide l10n-guide.csv: modules/l10n-guide/docs/l10n/pluralforms.rst scripts/export-l10n-guide.py
./scripts/export-l10n-guide ./scripts/export-l10n-guide.py


LANG_DATA = $(shell python -c 'from pkg_resources import Requirement, resource_filename; print(resource_filename(Requirement.parse("translate-toolkit"), "translate/lang/data.py"))') LANG_DATA = $(shell python -c 'from pkg_resources import Requirement, resource_filename; print(resource_filename(Requirement.parse("translate-toolkit"), "translate/lang/data.py"))')


translate.csv: $(LANG_DATA) scripts/export-translate translate.csv: $(LANG_DATA) scripts/export-translate.py
./scripts/export-translate ./scripts/export-translate.py


weblate_language_data/plural_tags.py: modules/cldr-json/cldr-json/cldr-core/supplemental/plurals.json scripts/export-plural-tags modules/cldr-json/cldr-json/cldr-core/supplemental/aliases.json aliases.csv weblate_language_data/plural_tags.py: modules/cldr-json/cldr-json/cldr-core/supplemental/plurals.json scripts/export-plural-tags.py modules/cldr-json/cldr-json/cldr-core/supplemental/aliases.json aliases.csv
./scripts/export-plural-tags ./scripts/export-plural-tags.py


aliases.csv: scripts/export-iso-aliases modules/iso-codes/data/iso_639-2.json modules/iso-codes/data/iso_639-3.json modules/cldr-json/cldr-json/cldr-core/supplemental/aliases.json aliases.csv: scripts/export-iso-aliases.py modules/iso-codes/data/iso_639-2.json modules/iso-codes/data/iso_639-3.json modules/cldr-json/cldr-json/cldr-core/supplemental/aliases.json
./scripts/export-iso-aliases ./scripts/export-iso-aliases.py
@touch $@ @touch $@


population.csv: modules/cldr-json/cldr-json/cldr-core/supplemental/territoryInfo.json scripts/export-cldr-population population.csv: modules/cldr-json/cldr-json/cldr-core/supplemental/territoryInfo.json scripts/export-cldr-population.py
./scripts/export-cldr-population ./scripts/export-cldr-population.py


languages.csv: modules/iso-codes/data/iso_639-2.json scripts/export-iso-languages scripts/add-iso-population aliases.csv population.csv languages.csv: modules/iso-codes/data/iso_639-2.json scripts/export-iso-languages.py scripts/add-iso-population.py aliases.csv population.csv
./scripts/export-iso-languages ./scripts/export-iso-languages.py
./scripts/add-iso-population ./scripts/add-iso-population.py
@touch $@ @touch $@


weblate_language_data/locale/django.pot: weblate_language_data/languages.py weblate_language_data/plurals.py weblate_language_data/locale/django.pot: weblate_language_data/languages.py weblate_language_data/plurals.py
xgettext --add-comments=Translators: --msgid-bugs-address=https://github.com/WeblateOrg/language-data/issues/ --from-code=utf-8 --language=python --no-location --package-name="Weblate Language Data" --output=$@.1 weblate_language_data/*.py xgettext --add-comments=Translators: --msgid-bugs-address=https://github.com/WeblateOrg/language-data/issues/ --from-code=utf-8 --language=python --no-location --package-name="Weblate Language Data" --output=$@.1 weblate_language_data/*.py
cp $@.1 $@.2 cp $@.1 $@.2
./scripts/copy-pot-date $@ $@.2 ./scripts/copy-pot-date.sh $@ $@.2
if cmp $@ $@.2 ; then touch $@ ; else cp $@.1 $@; fi if cmp $@ $@.2 ; then touch $@ ; else cp $@.1 $@; fi
rm $@.1 $@.2 rm $@.1 $@.2



View file

@ -139,7 +139,7 @@ platforms = [
weblate_language_data = "weblate_language_data" weblate_language_data = "weblate_language_data"


[tool.setuptools.packages.find] [tool.setuptools.packages.find]
exclude = ["modules*"] exclude = ["modules*", "scripts*"]
namespaces = true namespaces = true


[tool.tomlsort] [tool.tomlsort]

View file

@ -37,6 +37,6 @@ for code, population in POPULATION.items():
if code not in LANGUAGE_CODES and code not in ALIASES: if code not in LANGUAGE_CODES and code not in ALIASES:
print(f"Adding {code} ({population})") print(f"Adding {code} ({population})")
subprocess.run( subprocess.run(
["./scripts/add-iso", code], ["./scripts/add-iso.py", code],
check=False, check=False,
) )

View file

@ -38,6 +38,6 @@ with open("modules/iso-codes/data/iso_639-2.json") as handle:
continue continue
if "alpha_2" in item: if "alpha_2" in item:
if item["alpha_2"] not in IGNORE and item["alpha_2"] not in languages: if item["alpha_2"] not in IGNORE and item["alpha_2"] not in languages:
subprocess.run(["./scripts/add-iso", item["alpha_2"]], check=True) subprocess.run(["./scripts/add-iso.py", item["alpha_2"]], check=True)
elif item["alpha_3"] not in IGNORE and item["alpha_3"] not in languages: elif item["alpha_3"] not in IGNORE and item["alpha_3"] not in languages:
subprocess.run(["./scripts/add-iso", item["alpha_3"]], check=True) subprocess.run(["./scripts/add-iso.py", item["alpha_3"]], check=True)

View file

@ -27,7 +27,7 @@ HEADER = '''# Copyright © Michal Čihař <michal@weblate.org>
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/export-macrolanguages.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -19,7 +19,7 @@ HEADER = '''# Copyright © Michal Čihař <michal@weblate.org>
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/export-plural-tags.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -27,7 +27,7 @@ HEADER = '''# Copyright © Michal Čihař <michal@weblate.org>
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/export-plural-tags.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data

View file

@ -5,7 +5,7 @@
""" """
Language data definitions. Language data definitions.


This is an automatically generated file, see scripts/generate-language-data This is an automatically generated file, see scripts/generate-language-data.py


Do not edit, please adjust language definitions in following repository: Do not edit, please adjust language definitions in following repository:
https://github.com/WeblateOrg/language-data https://github.com/WeblateOrg/language-data