Building python extensions

Jrod jrod at blacknode.net
Thu Feb 26 11:05:40 CET 2009


Lets say I compile python 2.6.1 without readline support due to not 
having the readline headers installed prior. Is there a standard way to 
recompile the extension without having to rebuild the entire source. 
Looking at the makefile, I found the gcc line (modified to dump the 
relocatable in the source root ):

$ gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -I. -I/py/site/Python-2.6.1/./Include -I. -IInclude 
-I./Include -I/usr/local/include -I/py/site/Python-2.6.1/Include 
-I/py/site/Python-2.6.1 -c /py/site/Python-2.6.1/Modules/readline.c -o 
build/temp.linux-x86_64-2.6/py/site/Python-2.6.1/Modules/readline.o -o 
readline.so

This works (cp -av readline.so /py/2.6.1/lib/python2.6/lib-dynload/), 
but is less than ideal. Maybe I am missing something in the docs? In php 
there is phpize, is there something like this for python?

'python setup.py build' builds all the extensions in Modules/

This is my first time posting here and I am pretty new to python, so 
pardon me if my my logic is a bit off. I love reading, so feel free to 
link to the relevant documentation :)

Jrod



More information about the Python-list mailing list