Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2446 closed bug (fixed)

Python.cmake is wrong about python-sip version

Reported by: antimirov Owned by: borysiasty
Priority: major: does not work as expected Milestone: Version 1.5.0
Component: Python plugins and bindings Version: Trunk
Keywords: python sip cmake Cc:
Must Fix for Release: No Platform: Debian
Platform Version: Awaiting user input: no

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.

Change History (4)

comment:1 by antimirov, 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.

comment:2 by borysiasty, 14 years ago

Priority: critical: causes crash or data corruptionmajor: does not work as expected

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...

comment:3 by wonder, 14 years ago

Resolution: fixed
Status: newclosed

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)

comment:4 by antimirov, 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.

Note: See TracTickets for help on using tickets.