On 2010-07-15 16:45-0400 Hazen Babcock wrote:

> Alan W. Irwin wrote:
>> 
>> Finding the python version should be straightforward. The last stanza
>> of cmake/modules/plplot.cmake provides a template for running python
>> to generate useful information about python.
>> 
>> Modify that template to run, e.g.,
>> 
>> python -c "import sys; print sys.version.split()[0]"
>> 
>> to obtain the version.  I suggest the result should be stored unmodified
>> (see below) in the PYTHON_VERSION variable.
>> 
>> Note, however, that the version generated this way may have some
>> trailing non-numeric data you will need to filter out with the cmake
>> string command before you can make numerical comparisons between say
>> 2.6.0 (when the necessary buffer functionality is first available to
>> python) and ${PYTHON_VERSION}.  For my (Debian squeeze) system I
>> obtain, for example, "2.6.5+" from the above command.
>
> Ok, I think I figured out how to do this and to check the Python and Swig 
> versions to make sure that they are ok, but I can't figure out how to set an 
> environment variable for the build process. In: 
> bindings/swig-support/plplotcapi.i I have:
>
> #ifdef PYTHON_HAVE_PYBUFFER
>
> %include <pybuffer.i>
> %pybuffer_mutable_string(void * plotmem)
>
> %feature("autodoc", "Set the memory area to be plotted (with the 'mem' 
> driver).") plsmem;
> void
> plsmem(PLINT maxx, PLINT maxy, void *plotmem);
>
> #endif
>
> Now I need cmake to set PYTHON_HAVE_PYBUFFER appropriately. I tried:
> SET(ENV{PYTHON_HAVE_PYBUFFER} ON), but that does not seem to work.

Set that PYTHON_HAVE_PYBUFFER macro like the usual SWIG_PYTHON macro
is set in bindings/python/CMakeLists.txt with the appropriate
CMAKE_SWIG_FLAGS list element. Of course, in that CMake logic you will
ultimately want to avoid setting the PYTHON_HAVE_PYBUFFER macro when
the python version is too old to support this, but that is a nuance
you can deal with later if you don't have the python version logic set
up yet.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to