Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Nov 2018 16:44:23 +0100
From:      Rainer Hurling <rhurlin@gwdg.de>
To:        <freebsd-ports@freebsd.org>
Subject:   SIP configuration seems incomplete for Python3
Message-ID:  <4be4a0ac-45f0-751f-4315-cd6257c5f635@gwdg.de>

next in thread | raw e-mail | index | archive | help
In the preparation of a new port for QGIS 3 (graphics/qgis) I need a
functioning sip installation under Python 3.x, to be able to build and
use QGIS Python plugins. Unfortunately, the QGIS scripts have problems
to find the right sip version and fail. After spending some time, I
think it is more a problem with Python 3 SIP than a QGIS one.

I have _not_ set

  DEFAULT_VERSIONS+= python=2.7 python2=2.7 python3=3.6

in /etc/make.conf, so 2.7 should be the default version (I need this for
other projects).

Installed for Python 3 are the following and other ports:

  python36-3.6.7
  py36-sip-4.19.8_1,1


sipconfig.py for both Python versions can be found under their Python dirs:

  # locate sipconfig.py
  /usr/local/lib/python2.7/site-packages/sipconfig.py
  /usr/local/lib/python2.7/site-packages/sipconfig.pyc
  /usr/local/lib/python2.7/site-packages/sipconfig.pyo
  /usr/local/lib/python3.6/site-packages/sipconfig.py

Interestingly enough, only sip under Python 2.7 seems to have a compiled
version.

The sip binaries are found on their expected locations. The one from the
default version 2.7 is linked against the unnumbered one:

  # ls /usr/local/bin/sip*
  ...  /usr/local/bin/sip -> sip-2.7
  ...  /usr/local/bin/sip-2.7
  ...  /usr/local/bin/sip-3.6


Now, in Python3, if I test for installed SIP configuration, I get:

  # python3
  Python 3.6.7 (default, Nov 18 2018, 09:23:28)
  [GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final
  335540)] on freebsd13
  Type "help", "copyright", "credits" or "license" for more
  information.
  >>> import sipconfig
  >>>
  >>> sipcfg = sipconfig.Configuration()
  >>> print("sip_version:%06.0x" % sipcfg.sip_version)
  sip_version:041308
  >>> print("sip_version_num:%d" % sipcfg.sip_version)
  sip_version_num:267016
  >>> print("sip_version_str:%s" % sipcfg.sip_version_str)
  sip_version_str:4.19.8
  >>> print("sip_bin:%s" % sipcfg.sip_bin)
  sip_bin:/usr/local/bin/sip-3.6
  >>> print("default_sip_dir:%s" % sipcfg.default_sip_dir)
  default_sip_dir:/usr/local/share/py36-sip
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  >>> print("sip_inc_dir:%s" % sipcfg.sip_inc_dir)
  sip_inc_dir:/usr/local/include/python3.6m
  >>> # SIP 4.19.10+ has new sipcfg.sip_module_dir
  ... if hasattr(sipcfg, "sip_module_dir"):
  ...     print("sip_module_dir:%s" % sipcfg.sip_module_dir)
  ... else:
  ...     print("sip_module_dir:%s" % sipcfg.sip_mod_dir)
  ...
  sip_module_dir:/usr/local/lib/python3.6/site-packages
  >>>

The problem seems to be, that there is no

  /usr/local/share/py36-sip

any more. After the recent changes to PyQt it resides under

  /usr/loca/share/PyQt5/3.6/sip/


Obviously, there is something wrong with the detection of the right
location. Perhaps, the old patch (/usr/local/share/py36-sip) is
hardcoded somewhere?

Is this a general problem or is there something wrong with my
configuration? Any help is really appreciated.

Regards,
Rainer Hurling



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4be4a0ac-45f0-751f-4315-cd6257c5f635>