1. Tarek Ziadé
  2. distribute
Issue #79 resolved

Distribute doesn't copy compiled C extension to destination

Stefan H. Holek
created an issue

In some situations, distribute fails to copy a compiled C extension from the build dir to its desired destination. Here's how:

So i have this package with a C extension. During development I edit the .c file and rerun the tests. This recompiles the extension, but does not copy it out of the build dir.

With setuptools 0.6c11: {{{ localhost:~/sandbox/rl$ ./bin/python setup.py test /usr/local/python2.6/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'use_2to3' warnings.warn(msg) running test running egg_info writing requirements to rl.egg-info/requires.txt writing rl.egg-info/PKG-INFO writing top-level names to rl.egg-info/top_level.txt writing dependency_links to rl.egg-info/dependency_links.txt reading manifest file 'rl.egg-info/SOURCES.txt' writing manifest file 'rl.egg-info/SOURCES.txt' running build_ext building 'rl._readline' extension gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include -I/usr/local/python2.6/include/python2.6 -c rl/_readline.c -o build/temp.macosx-10.4-i386-2.6/rl/_readline.o In file included from /opt/local/include/readline/readline.h:36, from rl/_readline.c:31: /opt/local/include/readline/rltypedefs.h:34: warning: function declaration isn’t a prototype /opt/local/include/readline/rltypedefs.h:35: warning: function declaration isn’t a prototype /opt/local/include/readline/rltypedefs.h:36: warning: function declaration isn’t a prototype /opt/local/include/readline/rltypedefs.h:37: warning: function declaration isn’t a prototype In file included from rl/_readline.c:31: /opt/local/include/readline/readline.h:378: warning: function declaration isn’t a prototype gcc -L/opt/local/lib -bundle -undefined dynamic_lookup build/temp.macosx-10.4-i386-2.6/rl/_readline.o -L/opt/local/lib -lreadline -lncursesw -o build/lib.macosx-10.4-i386-2.6/rl/_readline.so copying build/lib.macosx-10.4-i386-2.6/rl/_readline.so -> rl test_bad_hook (rl.tests.test_callhooks.CharIsQuotedFunctionTests) ... ok ... }}}

With distribute 0.6.6: {{{ localhost:~/sandbox/rl$ ./bin/python setup.py test running test running build_py running egg_info writing requirements to rl.egg-info/requires.txt writing rl.egg-info/PKG-INFO writing top-level names to rl.egg-info/top_level.txt writing dependency_links to rl.egg-info/dependency_links.txt reading manifest file 'rl.egg-info/SOURCES.txt' writing manifest file 'rl.egg-info/SOURCES.txt' copying rl/_readline.c -> build/lib.macosx-10.4-i386-2.6/rl running egg_info writing requirements to /Users/stefan/sandbox/rl/build/lib.macosx-10.4-i386-2.6/rl.egg-info/requires.txt writing /Users/stefan/sandbox/rl/build/lib.macosx-10.4-i386-2.6/rl.egg-info/PKG-INFO writing top-level names to /Users/stefan/sandbox/rl/build/lib.macosx-10.4-i386-2.6/rl.egg-info/top_level.txt writing dependency_links to /Users/stefan/sandbox/rl/build/lib.macosx-10.4-i386-2.6/rl.egg-info/dependency_links.txt reading manifest file '/Users/stefan/sandbox/rl/build/lib.macosx-10.4-i386-2.6/rl.egg-info/SOURCES.txt' writing manifest file '/Users/stefan/sandbox/rl/build/lib.macosx-10.4-i386-2.6/rl.egg-info/SOURCES.txt' running build_ext building 'rl._readline' extension gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include -I/usr/local/python2.6/include/python2.6 -c rl/_readline.c -o build/temp.macosx-10.4-i386-2.6/rl/_readline.o In file included from /opt/local/include/readline/readline.h:36, from rl/_readline.c:31: /opt/local/include/readline/rltypedefs.h:34: warning: function declaration isn’t a prototype /opt/local/include/readline/rltypedefs.h:35: warning: function declaration isn’t a prototype /opt/local/include/readline/rltypedefs.h:36: warning: function declaration isn’t a prototype /opt/local/include/readline/rltypedefs.h:37: warning: function declaration isn’t a prototype In file included from rl/_readline.c:31: /opt/local/include/readline/readline.h:378: warning: function declaration isn’t a prototype gcc -L/opt/local/lib -bundle -undefined dynamic_lookup build/temp.macosx-10.4-i386-2.6/rl/_readline.o -L/opt/local/lib -lreadline -lncursesw -o build/lib.macosx-10.4-i386-2.6/rl/_readline.so test_bad_hook (rl.tests.test_callhooks.CharIsQuotedFunctionTests) ... ok ... }}}

With distribute the "copying" line is missing: {{{ copying build/lib.macosx-10.4-i386-2.6/rl/_readline.so -> rl }}}

The package is here BTW: http://pypi.python.org/pypi/rl

Comments (8)

  1. Tarek Ziadé repo owner

    I found the problem: the use_2to3 option seems to be incompatible with build_ext inplace option.

    Usually, the "test" command forces build_ext inplace option to 1 so the .so file is copied, but when 2to3 is used, this is not done anymore.

    I need to investigate on this and see what's the proper fix to do for this edge case.

  2. Stefan H. Holek reporter

    I'd like to rephrase this issue. The current behavior is at least consistent: .pyc files are not copied "back" to the package dir either, since tests are run inside the build dir anyway.

    My real problem is that development eggs (the .egg-links) don't work since the links point to the package dir and not into the build dir.

  3. Log in to comment