Bug 262129

Summary: devel/py-qt5-pyqt Build error "'super' object has no attribute 'get_platform_tag'"
Product: Ports & Packages Reporter: Rafael Grether <devnull>
Component: Individual Port(s)Assignee: freebsd-kde (group) <kde>
Status: Closed FIXED    
Severity: Affects Only Me CC: adridg, lbartoletti
Priority: --- Flags: devnull: maintainer-feedback?
Version: Latest   
Hardware: Any   
OS: Any   

Description Rafael Grether 2022-02-22 21:34:59 UTC
Hello,

I'm performing a py-qt5-pyqt build, but results in error.
I'm using FreeBSD13 p7.
 
    if self.project.get_platform_tag().endswith('_universal2'):
  File "/usr/local/lib/python3.8/site-packages/pyqtbuild/project.py", line 138, in get_platform_tag
    platform_tag = super().get_platform_tag().split('_')
AttributeError: 'super' object has no attribute 'get_platform_tag'
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-qt5-pyqt
Comment 1 Loïc Bartoletti freebsd_committer freebsd_triage 2022-02-23 06:22:55 UTC
Hello,

How do you do the build?
Comment 2 Rafael Grether 2022-02-23 19:23:56 UTC
Loïc Bartoletti, thanks for your reply.

I ran a "make install clean", inside /usr/ports/devel/py-qt5-pyqt
I pastebin all operation and result: https://pastebin.com/cKKstBgp

But analyzing the error, I found the problem.
The problem was in the py-sip dependency. py38-sip (version 5.5.0) is in the quarterly branch.

But it looks like py-qt5-pyqt requires a newer version of py38-sip, incompatible with 5.5.0 version that is at quarterly branch.

So I manually removed 5.5.0 and installed the new py38-sip-6.3.1 version directly from ports (released in Jan, 27). And the build worked.

I don't know the best solution for this. This problem will occur with everyone who has the py38-sip package installed via default pkg (quarterly branch).
But the py-qt5-pyqt package is not on the quarterly branch (not yet), so everyone installing py-qt5-pyqt directly from ports will get this error.

Maybe check if py38-sip > 5.5.0 ?
Comment 3 Adriaan de Groot freebsd_committer freebsd_triage 2022-05-29 10:54:45 UTC
In 2022Q1, the port `devel/py-qt5-pyqt` does not exist, so I went looking in 2022Q2 instead,

```
$ make -V BUILD_DEPENDS
/usr/local/bin/python3.8:lang/python38 py38-qt5-sip>=12.9.1:devel/py-qt5-sip@py38 py38-qtbuilder>=1.12.2:devel/py-qtbuilder@py38 py38-sip>=6.5.1:devel/py-sip@py38 qt5-buildtools>=5.15.2:devel/qt5-buildtools /usr/local/lib/qt5/bin/designer:devel/qt5-designer /usr/local/lib/qt5/plugins/imageformats/libqtiff.so:graphics/qt5-imageformats qt5-qmake>=5.15.2:devel/qt5-qmake
```

Notice how py38-sip is specified as a version. I'm going to assume that the version check actually works (since I have no sensible way of swapping out sip for an older one), and then I don't understand how you're hitting this situation. All the versions were updated in 2022Q2 at the same time on February 2nd. In main, the situation is the same.

.. except that some careful breakage of my **own** Mk/Uses/pyqt.mk shows that this problem does exist.
Comment 4 Adriaan de Groot freebsd_committer freebsd_triage 2022-05-29 10:59:27 UTC
- Build and install py-sip, current version (for me, that's py38-sip-6.5.1,1)
- Check what is installed
  ```
  devel/py-qt5-pyqt # pkg info | grep sip
  py38-qt5-sip-12.9.1            Python to C and C++ bindings generator
  py38-sip-6.5.1,1               Python to C and C++ bindings generator
  ```
- Bump the py-sip version in Uses/Mk/pyqt.mk
- Check what BUILD_DEPENDS says
  ```
  devel/py-qt5-pyqt # make -V BUILD_DEPENDS
  py38-dbus>1:devel/py-dbus pkgconf>=1.3.0_1:devel/pkgconf /usr/local/bin/python3.8:lang/python38 py38-qt5-sip>=12.9.1:devel/py-qt5-sip@py38 py38-qtbuilder>=1.12.2:devel/py-qtbuilder@py38 py38-sip>=7.6.1:devel/py-sip@py38 qt5-buildtools>=5.15.2:devel/qt5-buildtools /usr/local/lib/qt5/bin/designer:devel/qt5-designer /usr/local/lib/qt5/plugins/imageformats/libqtiff.so:graphics/qt5-imageformats qt5-qmake>=5.15.2:devel/qt5-qmake
  ```
- Notice "py38-sip>=7.6.1:devel/py-sip@py38" in there; in principle that's greater, right?

Except it isn't: PORTEPOCH counts, as well, and 7.6.1 is a PORTEPOCH behind 6.5.1, so the check passes. I'm going to have to fix this in pyqt.mk.
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-05-29 11:22:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c289bc6278504bd2dd455851a5de8de4bf48af4e

commit c289bc6278504bd2dd455851a5de8de4bf48af4e
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2022-05-29 11:02:53 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2022-05-29 11:16:44 +0000

    Uses/pyqt.mk: repair PORTEPOCH of py-sip dependency

    When using BUILD_DEPENDS with a dependency-version, as described
    in section 5.9.9 of the Porters Handbook, a desired-version can be
    compared with an installed-version, e.g.:

            py38-sip>=6.5.1:devel/py-sip@py38

    The version is compared fully with all the ports-versioning
    parts included. That includes the PORTEPOCH, which isn't
    visible (because =0 in the specification above). Since py-sip
    was epoched at some point, the installed version of py-sip might
    be this:

            py38-sip-5.5.0,1               Python to C and C++ bindings generator

    Because of the epoch, the version 5.5.0,1 > 6.5.1, even though
    visually it seems like it wouldn't be. Massage the dependency generation
    in pyqt.mk to take that epoch into account.

    PR:             262129
    Reported by:    Rafael Grether

 Mk/Uses/pyqt.mk | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
Comment 6 Adriaan de Groot freebsd_committer freebsd_triage 2022-05-29 11:30:10 UTC
This went from "nah, can't happen" to "not our problem" to "oh, there is a real issue and let's fix it", thanks for reporting!