[gdal-dev] how to test for version number in python with gdal 1.10 ?

2013-01-16 Thread Etienne Tourigny
Hi,

Detection of gdal version in python using the following method fails
when using gdal-1.10 .

>>> print gdal.VersionInfo("RELEASE_NAME")
1.10dev
>>> print( gdal.VersionInfo("RELEASE_NAME") >= "1.7" )
False
>>> print( gdal.VersionInfo("RELEASE_NAME") >= "1.10" )
True


What is the recommended way to test for previous versions of gdal that
is backwards compatible and that support 1.10?

The following seems to work using VERSION_NUM:

in 1.10dev:
>>> gdal.VersionInfo("VERSION_NUM")
'110'
>>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 1900 )
True
>>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 110 )
True

and in 1.9.2:
>>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 1900 )
True
>>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 110 )
False


thanks,
Etienne
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] how to test for version number in python with gdal 1.10 ?

2013-01-16 Thread Even Rouault

> The following seems to work using VERSION_NUM:
>
> in 1.10dev:
> >>> gdal.VersionInfo("VERSION_NUM")
> '110'
> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 1900 )
> True
> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 110 )
> True
>
> and in 1.9.2:
> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 1900 )
> True
> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 110 )
> False

This is actually what I've used recently in
swig/python/samples/ogr_layer_algebra.py

>
>
> thanks,
> Etienne
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] how to test for version number in python with gdal 1.10 ?

2013-01-16 Thread Etienne Tourigny
ok merci.

It might be good to write this somewhere? Not sure where though,
perhaps the gdal/ogr wiki page?

Etienne

On Wed, Jan 16, 2013 at 1:40 PM, Even Rouault
 wrote:
>
>> The following seems to work using VERSION_NUM:
>>
>> in 1.10dev:
>> >>> gdal.VersionInfo("VERSION_NUM")
>> '110'
>> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 1900 )
>> True
>> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 110 )
>> True
>>
>> and in 1.9.2:
>> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 1900 )
>> True
>> >>> print( int(gdal.VersionInfo("VERSION_NUM")) >= 110 )
>> False
>
> This is actually what I've used recently in
> swig/python/samples/ogr_layer_algebra.py
>
>>
>>
>> thanks,
>> Etienne
>> ___
>> gdal-dev mailing list
>> gdal-dev@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] how to test for version number in python with gdal 1.10 ?

2013-01-16 Thread Mateusz Loskot
On 16 January 2013 16:07, Etienne Tourigny  wrote:
>
> It might be good to write this somewhere? Not sure where though,
> perhaps the gdal/ogr wiki page?

It's documented in the comments of gdal_header.h

http://svn.osgeo.org/gdal/trunk/gdal/gcore/gdal_version.h

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] how to test for version number in python with gdal 1.10 ?

2013-01-16 Thread Etienne Tourigny
On Wed, Jan 16, 2013 at 2:12 PM, Mateusz Loskot  wrote:
> On 16 January 2013 16:07, Etienne Tourigny  wrote:
>>
>> It might be good to write this somewhere? Not sure where though,
>> perhaps the gdal/ogr wiki page?
>
> It's documented in the comments of gdal_header.h
>
> http://svn.osgeo.org/gdal/trunk/gdal/gcore/gdal_version.h

I meant it would be good to document the recommended way to test for
version in *python*

>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev