[New-bugs-announce] [issue19346] Build fails when there are no shared extensions to be built

Alan Hourihane report at bugs.python.org
Tue Oct 22 13:47:28 CEST 2013


New submission from Alan Hourihane:

When building python with static extensions and therefore there are no shared extensions to be built the extension list can be NULL, and therefore 0 length.

This results in this error....

running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/setup.py", line 2017, in <module>
    main()
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/setup.py", line 2011, in main
    'Lib/smtpd.py']
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Lib/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Lib/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Lib/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Lib/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Lib/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/setup.py", line 266, in build_extensions
    longest = max([len(e.name) for e in self.extensions])
ValueError: max() arg is an empty sequence

To fix I replaced this line in setup.py

        longest = max([len(e.name) for e in self.extensions])

to this...

        longest = 0
        for e in self.extensions:
            longest = max(longest, len(e.name))

----------
components: Build
messages: 200922
nosy: alanh
priority: normal
severity: normal
status: open
title: Build fails when there are no shared extensions to be built
type: compile error
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19346>
_______________________________________


More information about the New-bugs-announce mailing list