Django

Code

Ticket #5522 (closed: fixed)

Opened 1 year ago

Last modified 2 months ago

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

Reported by: jezdez Assigned to: jezdez
Milestone: 1.0 beta Component: Core framework
Version: SVN Keywords: i18n session
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

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

django-admin.diff (37.2 kB) - added by jezdez on 09/17/07 07:22:21.
patch to move utilities in django/bin to django.core.management
django-admin.2.diff (36.5 kB) - added by jezdez on 02/05/08 15:20:17.
second patch to move utilities in django/bin to django.core.management
django-admin.3.diff (36.1 kB) - added by jezdez on 02/21/08 16:55:02.
normal patch with SVN on fresh checkout (r7140)
django-admin.4.diff (36.8 kB) - added by jezdez on 03/17/08 19:19:27.
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 jezdez on 06/09/08 07:39:19.
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 jezdez on 06/18/08 16:53:53.
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 jezdez on 06/19/08 11:55:09.
Raising CommandError? instead of hard sys.exit in django.core.management.commands.makemessages:make_messages()

Change History

09/17/07 07:22:21 changed by jezdez

  • attachment django-admin.diff added.

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

09/19/07 07:52:05 changed by jezdez

  • keywords changed from i18n, session to i18n, session, sprintsept14.
  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

09/23/07 03:57:05 changed by ubernostrum

  • stage changed from Unreviewed to Design decision needed.

11/30/07 08:48:44 changed by mtredinnick

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.

11/30/07 09:46:23 changed by jezdez

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.

11/30/07 14:27:47 changed by mtredinnick

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.

11/30/07 14:38:46 changed by jezdez

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.

12/01/07 10:53:21 changed by jezdez

  • keywords changed from i18n, session, sprintsept14 to i18n, session, sprintdec01.

12/01/07 14:35:22 changed by jacob

  • stage changed from Design decision needed to Accepted.

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!

12/01/07 18:42:33 changed by jezdez

Yeah, I'll work on it later today.

02/05/08 15:20:17 changed by jezdez

  • attachment django-admin.2.diff added.

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

(follow-up: ↓ 11 ) 02/05/08 15:24:35 changed by jezdez

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

(in reply to: ↑ 10 ) 02/05/08 15:25:28 changed by jezdez

Replying to jezdez:

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

I mean *with* documentation

02/21/08 15:57:29 changed by SmileyChris

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

02/21/08 15:59:55 changed by jezdez

Already working on it :)

02/21/08 16:55:02 changed by jezdez

  • attachment django-admin.3.diff added.

normal patch with SVN on fresh checkout (r7140)

02/21/08 17:14:55 changed by SmileyChris

  • stage changed from Accepted to Ready for checkin.

02/24/08 10:20:00 changed by jezdez

  • summary changed from Move daily_cleanup, make-messages, compile-messages and unique-messages to django.core.management.commands to Move commands daily_cleanup, make-messages and compile-messages to django.core.management.commands.

03/17/08 09:33:27 changed by mtredinnick

  • needs_better_patch set to 1.
  • stage changed from Ready for checkin to Accepted.

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.

03/17/08 19:19:27 changed by jezdez

  • 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

06/09/08 07:39:19 changed by jezdez

  • 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].

06/18/08 16:53:53 changed by jezdez

  • 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.

06/18/08 19:52:08 changed by ramiro

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 CommandError exception?

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

06/19/08 11:55:09 changed by jezdez

  • attachment django-admin.7.diff added.

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

06/21/08 07:27:36 changed by jezdez

  • stage changed from Accepted to Ready for checkin.

06/25/08 12:35:21 changed by jezdez

  • milestone set to 1.0 alpha.

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

06/26/08 12:43:10 changed by jezdez

  • status changed from new to assigned.

06/27/08 09:52:46 changed by garcia_marc

  • keywords changed from i18n, session, sprintdec01 to i18n session.
  • milestone changed from 1.0 alpha to post-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).

06/27/08 10:24:47 changed by jezdez

  • milestone changed from post-1.0 to 1.0 beta.

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

07/06/08 01:19:53 changed by mtredinnick

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.

07/06/08 01:39:44 changed by mtredinnick

  • status changed from assigned to closed.
  • resolution set to fixed.

(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.

07/06/08 01:41:23 changed by mtredinnick

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.


Add/Change #5522 (Move commands daily_cleanup, make-messages and compile-messages to django.core.management.commands)




Change Properties
Action