This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Build fails when there are no shared extensions to be built
Type: compile error Stage: resolved
Components: Build Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Python’s setup.py raises a ValueError when self.extensions is empty
View: 16537
Assigned To: Nosy List: alanh, eric.araujo
Priority: normal Keywords:

Created on 2013-10-22 11:47 by alanh, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg200922 - (view) Author: Alan Hourihane (alanh) Date: 2013-10-22 11:47
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))
msg207741 - (view) Author: Alan Hourihane (alanh) Date: 2014-01-09 15:33
Anyone ?
msg213615 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-15 01:54
Thanks for the report and patch.  Can you remind me how to build all extensions statically?  I’d like to reproduce the error before applying the patch.
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63545
2021-09-07 18:02:57iritkatrielsetstatus: open -> closed
superseder: Python’s setup.py raises a ValueError when self.extensions is empty
resolution: remind -> duplicate
stage: patch review -> resolved
2014-03-15 01:54:48eric.araujosetversions: + Python 3.3, Python 3.4
nosy: + eric.araujo

messages: + msg213615

stage: patch review
2014-01-09 15:33:09alanhsetresolution: remind
messages: + msg207741
2013-10-22 11:47:28alanhcreate