Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 525700 - sci-geosciences/qgis-1.8.0 with dev-python/PyQt4-4.11.2-r1 - sip: Unable to find file "QtCore/QtCoremod.sip"
Summary: sci-geosciences/qgis-1.8.0 with dev-python/PyQt4-4.11.2-r1 - sip: Unable to f...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sci-geo Project
URL: http://hub.qgis.org/issues/11465
Whiteboard:
Keywords: PATCH, UPSTREAM
: 528732 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-17 22:19 UTC by Martin von Gagern
Modified: 2014-11-10 15:22 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (sci-geosciences:qgis-1.8.0:20141017-191331.log,977.37 KB, text/plain)
2014-10-17 22:19 UTC, Martin von Gagern
Details
Patch FindPyQt.py (qgis-2.4.0-FindPyQt.patch,2.03 KB, patch)
2014-10-20 23:05 UTC, Martin von Gagern
Details | Diff
Patch FindPyQt.py (v2) (qgis-2.4.0-FindPyQt.patch,2.01 KB, patch)
2014-10-21 06:12 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2014-10-17 22:19:43 UTC
Created attachment 386838 [details]
build log

qgis 1.8.0 fails to re-emerge, reporting this error:

sip: Unable to find file "QtCore/QtCoremod.sip"

A file called /usr/share/sip/PyQt4/QtCore/QtCoremod.sip does exist. dev-python/PyQt4-4.11.2-r1 is installed, dev-python/PyQt5 is not.

Perhaps PYQT4_SIP_FLAGS has to be set to somehow include this path?

If I compare my last successful build of qgis against this failing one, I see the following difference in the build log:

  cd …work/qgis-1.8.0_build/python &&
  /usr/bin/sip -e -x QSETINT_CONVERSION -x QSETTYPE_CONVERSION
- -x VendorID -t WS_X11 -x PyQt_NoPrintRangeBug -t Qt_4_8_4 -x Py_v3 -g
  -o -a …work/qgis-1.8.0_build/python/qgis.analysis.api -j 4
  -c …work/qgis-1.8.0_build/python/analysis
- -I /usr/share/sip
  -I …work/qgis-1.8.0/python …work/qgis-1.8.0/python/analysis/analysis.sip

(line breaks added by me). So you can see that there were some more options which are not present any more. That last successful build was likely against PyQt4-4.11.1, according to what genlop tells me.
Comment 1 Rafał Mużyło 2014-10-18 13:43:37 UTC
Well, as '--sipdir="${EPREFIX}/usr/share/sip"' was one of the parameters that was removed in PyQt4-4.11.2-r1 ebuild,...
Comment 2 Rafał Mużyło 2014-10-18 13:48:53 UTC
Though check also this little snippet:
> Traceback (most recent call last):
>   File "/var/tmp/portage/sci-geosciences/qgis-1.8.0/work/qgis-1.8.0/cmake/FindPyQt.py", line 5, in <module>
>     import PyQt4.pyqtconfig
> ImportError: No module named pyqtconfig
Comment 3 Davide Pesavento (RETIRED) gentoo-dev 2014-10-18 13:55:35 UTC
Not a PyQt4 bug.
Comment 4 Davide Pesavento (RETIRED) gentoo-dev 2014-10-18 13:59:19 UTC
(In reply to Rafał Mużyło from comment #1)
> Well, as '--sipdir="${EPREFIX}/usr/share/sip"' was one of the parameters
> that was removed in PyQt4-4.11.2-r1 ebuild,...

With PyQt4-4.11.2-r1 we stopped passing that parameter and switched to the upstream default path, mainly in order to avoid collisions with PyQt5. I don't know why previous versions/revisions of PyQt4 passed a different path... historical reasons I guess.
Comment 5 Davide Pesavento (RETIRED) gentoo-dev 2014-10-18 14:07:28 UTC
(In reply to Rafał Mużyło from comment #2)
> Though check also this little snippet:
> > Traceback (most recent call last):
> >   File "/var/tmp/portage/sci-geosciences/qgis-1.8.0/work/qgis-1.8.0/cmake/FindPyQt.py", line 5, in <module>
> >     import PyQt4.pyqtconfig
> > ImportError: No module named pyqtconfig

IIRC pyqtconfig is sort of deprecated, its presence shouldn't be relied upon, and apparently the new PyQt4 build system even stopped installing it. There are other ways to detect PyQt4 installation.

Anyway, qgis-1.8 is very old, latest version is 2.4 so maybe it should be bumped first, these issues might have been solved upstream already.
Comment 6 Martin von Gagern 2014-10-20 22:11:01 UTC
(In reply to Davide Pesavento from comment #5)
> Anyway, qgis-1.8 is very old, latest version is 2.4 so maybe it should be
> bumped first, these issues might have been solved upstream already.

I won't mind bug 515832 getting resolved first. But my attempt to build 2.4.0 failed with the same error, so I fear that this issue here won't magically disappear.

Qgis upstream has two bug reports mentioning QtCoremod.sip:
http://hub.qgis.org/issues/8857 and http://hub.qgis.org/issues/11138
Both resolved fixed, the latter by adding a package, the former by adding cmake options “-D PYQT4_SIP_DIR=/path/to/pyqt4” and “-D SIP_TAGS=Qt_4_7_4”.
Comment 7 Martin von Gagern 2014-10-20 23:05:33 UTC
Created attachment 387094 [details, diff]
Patch FindPyQt.py

(In reply to Rafał Mużyło from comment #2)
> Though check also this little snippet:
> > Traceback (most recent call last):
> >   File "…/work/qgis-1.8.0/cmake/FindPyQt.py", line 5, in <module>
> >     import PyQt4.pyqtconfig
> > ImportError: No module named pyqtconfig

Thanks for pointing this out. I hadn't noticed that message, and I believe that this might be a good point to tackle the issue, particularly if we want our changes to be suitable for upstream as well.

Quoting /usr/share/doc/PyQt4-4.11.2-r1/html/build_system.html on this module:

> SIP v5 will not include an extensible build system, i.e it will not provide
> an equivalent of SIP v4’s sipconfig module. Consequently a version of PyQt
> built with SIP v5 will not provide an equivalent of the pyqtconfig module.
> However there is still a need for certain information to be shared between
> PyQt and other modules (such as QScintilla’s Qsci module) that are built on
> top of it. Specifically it is important that the same -t and -x command line
> flags are passed to the sip executable to create, for example, the QScintilla
> bindings as were passed to create the PyQt bindings.

> Starting with v4.10, PyQt4.QtCore.PYQT_CONFIGURATION is a dict that describes
> how PyQt was configured. At the moment it contains a single value called
> sip_flags which is a string containing the appropriate -t and -x flags.

> Note that the pyqtconfig module is only created if you use configure.py
> and not if you use configure-ng.py.

OK, so this module is deprecated, not built on Gentoo (since we use configure-ng.py) and therefore not compatible with FindPyQt.py. We'll need to work around this somehow. Since SIP v5 apparently hasn't been released yet, we may use some of its functionality in order to provide some backward compatibility here.

The attached patch allows me to successfully compile qgis 2.4.0, but it should work for 1.8.0 as well I think. The code is far from elegant, but it apparently gets the job done well enough.
Comment 8 Davide Pesavento (RETIRED) gentoo-dev 2014-10-20 23:44:23 UTC
(In reply to Martin von Gagern from comment #7)
> The attached patch allows me to successfully compile qgis 2.4.0, but it
> should work for 1.8.0 as well I think. The code is far from elegant, but it
> apparently gets the job done well enough.

The patch looks good to me, except that "import sys" seems to be unneeded.
Comment 9 Martin von Gagern 2014-10-21 06:12:54 UTC
Created attachment 387106 [details, diff]
Patch FindPyQt.py (v2)

(In reply to Davide Pesavento from comment #8)
> The patch looks good to me, except that "import sys" seems to be unneeded.

You are right. At some point while writing that patch, I had planned to duplicate functionality from configure-ng.py, namely the HostPythonConfiguration in there which uses variables from sys for some settings. But after I found essentially the same things in the sipconfig object, I abandoned my use of sys.
Comment 10 Davide Pesavento (RETIRED) gentoo-dev 2014-10-22 00:17:20 UTC
Yep, I think you can easily replicate the logic of HostPythonConfiguration using sys.prefix and friends, this way you can get rid of "import sipconfig" and be compatible with SIPv5. That's more or less what pykde4 does (except it uses cmake).

Anyway, the patch is good enough as is, can you submit it upstream please?
Comment 11 Martin von Gagern 2014-10-22 17:53:11 UTC
(In reply to Davide Pesavento from comment #10)
> Yep, I think you can easily replicate the logic of HostPythonConfiguration
> using sys.prefix and friends, this way you can get rid of "import sipconfig"
> and be compatible with SIPv5. That's more or less what pykde4 does (except
> it uses cmake).

QGIS uses cmake as well, so if we have working cmake code for that, we might skip the python script completely. Haven't looked at pykde4 sources yet, though.

> Anyway, the patch is good enough as is, can you submit it upstream please?

Thanks. Did so at http://hub.qgis.org/issues/11465
Comment 12 Davide Pesavento (RETIRED) gentoo-dev 2014-10-22 22:49:24 UTC
@sci-geo: if upstream doesn't reply in a timely manner (1-2 weeks) I'm gonna go ahead and apply Martin's patch to qgis-1.8.0 in tree.
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2014-11-09 22:13:33 UTC
*** Bug 528732 has been marked as a duplicate of this bug. ***
Comment 14 Martin von Gagern 2014-11-10 07:54:00 UTC
(In reply to Davide Pesavento from comment #12)
> @sci-geo: if upstream doesn't reply in a timely manner (1-2 weeks) I'm gonna
> go ahead and apply Martin's patch to qgis-1.8.0 in tree.

I'd say that's the case now: upstream bug reported 2014-10-22 and still no reaction at all. Please go ahead fixing this on the distro level for now.

By the way: qgis is currently at 2.6, and bug 485868 is used to track this. But that should not prevent us from fixing builds for older versions in tree, for the sake of stable users.
Comment 15 Davide Pesavento (RETIRED) gentoo-dev 2014-11-10 15:22:52 UTC
Patch applied to both versions in tree. Thanks a lot Martin!