[damned-lies] Allow for module-specific its data dirs
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Allow for module-specific its data dirs
- Date: Wed, 7 Sep 2016 16:49:54 +0000 (UTC)
commit 1a093203c68e648a26f0769b516eb748f634a117
Author: Claude Paroz <claude 2xlibre net>
Date: Wed Sep 7 18:49:28 2016 +0200
Allow for module-specific its data dirs
stats/admin.py | 4 ++--
stats/migrations/0008_domain_extra_its_dirs.py | 19 +++++++++++++++++++
stats/models.py | 7 +++++++
3 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/stats/admin.py b/stats/admin.py
index 048c25d..ff14ea5 100644
--- a/stats/admin.py
+++ b/stats/admin.py
@@ -40,7 +40,7 @@ class DomainInline(admin.StackedInline):
'fields': (('name', 'description', 'dtype', 'directory'),)
}),
('Advanced', {
- 'fields': ('pot_method', 'linguas_location', 'red_filter',
+ 'fields': ('pot_method', 'extra_its_dirs', 'linguas_location', 'red_filter',
('branch_from', 'branch_to'),),
'classes': ('collapse',),
}),
@@ -56,7 +56,7 @@ class DomainInline(admin.StackedInline):
kwargs['widget'] = forms.Textarea(attrs={'rows':'1', 'cols':'20'})
elif db_field.name in ('name', 'directory'):
kwargs['widget'] = forms.TextInput(attrs={'size':'20'})
- elif db_field.name == 'red_filter':
+ elif db_field.name in ('red_filter', 'extra_its_dirs'):
kwargs['widget'] = forms.Textarea(attrs={'rows':'1', 'cols':'40'})
return super(DomainInline, self).formfield_for_dbfield(db_field, **kwargs)
diff --git a/stats/migrations/0008_domain_extra_its_dirs.py b/stats/migrations/0008_domain_extra_its_dirs.py
new file mode 100644
index 0000000..635ce1b
--- /dev/null
+++ b/stats/migrations/0008_domain_extra_its_dirs.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('stats', '0007_extend_bugs_base'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='domain',
+ name='extra_its_dirs',
+ field=models.TextField(help_text='colon-separated directories containing extra .its/.loc files
for gettext', blank=True),
+ ),
+ ]
diff --git a/stats/models.py b/stats/models.py
index 14ce287..1ecd2ab 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -750,6 +750,8 @@ class Domain(models.Model):
pot_method = models.CharField(max_length=100, null=True, blank=True,
help_text="Leave blank for standard method (intltool for UI and gnome-doc-utils for DOC), "
"or '<gettext>' for the pure xgettext-based extraction")
+ extra_its_dirs = models.TextField(blank=True,
+ help_text="colon-separated directories containing extra .its/.loc files for gettext")
linguas_location = models.CharField(max_length=50, null=True, blank=True,
help_text="""Use 'no' for no LINGUAS check, or path/to/file#variable for a non-standard location.
Leave blank for standard location (ALL_LINGUAS in LINGUAS/configure.ac/.in for UI and
DOC_LINGUAS in Makefile.am for DOC)""")
@@ -832,6 +834,11 @@ class Domain(models.Model):
if not os.path.exists(utils.ITS_DATA_DIR):
utils.collect_its_data()
env = {'GETTEXTDATADIRS': os.path.dirname(utils.ITS_DATA_DIR)}
+ if self.extra_its_dirs:
+ env['GETTEXTDATADIRS'] = ':'.join(
+ [env['GETTEXTDATADIRS']] + [os.path.join(current_branch.co_path(), path)
+ for path in self.extra_its_dirs.split(':')]
+ )
# Parse and use content from: "XGETTEXT_OPTIONS = --keyword=_ --keyword=N_"
kwds_vars = utils.read_makefile_variable([vcs_path], 'XGETTEXT_OPTIONS',
makefile_name='Makevars')
if kwds_vars:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]