Code

Opened 2 years ago

Closed 2 years ago

#17628 closed Cleanup/optimization (fixed)

makemessages command walks through directories that match ignore_patterns

Reported by: andreiko Owned by: nobody
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

./manage.py makemessages always walks through all directories in a tree, even if some directory's path matches an ignore pattern.

So we perform meaningless time-consuming scan through .svn, .git and other possible deep directories that we would like to fully ignore:

$ ./manage.py makemessages -l ru -d django -v 2
examining files with the extensions: .html
processing language ru
ignoring file .DS_Store in .
ignoring file .gitignore in .
...
ignoring file e974710282570831dbefad0e177403d07205ba in ./.git/objects/07
ignoring file da4359b0e24cb164eace2ac312af8fafff2127 in ./.git/objects/08
ignoring file f195d5a9e0cf3542ef36028fa4820d8cdf560a in ./.git/objects/08
ignoring file 26c086ebf3d6fee600fccddaf6bbc6a7f347a1 in ./.git/objects/0a
...

Suggested patch changes behavior of "walk" function defined in makemessages.py to skip directories which path matches some ignore pattern.

Attachments (2)

makemessages-ignore-dirs.diff (1.8 KB) - added by andreiko 2 years ago.
17628-2.diff (8.1 KB) - added by claudep 2 years ago.
Patch with test

Download all attachments as: .zip

Change History (4)

Changed 2 years ago by andreiko

Changed 2 years ago by claudep

Patch with test

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Bug to Cleanup/optimization

To make it work, I had to transform 'dir/*' style expressions to 'dir'.

Accessorily, to capture sdtout during the test, I had to pass around sdtout to several functions. It would be much simpler if those were methods of a class (hey ramiro).

comment:2 Changed 2 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [17441]:

Fixed #17628 -- Extended makemessages command to also ignore directories when walking, not only when looking for files. Thanks, Claude Paroz.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.