classification
Title: DISTUTILS_DEBUG causes stack trace, really simple fix
Type: Stage:
Components: Distutils Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: tarek Nosy List: nedbat, tarek
Priority: normal Keywords:

Created on 2009-09-20 20:27 by nedbat, last changed 2009-09-21 14:01 by tarek. This issue is now closed.

Messages (5)
msg92916 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2009-09-20 20:27
If you set the environment variable DISTUTILS_DEBUG=1, distutils will
run with DEBUG, which will trace internal activity.  But one of the
traces is incorrect, and leads to this stack trace: 

Traceback (most recent call last):
  File "setup.py", line 116, in <module>
    **more_setup_args
  File "c:\python31\lib\distutils\core.py", line 123, in setup
    dist.parse_config_files()
  File "c:\python31\lib\distutils\dist.py", line 357, in parse_config_files
    self.announce("  reading", filename)
  File "c:\python31\lib\distutils\dist.py", line 911, in announce
    log.log(level, msg)
  File "c:\python31\lib\distutils\log.py", line 31, in log
    self._log(level, msg, args)
  File "c:\python31\lib\distutils\log.py", line 20, in _log
    if level >= self.threshold:
TypeError: unorderable types: str() >= int()


The fix is simple: at line 356 of dist.py, change:

            if DEBUG:
                self.announce("  reading", filename)

to:
            if DEBUG:
                self.announce("  reading " + filename)
msg92918 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2009-09-20 21:08
Another one:

Traceback (most recent call last):
  File "setup.py", line 72, in <module>
    **addl_args
  File "c:\python31\lib\distutils\core.py", line 149, in setup
    dist.run_commands()
  File "c:\python31\lib\distutils\dist.py", line 919, in run_commands
    self.run_command(cmd)
  File "c:\python31\lib\distutils\dist.py", line 937, in run_command
    cmd_obj.ensure_finalized()
  File "c:\python31\lib\distutils\cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "c:\python31\lib\distutils\command\install.py", line 315, in
finalize_options
    self.dump_dirs("pre-finalize_{unix,other}")
  File "c:\python31\lib\distutils\command\install.py", line 427, in
dump_dirs
    opt_name = opt_name.translate(longopt_xlate)
TypeError: 'function' object is not subscriptable
msg92919 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-20 22:41
Thanks for noticing this. I'll add some test covering these and fix the
problems.
msg92937 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-21 13:11
Mmm, the problem is deeper for the second stack trace: 

distutils.fancy_getopt.longopt_xlate was changed from a translation
mapping into a lambda in py3, that's why you have it.

I'm fixing back this problem too.
msg92941 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-21 14:01
Everything is covered now, and the mentioned bug is fixed in 
trunk (r74994), py3k (r74999) and release31 (75000).

Thanks !
History
Date User Action Args
2009-09-21 14:01:09tareksetstatus: open -> closed

messages: + msg92941
2009-09-21 13:37:58tareksetversions: + Python 2.7
2009-09-21 13:11:11tareksetmessages: + msg92937
versions: + Python 3.2
2009-09-20 22:41:34tareksetpriority: normal
resolution: accepted
messages: + msg92919
2009-09-20 21:08:43nedbatsetmessages: + msg92918
2009-09-20 20:27:42nedbatcreate