Am 09.11.2010 03:09, schrieb Jason: > I'd like to be able switch between building my C extension with a > certain preprocessor macro defined or not defined. I'm using the > rudimentary distutils setup.py example given here: > > http://docs.python.org/extending/building.html > > Is there a command line option that distutils.core.setup() will > interpret for me, like the "-D" option for gcc? Or do I need to do > something more complicated? (I had a brief look at the > distutils.command.build_* docs... but they're pretty sparse.)
You were looking at the wrong manual. Read http://docs.python.org/distutils/setupscript.html#preprocessor-options Extension(..., define_macros=[('NDEBUG', '1'), ('HAVE_STRFTIME', None)], undef_macros=['HAVE_FOO', 'HAVE_BAR']) Note that define_macros requires a list of tuples each having two members. Christian -- http://mail.python.org/mailman/listinfo/python-list