Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#12862 closed defect (fixed)

check_catalog command failing — at Version 3

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

Fix distutils.log has no attribute warning.

API Changes:
Internal Changes:

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

Change History (3)

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

Note: See TracTickets for help on using tickets.