Bug report #2446

Python.cmake is wrong about python-sip version

Added by antimirov - over 14 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:Borys Jurgiel
Category:Python plugins
Affected QGIS version: Regression?:No
Operating System:Debian Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:12506

Description

Today I got this error after having upgraded my python-sip package to newer version:

"SIP is required in version 4.7 or later!"

But actually it's deeply wrong as my current version is 4.10. So I checked cmake/Python.cmake file in which I found that Cmake runs this command to compare current version of sip and to check whether it's bigger than 4.7:

$ python

import sip

print '%x' % sip.SIP_VERSION

So for older older version is:
sip.SIP_VERSION=263945
hex=0x40709

For newer it's funny:
sip.SIP_VERSION=264704
hex=40a00

So the newer version is lexicographically lower than the previous one. Looks like a bug.

History

#1 Updated by antimirov - over 14 years ago

I'm sorry. Lexicographically 'a' is higher than "7", but the issue with Cmake's way of detecting python-sip version is still valid.

#2 Updated by Borys Jurgiel over 14 years ago

Did you try to remove the build/python directory before recompiling? I have SIP 4.10 and no such error occurs (Ubuntu). However, I can't find the version test you mention anywhere...

#3 Updated by Martin Dobias over 14 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

What QGIS version is that? This is not a problem anymore in SVN trunk (will be released as 1.5).

I think the development releases (v1.1 - v1.4) are affected, but there are no plans for further bugfix releases. So you might fix the problem manually in cmake/Python.cmake file:

Lines (153-155)

IF (SIP_VERSION EQUAL "${SIP_MIN_VERSION}" OR SIP_VERSION GREATER "${SIP_MIN_VERSION}")
  SET (SIP_IS_GOOD TRUE)
ENDIF (SIP_VERSION EQUAL "${SIP_MIN_VERSION}" OR SIP_VERSION GREATER "${SIP_MIN_VERSION}")

change to just
  SET (SIP_IS_GOOD TRUE)

#4 Updated by antimirov - over 14 years ago

I fixed it with:

TRY_RUN_PYTHON (RES "print 40709" SIP_VERSION)

40709 is taken from older Ubuntu's python-sip.

2borysiasty:
I have QGIS from ubuntugis-unstable PPA, I use it for latest GEOS and Qgis 1.4.

Thanks for the hint about 1.5, I see that SIP detection code was heavily rewritten there.

Also available in: Atom PDF