Opened 17 years ago

Closed 16 years ago

Last modified 13 years ago

#5522 closed (fixed)

Move commands daily_cleanup, make-messages and compile-messages to django.core.management.commands

Reported by: Jannis Leidel Owned by: Jannis Leidel
Component: Core (Other) Version: dev
Severity: Keywords: i18n session
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Since having a fairly solid, pluggable django-admin command I prepared a patch which moves the heavy lifting to django.core.management and is fully backwards compatible with the standalone tools daily_cleanup.py, make-messages.py, compile-messages.py and unique-messages.py in django/bin.

This introduces four new commands:

messagesmake, messagescompile, messagesunique, cleanup

where the latter is the new name for daily_cleanup.py. Docs included.

Attachments (7)

django-admin.diff (37.2 KB ) - added by Jannis Leidel 17 years ago.
patch to move utilities in django/bin to django.core.management
django-admin.2.diff (36.5 KB ) - added by Jannis Leidel 17 years ago.
second patch to move utilities in django/bin to django.core.management
django-admin.3.diff (36.1 KB ) - added by Jannis Leidel 17 years ago.
normal patch with SVN on fresh checkout (r7140)
django-admin.4.diff (36.8 KB ) - added by Jannis Leidel 17 years ago.
makemessages and compileessages should now work in the svn root either by running django-admin.py * or bin/*.py without asking for DJANGO_SETTINGS_MODULE
django-admin.5.diff (38.7 KB ) - added by Jannis Leidel 17 years ago.
As with Jacob discussed this patch moves the i18n helper functions to their appropriate subcommands and also includes [7473].
django-admin.6.diff (39.8 KB ) - added by Jannis Leidel 16 years ago.
Added New in Django development version flags and notes about the old tools make-messages.py and compile-messages.py.
django-admin.7.diff (39.9 KB ) - added by Jannis Leidel 16 years ago.
Raising CommandError instead of hard sys.exit in django.core.management.commands.makemessages:make_messages()

Download all attachments as: .zip

Change History (33)

by Jannis Leidel, 17 years ago

Attachment: django-admin.diff added

patch to move utilities in django/bin to django.core.management

comment:1 by Jannis Leidel, 17 years ago

Keywords: sprintsept14 added

comment:2 by James Bennett, 17 years ago

Triage Stage: UnreviewedDesign decision needed

comment:3 by Malcolm Tredinnick, 17 years ago

Possibly worth it for make-messages and compile-messages (the reason in favour of it is that we need to rename those two programs anyway so that they can be installed in /usr/bin/ and using django-admin.py as the controller means we can handle settings more easily). Not needed for daily_cleanup, since that's very lightweight and this makes it less so. unique-messages.py isn't meant to be called directly, so that shouldn't be exposed.

comment:4 by Jannis Leidel, 17 years ago

Ok, fair enough.. I'd like to point out, that the creation of command line programs can be automated during installation with setuptools' "console_scripts" entry_point. I described a simple example at http://jannisleidel.com/2007/11/using-django-with-setuptools/ if you are interested. Though I know that there is more about setuptools which should be discussed :)

I'd like to provide a patch during the sprint (later today) which adds app-loading from eggs using pkg_resources. I would be glad if this would be added, since my GSoC approach (#5465) isn't very satisfying.

comment:5 by Malcolm Tredinnick, 17 years ago

At no point here have you explained why all this moving is needed. Setuptool has nothing to do with it; it's a completely orthogonal issue and not relevant here.

comment:6 by Jannis Leidel, 17 years ago

Indeed, setuptools is not an issue here. Moving the code might be a good way to go on with the refactoring of command.core.management. I thought this could be another step towards a future "django" command line programm.

comment:7 by Jannis Leidel, 17 years ago

Keywords: sprintdec01 added; sprintsept14 removed

comment:8 by Jacob, 17 years ago

Triage Stage: Design decision neededAccepted

Let's do this, but only for make-messages, compile-messages, and daily_cleanup (but I'd rename that to "django-admin cleanup"). unique-messages is an internal tool, and shouldn't be exposed in django-admin.

Make sure to document the new commands!

comment:9 by Jannis Leidel, 17 years ago

Yeah, I'll work on it later today.

by Jannis Leidel, 17 years ago

Attachment: django-admin.2.diff added

second patch to move utilities in django/bin to django.core.management

comment:10 by Jannis Leidel, 17 years ago

Ok, new patch (from mercurial clone) without unique-messages and docs (docs, manpage, bash_completion).

in reply to:  10 comment:11 by Jannis Leidel, 17 years ago

Replying to jezdez:

Ok, new patch (from mercurial clone) without unique-messages and docs (docs, manpage, bash_completion).

I mean *with* documentation

comment:12 by Chris Beaven, 17 years ago

Can someone do a normal patch on a fresh Django SVN and confirm each command works as expected?

comment:13 by Jannis Leidel, 17 years ago

Already working on it :)

by Jannis Leidel, 17 years ago

Attachment: django-admin.3.diff added

normal patch with SVN on fresh checkout (r7140)

comment:14 by Chris Beaven, 17 years ago

Triage Stage: AcceptedReady for checkin

comment:15 by Jannis Leidel, 17 years ago

Summary: Move daily_cleanup, make-messages, compile-messages and unique-messages to django.core.management.commandsMove commands daily_cleanup, make-messages and compile-messages to django.core.management.commands

comment:16 by Malcolm Tredinnick, 17 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

This doesn't seem to work. I applied the patch and tried to run bin/make-messages.py -l en and it complains about missing settings file. Similarly for django/bin/make-messages.py -l en and various places running django-admin.py messagesmake -l en.

Since there is no concept of a settings file for the subversion tree, this isn't really a replacement for existing functionality.

Also, can you rename messagesmake to makemessages and messagescompile to compilemessages for consistency with the existing names, please.

by Jannis Leidel, 17 years ago

Attachment: django-admin.4.diff added

makemessages and compileessages should now work in the svn root either by running django-admin.py * or bin/*.py without asking for DJANGO_SETTINGS_MODULE

by Jannis Leidel, 17 years ago

Attachment: django-admin.5.diff added

As with Jacob discussed this patch moves the i18n helper functions to their appropriate subcommands and also includes [7473].

by Jannis Leidel, 16 years ago

Attachment: django-admin.6.diff added

Added New in Django development version flags and notes about the old tools make-messages.py and compile-messages.py.

comment:17 by Ramiro Morales, 16 years ago

Shouldn't (for consistency with the rest of the management infrastructure) all the sys.exit() calls from the django/core/management/commands/makemessages.py:make_messages() function be replaced by raising the [source:django/trunk/django/core/management/base.py CommandError exception]?

If so, this means that the backwards-compatibility make-messages script would also need to be be modified accordingly.

by Jannis Leidel, 16 years ago

Attachment: django-admin.7.diff added

Raising CommandError instead of hard sys.exit in django.core.management.commands.makemessages:make_messages()

comment:18 by Jannis Leidel, 16 years ago

Triage Stage: AcceptedReady for checkin

comment:19 by Jannis Leidel, 16 years ago

milestone: 1.0 alpha

FYI, I changed it to "Ready for checkin" after the definite word by Jacob in IRC

comment:20 by Jannis Leidel, 16 years ago

Status: newassigned

comment:21 by Marc Garcia, 16 years ago

Keywords: sprintdec01 removed
milestone: 1.0 alphapost-1.0

According to ticket organization defined in http://code.djangoproject.com/wiki/VersionOneRoadmap#how-you-can-help 1.0 alpha tickets should be just features in the Must have (http://code.djangoproject.com/wiki/VersionOneRoadmap#must-have-features) list.

Change to 1.0 beta if you can make this feature be added to May be features (http://code.djangoproject.com/wiki/VersionOneRoadmap#maybe-features).

comment:22 by Jannis Leidel, 16 years ago

milestone: post-1.01.0 beta

I appreciate your care but this was already discussed in IRC with Jacob and others to be included in Django 1.0.

comment:23 by Malcolm Tredinnick, 16 years ago

Good work. I've decided to actually remove the dual functionality from make-messages.py and compile-messages.py. Otherwise we'll be carrying around two ways to do the same thing forever. Instead both those executables now print an error message pointing the caller to the right command to run. I've updated the docs patch accordingly.

comment:24 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: assignedclosed

(In [7844]) Fixed #5522 -- Moved make-messages, compile-messages and daily-cleanup into django-admin.py.

They are now called "makemessages", "compilemessages" and "cleanup". This is
backwards incompatible for make-messages.py and compile-messages.py, although
the old executables still exist for now and print an error pointing the caller
to the right command to call.

This reduces the number of binaries and man pages Django needs to install.

Patch from Janis Leidel.

comment:25 by Malcolm Tredinnick, 16 years ago

Community Announcement: if anybody notices errors in this change, please do not reopen this ticket. This ticket is about making the move, which has been done. Errors in the resulting code should have their own tickets so that we can track things easily.

comment:26 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

Note: See TracTickets for help on using tickets.
Back to Top