PICARD-2652: Update setup.py for Weblate

- update_constants pulls from Weblate
- pull_translations got removed (no longer needed)
- Transifex configutation removed
This commit is contained in:
Philipp Wolfer
2023-08-22 11:17:09 +02:00
parent 8da15803b8
commit c55f295079
2 changed files with 9 additions and 83 deletions

View File

@@ -86,8 +86,6 @@ ext_modules = [
Extension('picard.util._astrcmp', sources=['picard/util/_astrcmp.c']),
]
tx_executable = which('tx')
def newer(source, target):
"""Return true if 'source' exists and is more recently modified than
@@ -493,40 +491,6 @@ class picard_regen_appdata_pot_file(Command):
])
class picard_pull_translations(Command):
description = "Retrieve po files from transifex"
minimum_perc_default = 5
user_options = [
('minimum-perc=', 'm',
"Specify the minimum acceptable percentage of a translation (default: %d)" % minimum_perc_default)
]
def initialize_options(self):
self.minimum_perc = self.minimum_perc_default
def finalize_options(self):
self.minimum_perc = int(self.minimum_perc)
def run(self):
if tx_executable is None:
sys.exit('Transifex client executable (tx) not found.')
self.spawn([
tx_executable,
'pull',
'--force',
'--all',
'--minimum-perc=%d' % self.minimum_perc
])
self.spawn([
tx_executable,
'pull',
'--force',
'--languages',
'en_AU,en_GB,en_CA'
'musicbrainz.picard',
])
_regen_pot_description = "Regenerate po/picard.pot, parsing source tree for new or updated strings"
try:
from babel import __version__ as babel_version
@@ -581,32 +545,29 @@ def _get_option_name(obj):
class picard_update_constants(Command):
description = "Regenerate attributes.py and countries.py"
user_options = [
('skip-pull', None, "skip the tx pull steps"),
('skip-pull', None, "skip the translation pull step"),
('weblate-key=', None, "Weblate API key"),
]
boolean_options = ['skip-pull']
def initialize_options(self):
self.skip_pull = None
self.weblate_key = None
def finalize_options(self):
self.locales = self.distribution.locales
def run(self):
if tx_executable is None:
sys.exit('Transifex client executable (tx) not found.')
from babel.messages import pofile
if not self.skip_pull:
txpull_cmd = [
tx_executable,
'pull',
'--force',
'--source',
'musicbrainz.attributes',
'musicbrainz.countries',
cmd = [
os.path.join(os.path.dirname(__file__), 'scripts', 'tools', 'pull-shared-translations.py'),
]
self.spawn(txpull_cmd)
if self.weblate_key:
cmd.append('--key')
cmd.append(self.weblate_key)
self.spawn(cmd)
countries = dict()
countries_potfile = os.path.join('po', 'countries', 'countries.pot')
@@ -794,7 +755,6 @@ args = {
'install': picard_install,
'install_locales': picard_install_locales,
'update_constants': picard_update_constants,
'pull_translations': picard_pull_translations,
'regen_pot_file': picard_regen_pot_file,
'patch_version': picard_patch_version,
},