Defining build options based on available compiler version
Thomas Spura
tomspur at fedoraproject.org
Sat Jul 30 21:05:40 UTC 2011
On Sat, 30 Jul 2011 21:39:24 +0100
Niels de Vos wrote:
> Watch out, this is very dangerous! You are comparing strings, not
> versions:
> >>> print '4.6.2' >= '4.6.12'
> True
Thanks... I was testing with to low numbers... :(
> The better way would be to use distutils.version:
> >>> from distutils.version import StrictVersion
> >>> print StrictVersion('4.6.2') >= StrictVersion('4.6.12')
> False
>
> It is possible to write this one one line, but that looks reall ugly:
>
> %global true_or_false %(python -c "from distutils.version import
> StrictVersion as v; print v(%{gccver}) >= v('4.6.0')")
Some '' are missing around gccver.
Thanks,
Thomas
More information about the devel
mailing list