Re: [Django] #13476: Enable colors on Windows if pyreadline is installed.

21 views
Skip to first unread message

Django

unread,
Nov 15, 2013, 7:26:49 AM11/15/13
to django-...@googlegroups.com
#13476: Enable colors on Windows if pyreadline is installed.
-------------------------------------+-------------------------------------
Reporter: buriy | Owner: buriy
Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: windows console | Needs documentation: 1
colors | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by ramiro):

IMHO we should try hard no not keep adding code to Django that deals with
platforms limitations/particularities.

Contributor buriy has done a good work enumerating the options in
comment:3. Other options available are:

6. Use the colorama lib (https://pypi.python.org/pypi/colorama)
7. Rely on the user having installed the ANSICON external app
(http://adoxa.hostmyway.net/ansicon/). The code modification is
essentially a one-liner:

{{{
diff --git a/django/core/management/color.py
b/django/core/management/color.py
index c322614..4276c7d 100644
--- a/django/core/management/color.py
+++ b/django/core/management/color.py
@@ -14,10 +14,10 @@ def supports_color():
otherwise.
"""
plat = sys.platform
- unsupported_platform = plat == 'Pocket PC' or plat == 'win32' and
'ANSICON' not in os.environ
+ supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
'ANSICON' in os.environ)
# isatty is not always implemented, #6223.
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
- if unsupported_platform or not is_a_tty:
+ if not supported_platform or not is_a_tty:
return False
return True

}}}

Googling shows there are other open source projects that have chosen this
path (Cucumber, RSpec).

6, just like the options that involve dependency on pyreadline, imply
adding a soft third party Python module dependency and/or code to deal
with the issue.

I'm ready to either simply close this ticket or to commit the above patch.

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

Django

unread,
Nov 15, 2013, 7:40:52 AM11/15/13
to django-...@googlegroups.com
#13476: Enable colors on Windows if pyreadline is installed.
-------------------------------------+-------------------------------------
Reporter: buriy | Owner: buriy
Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: windows console | Needs documentation: 1
colors | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by ramiro):

Replying to [comment:13 ramiro]:
> IMHO we should try hard to not keep adding code to Django that deals
with platforms limitations/particularities.

I meant: Try hard to not keep adding code to Django that deals with
platforms limitations/particularities for non essential functionality like
e.g. the dev server and its reloading mechanism and trhis one: management
commands color output.

--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:14>

Django

unread,
Nov 15, 2013, 8:19:18 AM11/15/13
to django-...@googlegroups.com
#13476: Enable colors on Windows if pyreadline is installed.
-------------------------------------+-------------------------------------
Reporter: buriy | Owner: buriy
Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: windows console | Needs documentation: 1
colors | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by claudep):

+1 for you proposal (7), with docs of course.

--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:15>

Django

unread,
Dec 2, 2013, 9:18:54 PM12/2/13
to django-...@googlegroups.com
#13476: Enable colors on Windows if pyreadline is installed.
-------------------------------------+-------------------------------------
Reporter: buriy | Owner: buriy
Type: New feature | Status: closed

Component: Core (Management | Version: master
commands) | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: windows console | Needs documentation: 1
colors | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Ramiro Morales <cramm0@…>):

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


Comment:

In [changeset:"12615dab78cb6fc7d8c74b7b65a4136b0feeb33f"]:
{{{
#!CommitTicketReference repository=""
revision="12615dab78cb6fc7d8c74b7b65a4136b0feeb33f"
Fixed #13476 -- Added support for color in console output under Windows.

Detect and use the services of the ANSICON third-party tool if it's
available.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:16>

Django

unread,
Nov 11, 2020, 6:06:04 AM11/11/20
to django-...@googlegroups.com
#13476: Enable colors on Windows if pyreadline is installed.
-------------------------------------+-------------------------------------
Reporter: Yuri Baburov | Owner: Yuri
| Baburov

Type: New feature | Status: closed
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: fixed
Keywords: windows console | Triage Stage: Ready for
colors | checkin
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:17>

Reply all
Reply to author
Forward
0 new messages