Platform-specific compile flags in setup.py?

Nikita the Spider NikitaTheSpider at gmail.com
Sun Mar 4 21:48:57 EST 2007


Hi all,
I'm a newbie when it comes to distributing C-based Python modules. I'm 
just now sharing my first with the rest of the world (it's actually V. 
Marangozov's shared memory module for IPC) and I've learned that the 
module needs a different set of compile flags for Linux than for my Mac. 
My question is this: is there a convention or standard that says where 
platform-specific compile flags should reside? I could put them in 
setup.py, OTOH I know that within the .C file I can add something like 
this:
#ifdef __FreeBSD__
#include <machine/param.h>  /* for system definition of PAGE_SIZE */
#endif

That works, but for maximum Python programmer-friendliness I should 
perhaps put the complexity in setup.py rather than in a .C file.

Opinions appreciated.

PS - The module in question is here; Linux users must remove the tuple 
"('HAVE_UNION_SEMUN', None)" from setup.py:
http://NikitaTheSpider.com/python/shm/

-- 
Philip
http://NikitaTheSpider.com/
Whole-site HTML validation, link checking and more



More information about the Python-list mailing list