Feature request #2985

qgis broken with new py-sip

Added by jasperla - about 10 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Build/Install
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:13045

Description

After updating py-sip to the latest 4.11 release, qgis 1.5.0 doesn't build anymore. It bails out with the following error:

cd /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python && /usr/local/bin/sip -x [[VendorID]] -t WS_X11 -x [[PyQt]]_NoPrintRangeBug -t Qt_4_6_3 -x Py_v3 -g -j 4 -c /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python/core -I /usr/local/share/sip -I /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python/core/core.sip
sip: /usr/obj/ports/qgis-1.5.0/qgis-1.5.0/python/core/conversions.sip:269: Mapped type has already been defined in another module
*** Error code 1

I can attach the full build log if needed.

History

#1 Updated by sthen - about 10 years ago

The following diff fixes things with sip>=4.11; I showed it to Phil
Banks who thinks it's ok as a workaround and suggests it is made
conditional depending on the version of SIP that is found.

--- python/core/conversions.sip.orig    Tue Sep  7 00:14:55 2010
+++ python/core/conversions.sip    Tue Sep  7 00:17:23 2010
@@ -265,59 +265,6 @@ template <TYPE>

-%MappedType QSet<int>
-{
-%TypeHeaderCode
-#include <QSet>
-#if (SIP_VERSION >= 0x040900)
-#define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString))
-#define sipClass_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant))
-#endif
-%End
-
-%ConvertFromTypeCode
-  // Create the list.
-  [[PyObject]] *l;
-
-  if ((l = [[PyList]]_New(sipCpp->size())) == NULL)
-    return NULL;
-      
-  // Set the list elements.
-  QSet<int>::iterator it = sipCpp->begin();
-  for (int i = 0; it != sipCpp->end(); ++it, ++i)
-  {
-    [[PyObject]] *tobj;
-
-    if ((tobj = [[PyInt]]_FromLong(*it)) == NULL)
-    {
-      Py_DECREF(l);
-      return NULL;
-    }
-    [[PyList]]_SET_ITEM(l, i, tobj);
-  }
-
-  return l;
-%End
-
-%ConvertToTypeCode
-  // Check the type if that is all that is required.
-  if (sipIsErr == NULL)
-    return [[PyList]]_Check(sipPy);
-
-  QSet<int> *qset = new QSet<int>;
-
-  for (int i = 0; i < [[PyList]]_GET_SIZE(sipPy); ++i)
-  {
-    qset->insert(PyInt_AsLong(PyList_GET_ITEM(sipPy, i)));
-  }
-
-  *sipCppPtr = qset;
-  return sipGetState(sipTransferObj);
-%End
-
-};
-
-
 template <TYPE>
 %MappedType QSet<TYPE>
 {

#2 Updated by Volker Fröhlich about 10 years ago

Doesn't work for me with QGIS 1.5, SIP 4.11 and Qt 4.7:

[ 95%] Generating ui_qgsplugininstallerbase.py
cd /builddir/build/BUILD/qgis-1.5.0/python/plugins/plugin_installer && /usr/bin/pyuic4 /builddir/build/BUILD/qgi
s-1.5.0/python/plugins/plugin_installer/qgsplugininstallerbase.ui -o /builddir/build/BUILD/qgis-1.5.0/python/plu
gins/plugin_installer/ui_qgsplugininstallerbase.py
An unexpected error occurred.
Check that you are using the latest version of PyQt and send an error report to
, including the following information:
  • your version of PyQt (4.7.6)
  • the UI file that caused this error
  • the debug output of pyuic4 (use the -d flag when calling pyuic4)
    maker2: Leaving directory /builddir/build/BUILD/qgis-1.5.0'
    maker1: Leaving directory
    /builddir/build/BUILD/qgis-1.5.0'
    maker2: * [python/plugins/plugin_installer/ui_qgsplugininstallerbase.py] Error 1
    maker1:
    [python/plugins/plugin_installer/CMakeFiles/pluginstaller.dir/all] Error 2
    make: *
    * [all] Error 2

#3 Updated by sthen - about 10 years ago

Ah sorry I forgot to mention that one; it is a regression with pyuic 4.7.6 on python 2.x - please use a development snapshot of py-qt4 instead or remove "encoding='utf8'" from pyuic/uic/driver.py around line 60.

#4 Updated by John Tull about 10 years ago

Using PyQt-4.7.7, released today, along with sip-4.11, I still get the originally posted error. The above patch worked for me. Should this be applied to trunk?

#5 Updated by Jürgen Fischer about 10 years ago

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

#6 Updated by Attila Oláh - almost 10 years ago

  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

I'm reopening this because changeset 14325 introduced a Developer Warning that has still not been fixed. Please change "trunk/qgis/python/CMakeLists.txt" line 44 to match the opening IF statement arguments (on line 42).

#7 Updated by Jürgen Fischer almost 10 years ago

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

#8 Updated by Attila Oláh - almost 10 years ago

Ouch. Now how the hell did I miss that.

In that case, sorry for making noise here; and thanks very much for your work, jef. I've merged the diffs from 3cf96c28 (SVN r14324), 926fc951 (SVN r14325), 82edec5a (SVN r14326) and 8ffd8165 (SVN r14331) into a patch to backport this fix to version 1.5.0 in Gentoo, it works pretty well.

Also available in: Atom PDF