[Django] #23788: Stop templatizing js files for gettext >= 0.18.3

16 views
Skip to first unread message

Django

unread,
Nov 10, 2014, 3:00:55 AM11/10/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
------------------------------------------------+------------------------
Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Gettext 0.18.3 (July 2013) added support for parsing JavaScript files with
xgettext. This should allow us to stop using
`jslex.prepare_js_for_gettext` when an appropriate version is available.

http://lists.gnu.org/archive/html/info-gnu/2013-07/msg00001.html

--
Ticket URL: <https://code.djangoproject.com/ticket/23788>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 10, 2014, 3:51:52 AM11/10/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------

Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* stage: Unreviewed => Accepted


Comment:

Good idea. If we take advantage of this feature before it makes it into a
stable release of mainstream Linux distros, we should test for its
availability (probably with a simple version check) and fallback to the
current behavior.

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:1>

Django

unread,
Nov 11, 2014, 3:45:51 AM11/11/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------

Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/3499

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:2>

Django

unread,
Nov 11, 2014, 4:53:02 PM11/11/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------
Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Internationalization | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"5ec367ccdd2ff70270b1f578821c817785d7aecf"]:
{{{
#!CommitTicketReference repository=""
revision="5ec367ccdd2ff70270b1f578821c817785d7aecf"
Fixed #23788 -- Used new JavaScript support in recent gettext

JavaScript string extraction support has been added in gettext
0.18.3.
Thanks Aymeric Augustin for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:3>

Django

unread,
Dec 17, 2014, 10:12:28 AM12/17/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------

Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
* severity: Normal => Release blocker


Comment:

Some tests are failing on Windows after this change.
{{{
======================================================================
ERROR: test_media_static_dirs_ignored
(i18n.test_extraction.JavascriptExtractorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\users\tim\code\django\django\test\utils.py", line 275, in inner
return test_func(*args, **kwargs)
File "c:\Users\Tim\code\django\tests\i18n\test_extraction.py", line 376,
in test_media_static_dirs_ignored
_, po_contents = self._run_makemessages(domain='djangojs')
File "c:\Users\Tim\code\django\tests\i18n\test_extraction.py", line 62,
in _run_makemessages
stdout=out, **options)
File "c:\users\tim\code\django\django\core\management\__init__.py", line
120,
in call_command
return command.execute(*args, **defaults)
File "c:\users\tim\code\django\django\core\management\base.py", line
442, in execute
output = self.handle(*args, **options)
File
"c:\users\tim\code\django\django\core\management\commands\makemessages.py
", line 298, in handle
potfiles = self.build_potfiles()
File
"c:\users\tim\code\django\django\core\management\commands\makemessages.py
", line 327, in build_potfiles
f.process(self, self.domain)
File
"c:\users\tim\code\django\django\core\management\commands\makemessages.py
", line 68, in process
is_templatized = command.gettext_version < (0, 18, 3)
File "c:\users\tim\code\django\django\utils\functional.py", line 60, in
__get_
res = instance.__dict__[self.name] = self.func(instance)
File
"c:\users\tim\code\django\django\core\management\commands\makemessages.py
", line 317, in gettext_version
raise CommandError("Unable to get gettext version. Is it installed?")
CommandError: Unable to get gettext version. Is it installed?
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:4>

Django

unread,
Dec 17, 2014, 12:03:42 PM12/17/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------

Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by claudep):

I'm sorry, but I don't have access to any Windows system, so it will have
to be handled by someone else :-/

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:5>

Django

unread,
Dec 17, 2014, 2:16:42 PM12/17/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------

Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Release blocker | Resolution:
Keywords: windows-test-failure | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* keywords: => windows-test-failure


--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:6>

Django

unread,
Dec 17, 2014, 3:25:52 PM12/17/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------

Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Internationalization | Version: master
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* keywords: windows-test-failure =>


* has_patch: 0 => 1


Comment:

It seems this is not actually specific to Windows, but a problem if
`xgettext --version` doesn't have 3 digits (something like 0.17). Care to
improve the regex at all? Not sure if we should try to mock out
`popen_wrapper` to add a test for it.

{{{
diff --git a/django/core/management/commands/makemessages.py
b/django/core/management/commands/makemessages.py
index ba8de52..932bc08 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -310,9 +310,9 @@ class Command(BaseCommand):
@cached_property
def gettext_version(self):
out, err, status = popen_wrapper(['xgettext', '--version'])
- m = re.search(r'(\d)\.(\d+)\.(\d+)', out)
+ m = re.search(r'(\d)\.(\d+)\.?(\d+)?', out)
if m:
- return tuple(int(d) for d in m.groups())
+ return tuple(int(d) for d in m.groups() if d is not None)
else:


raise CommandError("Unable to get gettext version. Is it
installed?")

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:7>

Django

unread,
Dec 18, 2014, 8:00:00 AM12/18/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------
Reporter: claudep | Owner: claudep
Type: Cleanup/optimization | Status: assigned
Component: Internationalization | Version: master

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* status: new => assigned
* owner: nobody => claudep


--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:8>

Django

unread,
Dec 18, 2014, 8:41:26 AM12/18/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
--------------------------------------+------------------------------------
Reporter: claudep | Owner: claudep
Type: Cleanup/optimization | Status: assigned
Component: Internationalization | Version: master

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by claudep):

https://github.com/django/django/pull/3755

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:9>

Django

unread,
Dec 18, 2014, 9:19:14 AM12/18/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: claudep
Type: | Status: assigned
Cleanup/optimization | Version: master
Component: | Resolution:
Internationalization | Triage Stage: Ready for
Severity: Release blocker | checkin
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:10>

Django

unread,
Dec 18, 2014, 10:06:49 AM12/18/14
to django-...@googlegroups.com
#23788: Stop templatizing js files for gettext >= 0.18.3
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: claudep
Type: | Status: closed
Cleanup/optimization | Version: master
Component: | Resolution: fixed

Internationalization | Triage Stage: Ready for
Severity: Release blocker | checkin
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"9bcd4d812ca698fd3a2de8c52cae8e63c261e628"]:
{{{
#!CommitTicketReference repository=""
revision="9bcd4d812ca698fd3a2de8c52cae8e63c261e628"
Fixed #23788 (2) -- Improved gettext version checker

Thanks Tim Graham for the report and initial patch.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23788#comment:11>

Reply all
Reply to author
Forward
0 new messages