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: Python’s setup.py raises a ValueError when self.extensions is empty
Type: compile error Stage: resolved
Components: Build Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: akuchling, berker.peksag, brett.cannon, eric.araujo, ezio.melotti, jhosmer, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2012-11-23 01:14 by jhosmer, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Python-2.6.8-setup.py.patch jhosmer, 2012-11-23 01:15 setup.py patch for 2.6.8
Python-2.7.3-setup.py.patch jhosmer, 2012-11-23 01:16 setup.py patch for 2.7.3
Python-3.0.1-setup.py.patch jhosmer, 2012-11-23 01:16 setup.py patch for 3.0.1
Python-3.1.5-setup.py.patch jhosmer, 2012-11-23 01:16 setup.py patch for 3.1.5
Python-3.2.3-setup.py.patch jhosmer, 2012-11-23 01:17 setup.py patch for 3.2.3
Python-3.3.0-setup.py.patch jhosmer, 2012-11-23 01:17 setup.py patch for 3.3.0
Messages (14)
msg176142 - (view) Author: Jonathan Hosmer (jhosmer) * Date: 2012-11-23 01:14
When disabled_module_list contains all the module names that are not built by Modules/Setup.dist, self.extensions in setup.py will be an empty list and when build_extensions tries to determine the max length of all extension names it raises a ValueError with the following traceback:

Traceback (most recent call last):
  File "./setup.py", line 2143, in <module>
    main()
  File "./setup.py", line 2138, in main
    'Lib/smtpd.py']
  File "/Users/pythonforios/Python_for_iOS/trunk/Python_for_iOS/python2.7/Lib/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Users/pythonforios/Python_for_iOS/trunk/Python_for_iOS/python2.7/Lib/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Users/pythonforios/Python_for_iOS/trunk/Python_for_iOS/python2.7/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/pythonforios/Python_for_iOS/trunk/Python_for_iOS/python2.7/Lib/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/Users/pythonforios/Python_for_iOS/trunk/Python_for_iOS/python2.7/Lib/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Users/pythonforios/Python_for_iOS/trunk/Python_for_iOS/python2.7/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/pythonforios/Python_for_iOS/trunk/Python_for_iOS/python2.7/Lib/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "./setup.py", line 282, in build_extensions
    longest = max([len(e.name) for e in self.extensions])
ValueError: max() arg is an empty sequence
make: *** [sharedmods] Error 1

~~~ An example disabled_module_list from setup.py: ~~~

disabled_module_list = [
# Modules not compatible/not applicable for the iOS
'dl', 'nis', 'gdbm', 'spwd', '_bsddb', '_curses', '_tkinter', 'readline', 'bsddb185', 'ossaudiodev', 'sunaudiodev', '_curses_panel', 'linuxaudiodev',  
# Modules appended to inittab before embedded initialization
'_multiprocessing', 'future_builtins', '_ctypes_test', '_testcapi', '_sqlite3', '_hashlib', '_hotshot', '_scproxy', '_pybsddb', 'imageop', '_ctypes', '_lsprof', '_heapq', '_yaml', '_json', 'math', 'zlib', '_io', 'bz2', 'dbm'
]

~~~ Example Modules/Setup.dist: ~~~

DESTLIB=$(LIBDEST)
MACHDESTLIB=$(BINLIBDEST)
DESTPATH=
SITEPATH=
TESTPATH=
MACHDEPPATH=:plat-$(MACHDEP)
EXTRAMACHDEPPATH=
TKPATH=:lib-tk
OLDPATH=:lib-old
COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH)$(OLDPATH)
PYTHONPATH=$(COREPYTHONPATH)

*static*

posix posixmodule.c
errno errnomodule.c
pwd pwdmodule.c
_sre _sre.c
_codecs _codecsmodule.c
zipimport zipimport.c
_symtable symtablemodule.c
array arraymodule.c
cmath cmathmodule.c _math.c
_struct _struct.c
time timemodule.c -lm
operator operator.c
_weakref _weakref.c
_random _randommodule.c
_collections _collectionsmodule.c
itertools itertoolsmodule.c
strop stropmodule.c
_functools _functoolsmodule.c
_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c
datetime datetimemodule.c
_bisect _bisectmodule.c
unicodedata unicodedata.c
_locale _localemodule.c
fcntl fcntlmodule.c
grp grpmodule.c
select selectmodule.c
mmap mmapmodule.c
_csv _csv.c
_socket socketmodule.c
SSL=/usr/local/OpenSSL_for_iOS
_ssl _ssl.c -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl -L$(SSL)/lib -lssl -lcrypto
crypt cryptmodule.c
termios termios.c
resource resource.c
audioop audioop.c
imageop imageop.c
_md5 md5module.c md5.c
_sha shamodule.c
_sha256 sha256module.c
_sha512 sha512module.c
timing timingmodule.c
syslog syslogmodule.c
binascii binascii.c
parser parsermodule.c
cStringIO cStringIO.c
cPickle cPickle.c
fpectl fpectlmodule.c
fpetest fpetestmodule.c
pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI
_multibytecodec cjkcodecs/multibytecodec.c
_codecs_cn cjkcodecs/_codecs_cn.c
_codecs_hk cjkcodecs/_codecs_hk.c
_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
_codecs_kr cjkcodecs/_codecs_kr.c
_codecs_tw cjkcodecs/_codecs_tw.c
_codecs_jp cjkcodecs/_codecs_jp.c
xxsubtype xxsubtype.c
msg176143 - (view) Author: Jonathan Hosmer (jhosmer) * Date: 2012-11-23 01:16
setup.py patch for 2.7.3
msg176144 - (view) Author: Jonathan Hosmer (jhosmer) * Date: 2012-11-23 01:16
setup.py patch for 3.0.1
msg176145 - (view) Author: Jonathan Hosmer (jhosmer) * Date: 2012-11-23 01:16
setup.py patch for 3.1.5
msg176146 - (view) Author: Jonathan Hosmer (jhosmer) * Date: 2012-11-23 01:17
setup.py patch for 3.2.3
msg176147 - (view) Author: Jonathan Hosmer (jhosmer) * Date: 2012-11-23 01:17
setup.py patch for 3.3.0
msg176148 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-11-23 01:27
Thanks for the patches.
3.1 and 2.6 only receive security fixes, and 3.0 is not maintained anymore, so I removed them from the versions.  Usually it's enough to upload a single patch, especially if the fix is the same on all branches.
The patch should also include tests if possible.
Is also not necessary to add a comment when you add a file.
msg176187 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-11-23 17:13
LGTM.
msg216194 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2014-04-14 20:06
Patch LGTM to me too; someone can probably just commit it.
msg227717 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-27 19:49
New changeset a169ee4f254a by Berker Peksag in branch '3.4':
Issue #16537: Check whether self.extensions is empty in setup.py.
https://hg.python.org/cpython/rev/a169ee4f254a

New changeset 491a4d3e2bdd by Berker Peksag in branch 'default':
Issue #16537: Check whether self.extensions is empty in setup.py.
https://hg.python.org/cpython/rev/491a4d3e2bdd
msg227718 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-27 19:54
New changeset 6946036f21ef by Berker Peksag in branch '2.7':
Issue #16537: Check whether self.extensions is empty in setup.py.
https://hg.python.org/cpython/rev/6946036f21ef
msg227719 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-09-27 19:55
Committed. Thanks for the patch, Jonathan!
msg227752 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-28 08:22
You can use the default parameter of max() in 3.4+.
msg228055 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-01 02:11
New changeset 1ef4e3a125bf by Berker Peksag in branch '3.4':
Issue #16537: Use the new *default* parameter of max().
https://hg.python.org/cpython/rev/1ef4e3a125bf

New changeset 37d896c3604a by Berker Peksag in branch 'default':
Issue #16537: Use the new *default* parameter of max().
https://hg.python.org/cpython/rev/37d896c3604a
History
Date User Action Args
2022-04-11 14:57:38adminsetgithub: 60741
2021-09-07 18:02:57iritkatriellinkissue19346 superseder
2014-10-01 02:11:45python-devsetmessages: + msg228055
2014-09-28 08:22:58serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg227752
2014-09-27 19:55:49berker.peksagsetstatus: open -> closed

assignee: berker.peksag
versions: + Python 3.5, - Python 3.2, Python 3.3
nosy: + berker.peksag

messages: + msg227719
resolution: fixed
stage: commit review -> resolved
2014-09-27 19:54:59python-devsetmessages: + msg227718
2014-09-27 19:49:39python-devsetnosy: + python-dev
messages: + msg227717
2014-04-14 20:06:51akuchlingsetnosy: + akuchling

messages: + msg216194
stage: patch review -> commit review
2013-01-06 16:42:33brett.cannonsetnosy: + brett.cannon
2013-01-05 06:05:21ned.deilylinkissue16867 superseder
2012-11-23 17:13:20eric.araujosetnosy: + eric.araujo

messages: + msg176187
title: setup.py throws a ValueError when self.extensions is empty -> Python’s setup.py raises a ValueError when self.extensions is empty
2012-11-23 01:27:38ezio.melottisetversions: - Python 2.6, Python 3.1
nosy: + ezio.melotti

messages: + msg176148

stage: patch review
2012-11-23 01:17:19jhosmersetfiles: + Python-3.3.0-setup.py.patch

messages: + msg176147
2012-11-23 01:17:07jhosmersetfiles: + Python-3.2.3-setup.py.patch

messages: + msg176146
2012-11-23 01:16:49jhosmersetfiles: + Python-3.1.5-setup.py.patch

messages: + msg176145
2012-11-23 01:16:27jhosmersetfiles: + Python-3.0.1-setup.py.patch

messages: + msg176144
2012-11-23 01:16:08jhosmersetfiles: + Python-2.7.3-setup.py.patch

messages: + msg176143
2012-11-23 01:15:43jhosmersetfiles: + Python-2.6.8-setup.py.patch
keywords: + patch
2012-11-23 01:14:17jhosmercreate