Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12862 closed defect (fixed)

check_catalog command failing

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.3.2
Component: i18n Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Fix distutils.log has no attribute warning.

Description

$ make check-ja
check-ja: python  setup.py  check_catalog -l ja  check_catalog_js -l ja  check_catalog_tracini -l ja
running check_catalog
checking catalog trac/locale/ja/LC_MESSAGES/messages.po
Traceback (most recent call last):
  File "setup.py", line 158, in <module>
    **extra
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/src/tracdev/git/trac/dist.py", line 458, in run
    log.warning('%s:%d: %s', filename, message.lineno,
AttributeError: 'module' object has no attribute 'warning'
make: *** [check-ja] Error 1

Attachments (0)

Change History (4)

comment:1 by Jun Omae, 7 years ago

Owner: set to Jun Omae
Status: newassigned

That line has been changed in [15327].

The log in trac.dist is distutils.log, not logging.Logger. distutils.log has warn method not warning method. I think that naming in Python library is not consistent…

It might be good to rename to distlog from log, to prevent replacing with log.warning like this:

  • trac/dist.py

     
    3636except ImportError:
    3737    genshi = None
    3838
    39 from distutils import log
     39from distutils import log as distlog
    4040from distutils.cmd import Command
    4141from distutils.command.build import build as _build
    4242from distutils.errors import DistutilsOptionError
     
    411411
    412412            for idx, (locale, mo_file) in enumerate(mo_files):
    413413                js_file = js_files[idx]
    414                 log.info('generating messages javascript %r to %r',
    415                          mo_file, js_file)
     414                distlog.info('generating messages javascript %r to %r',
     415                             mo_file, js_file)
    416416
    417417                with open(mo_file, 'rb') as infile:
    418418                    t = Translations(infile, self.domain)
     
    450450
    451451        def run(self):
    452452            for filename in self._get_po_files():
    453                 log.info('checking catalog %s', filename)
     453                distlog.info('checking catalog %s', filename)
    454454                with open(filename) as f:
    455455                    catalog = read_po(f, domain=self.domain)
    456456                for message in catalog:
    457457                    for error in self._check_message(catalog, message):
    458                         log.warning('%s:%d: %s', filename, message.lineno,
    459                                     error)
     458                        distlog.warn('%s:%d: %s', filename, message.lineno,
     459                                     error)
    460460
    461461        def _get_po_files(self):
    462462            if self.input_file:

comment:2 by Ryan J Ollos, 7 years ago

Thanks for finding. The fix looks good to me.

comment:3 by Jun Omae, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [16115].

comment:4 by Ryan J Ollos, 5 years ago

Internal Changes: modified (diff)
Release Notes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.