error: in 'ext_modules'

Laurent Gautier avatarLaurent Gautier created an issue

The lastest release of distribute (0.7.3) is breaking setup.py files previously working. Trying to install a package ends with:

error: in 'ext_modules' option (extension 'foo.bar'), 'sources' must be present and must be a list of source filenames

Minimal example attached.

Comments (4)

  1. Jason R. Coombs

    For easy reference, the example is:

    from setuptools import setup
    from distutils.extension import Extension
    
    ext_modules = [Extension(name = 'foo.bar',
                             sources = ['bar.c'])]
    
    
    setup(name = 'foo',
          ext_modules = ext_modules)
    
  2. Jason R. Coombs

    Thanks for the report, unfornately, as reported, I'm unable to replicate the issue, even when upgrading an environment from distribute:

    vagrant@precise64:~$ mkdir issue387
    vagrant@precise64:~$ cd issue387/
    vagrant@precise64:~/issue387$ cat > setup.py
    from setuptools import setup
    from distutils.extension import Extension
    
    ext_modules = [Extension(name = 'foo.bar',
                             sources = ['bar.c'])]
    
    
    setup(name = 'foo',
          ext_modules = ext_modules)
    vagrant@precise64:~/issue387$ virtualenv env
    New python executable in env/bin/python2.7
    Also creating executable in env/bin/python
    Installing distribute...........................................................................................................................................................................................................................done.
    Installing pip................done.
    vagrant@precise64:~/issue387$ env/bin/easy_install -U distribute
    Searching for distribute
    Reading http://pypi.python.org/simple/distribute/
    Best match: distribute 0.7.3
    Downloading https://pypi.python.org/packages/source/d/distribute/distribute-0.7.3.zip#md5=c6c59594a7b180af57af8a0cc0cf5b4a
    Processing distribute-0.7.3.zip
    Writing /tmp/easy_install-gBVmYU/distribute-0.7.3/setup.cfg
    Running distribute-0.7.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-gBVmYU/distribute-0.7.3/egg-dist-tmp-78yX4I
    warning: install_lib: 'build/lib.linux-x86_64-2.7' does not exist -- no Python modules to install
    
    Removing distribute 0.6.34 from easy-install.pth file
    Adding distribute 0.7.3 to easy-install.pth file
    
    Installed /home/vagrant/issue387/env/lib/python2.7/site-packages/distribute-0.7.3-py2.7.egg
    Processing dependencies for distribute
    Searching for setuptools>=0.7
    Reading http://pypi.python.org/simple/setuptools/
    Reading http://peak.telecommunity.com/snapshots/
    Reading https://pypi.python.org/pypi/setuptools
    Best match: setuptools 0.8
    Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-0.8.tar.gz#md5=ab5f2bbc67f0dbdfeb3075f14d0b029c
    Processing setuptools-0.8.tar.gz
    Writing /tmp/easy_install-yKMbiP/setuptools-0.8/setup.cfg
    Running setuptools-0.8/setup.py -q bdist_egg --dist-dir /tmp/easy_install-yKMbiP/setuptools-0.8/egg-dist-tmp-F5pefe
    Adding setuptools 0.8 to easy-install.pth file
    Installing easy_install script to /home/vagrant/issue387/env/bin
    Installing easy_install-2.7 script to /home/vagrant/issue387/env/bin
    
    Installed /home/vagrant/issue387/env/lib/python2.7/site-packages/setuptools-0.8-py2.7.egg
    Finished processing dependencies for distribute
    vagrant@precise64:~/issue387$ touch bar.c
    vagrant@precise64:~/issue387$ env/bin/python setup.py build
    running build
    running build_ext
    building 'foo.bar' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c bar.c -o build/temp.linux-x86_64-2.7/bar.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/bar.o -o build/lib.linux-x86_64-2.7/foo/bar.so
    

    Please look into your environment to ascertain what might be different that you're encountering the error and provide more detail here (or open a new ticket with setuptools). Please provide detail about what operating system, what version or versions of Distribute/Setuptools are at play, and how you're invoking the setup.py to trigger the error.

  3. Laurent Gautier
    • I am using Linux (so you seem to do)
    • I am using Python 3.3 (and virtualenv, created from scratch to test the problem).
    • In the said virtualenv, I installed Distribute with python setup.py install after tar -xzf ... on the distribution tarball on Pypi

    • uninstalling Distribute and installing setuptools solved the problem.

  4. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.