[damned-lies] Updated special-casing of damned-lies pot generation
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Updated special-casing of damned-lies pot generation
- Date: Mon, 27 Feb 2017 18:45:44 +0000 (UTC)
commit cbaf938910afa24a63f524bf1f651933381c6a77
Author: Claude Paroz <claude 2xlibre net>
Date: Mon Feb 27 19:28:59 2017 +0100
Updated special-casing of damned-lies pot generation
Fixes bug #779325.
stats/management/commands/update-trans.py | 2 +-
stats/models.py | 20 ++++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/stats/management/commands/update-trans.py b/stats/management/commands/update-trans.py
index a72cca2..9dab871 100644
--- a/stats/management/commands/update-trans.py
+++ b/stats/management/commands/update-trans.py
@@ -48,7 +48,7 @@ class Command(BaseCommand):
CategoryName.objects.values_list('name', flat=True)):
if value:
value = re.sub(r'\r\n|\r|\n', '\n', value)
- fh.write("_(u\"\"\"%s\"\"\")\n" % value.encode('utf-8'))
+ fh.write("_(u\"\"\"%s\"\"\")\n" % value)
# Run makemessages -l ll
call_command('makemessages', locale=[lang_code])
diff --git a/stats/models.py b/stats/models.py
index 60e7ca3..d569a77 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -13,6 +13,7 @@ from urllib.error import URLError
from django.conf import settings
from django.core.exceptions import ValidationError
+from django.core.management import call_command
from django.core.urlresolvers import reverse
from django.core.validators import RegexValidator
from django.utils.encoding import force_text
@@ -799,8 +800,17 @@ class Domain(models.Model):
pot_command = self.pot_method
env = None
podir = vcs_path
- if not self.pot_method: # default is intltool
+
+ if self.module.name == 'damned-lies':
+ # Special case for d-l, pot file should be generated from running instance dir
+ pot_command = ''
+ call_command('update-trans', 'en')
+ status, output, errs = 0, '', ''
+ vcs_path = './po'
+
+ elif not self.pot_method: # default is intltool
pot_command = ['intltool-update', '-g', self.potbase(), '-p']
+
elif self.pot_method == GETTEXT_METHOD:
pot_command = ['xgettext',
'--files-from', 'POTFILES.in',
@@ -823,6 +833,7 @@ class Domain(models.Model):
pot_command.extend(kwds_vars.split())
# Added last as some chars in it may disturb CLI parsing
pot_command.extend(['--msgid-bugs-address', self.module.get_bugs_enter_url()])
+
elif self.pot_method.startswith(('http://', 'https://')):
# Get POT from URL and save file locally
req = request.Request(self.pot_method)
@@ -834,15 +845,12 @@ class Domain(models.Model):
with open(potfile, 'wb') as f:
f.write(handle.read())
pot_command = ':' # noop
- elif self.module.name == 'damned-lies':
- # special case for d-l, pot file should be generated from running instance dir
- podir = "."
- vcs_path = "./po"
if 'intltool-update' in pot_command:
env = {"XGETTEXT_ARGS": "\"--msgid-bugs-address=%s\"" % self.module.get_bugs_enter_url()}
- (status, output, errs) = utils.run_shell_command(pot_command, env=env, cwd=podir)
+ if pot_command:
+ status, output, errs = utils.run_shell_command(pot_command, env=env, cwd=podir)
potfile = os.path.join(vcs_path, self.potbase() + ".pot")
if not os.access(potfile, os.R_OK):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]