# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0
PortGroup           github 1.0

name                py-qt4py

categories-append   devel
platforms           {darwin < 11}
# This is a noarch port, but it is only needed on powerpc,
# where Qt5+ are broken presently. Do not use this version elsewhere.
supported_archs     ppc ppc64
license             MIT
maintainers         nomaintainer

github.setup        spyder-ide qtpy 1.11.3 v
revision            0
description         Abstraction layer for PyQt4/PySide
long_description    Provides an uniform layer to support PyQt4 \
                    and PySide with a single codebase.

checksums           rmd160  41115ac22fbd547d86ecd37476e1be82562caaa6 \
                    sha256  eae5c5f11acd85b0c35cd39656e093fb1c0bf20fc5176a0010d466405788c5f6 \
                    size    39447
github.tarball_from archive

# At the moment py-sip4 prevents using python311+ with py-pyqt4.
python.versions     310 311 312

if {${name} ne ${subport}} {
    python.pep517   no

    depends_build-append \
                    port:py${python.version}-setuptools

    depends_test-append \
                    port:py${python.version}-mock

    test.run        yes

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} LICENSE.txt ${destroot}${docdir}
    }

    notes "QtPy needs one of the following backends to be installed on your system:\
        PyQt4 or PySide. If both backends are available, PyQt4 will be used,\
        unless you set the QT_API environment variable."

    # if no backend is installed, it is impossible to run the tests
    # also append a warning about this to the notes
    if {[catch {set installed [lindex [registry_active py${python.version}-pyqt4] 0]}] &&
        [catch {set installed [lindex [registry_active py${python.version}-pyside] 0]}]} {
            test.run        no
            notes-append    "*** WARNING: currently none of the required backends is installed! ***"
    }
}
