Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python’s setup.py raises a ValueError when self.extensions is empty #60741

Closed
jhosmer mannequin opened this issue Nov 23, 2012 · 14 comments
Closed

Python’s setup.py raises a ValueError when self.extensions is empty #60741

jhosmer mannequin opened this issue Nov 23, 2012 · 14 comments
Assignees
Labels
build The build process and cross-build

Comments

@jhosmer
Copy link
Mannequin

jhosmer mannequin commented Nov 23, 2012

BPO 16537
Nosy @akuchling, @brettcannon, @ezio-melotti, @merwok, @berkerpeksag, @serhiy-storchaka
Files
  • Python-2.6.8-setup.py.patch: setup.py patch for 2.6.8
  • Python-2.7.3-setup.py.patch: setup.py patch for 2.7.3
  • Python-3.0.1-setup.py.patch: setup.py patch for 3.0.1
  • Python-3.1.5-setup.py.patch: setup.py patch for 3.1.5
  • Python-3.2.3-setup.py.patch: setup.py patch for 3.2.3
  • Python-3.3.0-setup.py.patch: setup.py patch for 3.3.0
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/berkerpeksag'
    closed_at = <Date 2014-09-27.19:55:49.953>
    created_at = <Date 2012-11-23.01:14:17.055>
    labels = ['build']
    title = 'Python\xe2\x80\x99s setup.py raises a ValueError when self.extensions is empty'
    updated_at = <Date 2014-10-01.02:11:45.785>
    user = 'https://bugs.python.org/jhosmer'

    bugs.python.org fields:

    activity = <Date 2014-10-01.02:11:45.785>
    actor = 'python-dev'
    assignee = 'berker.peksag'
    closed = True
    closed_date = <Date 2014-09-27.19:55:49.953>
    closer = 'berker.peksag'
    components = ['Build']
    creation = <Date 2012-11-23.01:14:17.055>
    creator = 'jhosmer'
    dependencies = []
    files = ['28076', '28077', '28078', '28079', '28080', '28081']
    hgrepos = []
    issue_num = 16537
    keywords = ['patch']
    message_count = 14.0
    messages = ['176142', '176143', '176144', '176145', '176146', '176147', '176148', '176187', '216194', '227717', '227718', '227719', '227752', '228055']
    nosy_count = 8.0
    nosy_names = ['akuchling', 'brett.cannon', 'ezio.melotti', 'eric.araujo', 'python-dev', 'berker.peksag', 'serhiy.storchaka', 'jhosmer']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue16537'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @jhosmer
    Copy link
    Mannequin Author

    jhosmer mannequin commented Nov 23, 2012

    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
    
    ```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](https://github.com/python/cpython/blob/main/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
    

    @jhosmer jhosmer mannequin added build The build process and cross-build labels Nov 23, 2012
    @jhosmer
    Copy link
    Mannequin Author

    jhosmer mannequin commented Nov 23, 2012

    setup.py patch for 2.7.3

    @jhosmer
    Copy link
    Mannequin Author

    jhosmer mannequin commented Nov 23, 2012

    setup.py patch for 3.0.1

    @jhosmer
    Copy link
    Mannequin Author

    jhosmer mannequin commented Nov 23, 2012

    setup.py patch for 3.1.5

    @jhosmer
    Copy link
    Mannequin Author

    jhosmer mannequin commented Nov 23, 2012

    setup.py patch for 3.2.3

    @jhosmer
    Copy link
    Mannequin Author

    jhosmer mannequin commented Nov 23, 2012

    setup.py patch for 3.3.0

    @ezio-melotti
    Copy link
    Member

    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.

    @merwok
    Copy link
    Member

    merwok commented Nov 23, 2012

    LGTM.

    @merwok merwok changed the title setup.py throws a ValueError when self.extensions is empty Python’s setup.py raises a ValueError when self.extensions is empty Nov 23, 2012
    @akuchling
    Copy link
    Member

    Patch LGTM to me too; someone can probably just commit it.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 27, 2014

    New changeset a169ee4f254a by Berker Peksag in branch '3.4':
    Issue bpo-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 bpo-16537: Check whether self.extensions is empty in setup.py.
    https://hg.python.org/cpython/rev/491a4d3e2bdd

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 27, 2014

    New changeset 6946036f21ef by Berker Peksag in branch '2.7':
    Issue bpo-16537: Check whether self.extensions is empty in setup.py.
    https://hg.python.org/cpython/rev/6946036f21ef

    @berkerpeksag
    Copy link
    Member

    Committed. Thanks for the patch, Jonathan!

    @berkerpeksag berkerpeksag self-assigned this Sep 27, 2014
    @serhiy-storchaka
    Copy link
    Member

    You can use the default parameter of max() in 3.4+.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 1, 2014

    New changeset 1ef4e3a125bf by Berker Peksag in branch '3.4':
    Issue bpo-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 bpo-16537: Use the new *default* parameter of max().
    https://hg.python.org/cpython/rev/37d896c3604a

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants