#36368: `makemessages` command runs `write_po_file()` multiple times for the 
same
potfile
-------------------------------------+-------------------------------------
     Reporter:  Michał Pokusa        |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Management     |                  Version:  5.2
  commands)                          |
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  makemessages         |             Triage Stage:
  write_po_file                      |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Michał Pokusa):

 Thank you for looking into it.

 I prepared a very minimal project that will show the issue:
 https://github.com/michalpokusa/django-test-project/tree/ticket-36368

 Everything is default as from the `startproject` except the optional
 `LOCALE_PATHS` setting and a `debug_makemessages` command, which is copy-
 pasted `makemessages` command with some prints for clarity.

 The bug is present also in `makemessages`, but it is not clearly visible,
 that is why I added this command, but it is not necessary to reproduce.

 Without setting `LOCALE_PATHS` in `settings`:
 {{{
 (.venv) [2025-05-06 00:44:31] michalpokusa@dev:~/projects/django-ticket-
 xyz$ python manage.py debug_makemessages --locale en
 settings.LOCALE_PATHS:  []
 locale_paths inside handle():  ['/home/michalpokusa/projects/django-
 ticket-xyz/locale']
 self.locale_paths at the end of find_files():
 ['/home/michalpokusa/projects/django-ticket-xyz/locale',
 '/home/michalpokusa/projects/django-ticket-xyz/locale']
 potfiles returned from build_potfiles():  ['/home/michalpokusa/projects
 /django-ticket-xyz/locale/django.pot', '/home/michalpokusa/projects
 /django-ticket-xyz/locale/django.pot']
 processing locale en
 calling write_po_file
 calling write_po_file
 }}}

 With `LOCALE_PATHS` set to `[BASE_DIR / "locale"]`:
 {{{
 (.venv) [2025-05-06 00:48:44] michalpokusa@dev:~/projects/django-ticket-
 xyz$ python manage.py debug_makemessages --locale en
 settings.LOCALE_PATHS:  [PosixPath('/home/michalpokusa/projects/django-
 ticket-xyz/locale')]
 locale_paths inside handle():  [PosixPath('/home/michalpokusa/projects
 /django-ticket-xyz/locale'), '/home/michalpokusa/projects/django-ticket-
 xyz/locale']
 self.locale_paths at the end of find_files():
 ['/home/michalpokusa/projects/django-ticket-xyz/locale',
 PosixPath('/home/michalpokusa/projects/django-ticket-xyz/locale'),
 '/home/michalpokusa/projects/django-ticket-xyz/locale']
 potfiles returned from build_potfiles():  ['/home/michalpokusa/projects
 /django-ticket-xyz/locale/django.pot', '/home/michalpokusa/projects
 /django-ticket-xyz/locale/django.pot', '/home/michalpokusa/projects
 /django-ticket-xyz/locale/django.pot']
 processing locale en
 calling write_po_file
 calling write_po_file
 calling write_po_file
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36368#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070196a2a8e89d-2f87e610-27ae-4686-b599-b5695497cc0a-000000%40eu-central-1.amazonses.com.

Reply via email to