[vtk-developers] Minimum Python requirement

Andrew Maclean andrew.amaclean at gmail.com
Sat Feb 15 01:27:11 EST 2014


You can also add logic to the code as follows:
-------------------------
#!/usr/bin/env python
import sys
print 'Current version:', hex(sys.hexversion)
if sys.hexversion >= 0x2050000: # version 2.5 or greater.
    import imp # Introduced in version 2.5
    print 'Do the work for the version', hex(sys.hexversion), 'here.'
else:
    print "Can't use the module 'imp' because the version is < 2.5."
-------------------------


>From what I can see of newer Pythons the interpreter will not even look at
the else section of the above code.

So I if it is essential for the test to run on older versions of python
then the 2.4 or 2.3 specific code could be in the else section. In my view,
a segfault is not a good run test.

Alternatively, the CMakeLists.txt solution below is the best for code that
will never run on older versions of Python.

Regards
   Andrew



> ---------- Forwarded message ----------
> From: David Gobbi <david.gobbi at gmail.com>
> To: Ben Boeckel <ben.boeckel at kitware.com>
> Cc: VTK Developers <vtk-developers at vtk.org>
> Date: Thu, 13 Feb 2014 11:42:22 -0700
> Subject: Re: [vtk-developers] Minimum Python requirement
> For me, the dashboard should only show green if the test ran _and_
> gave a valid result.
>
> I  know that many of the current tests show green if the machine is
> incapable of producing a valid result (especially the ones that
> require specific GPU functionality), but that's because there isn't an
> easy way to check for the needed functionality until run time.
>
> On Thu, Feb 13, 2014 at 11:22 AM, Ben Boeckel <ben.boeckel at kitware.com>
> wrote:
> > On Thu, Feb 13, 2014 at 10:55:10 -0700, David Gobbi wrote:
> >> Actually, the check should probably be done in the CMakeLists.txt:
> >>
> >> if(${PYTHON_VERSION} VERSION_GREATER "2.6")
> >>   vtk_add_test_python(TestImageJSONWriter.py NO_VALID)
> >> endif()
> >
> > I don't see why. We can certainly *run* the test on older Python
> > versions, we just can't *validate* the test. In the absence of the
> > latter, I'd take segfault discovery of a simple run test :) .
> >
> > --Ben
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtk-developers
> >
>
> --
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20140215/048b2e5f/attachment-0002.html>


More information about the vtk-developers mailing list