# -*- 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

name                py-zipp
version             3.23.1
revision            0
categories-append   devel
supported_archs     noarch
platforms           {darwin any}
license             MIT

# keep version for Python 2.7, this is and (indirect) dependencies of py-virtualenv
# See <https://trac.macports.org/wiki/Python#VersionPolicy>
python.versions     27 35 36 37 38 39 310 311 312 313 314

maintainers         {stromnov @stromnov} openmaintainer

description         A pathlib-compatible Zipfile object wrapper.
long_description    {*}${description}

homepage            https://github.com/jaraco/zipp

checksums           rmd160  7895d2753e6ece3951d55d00dc90c3f97e4cebe1 \
                    sha256  32120e378d32cd9714ad503c1d024619063ec28aad2248dc6672ad13edfa5110 \
                    size    25965

if {${name} ne ${subport}} {
    depends_build-append \
                        port:py${python.version}-setuptools

    if {${python.version} <= 35} {
        version             1.2.0
        revision            0
        checksums           rmd160  798ad5f33d1f7f44f5360679f3ab4a177b96d0bf \
                            sha256  c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1 \
                            size    13357
        if {${python.version} < 34} {
            depends_lib-append  port:py${python.version}-contextlib2
        }
    } elseif {${python.version} eq 36} {
        version             3.6.0
        revision            0
        checksums           rmd160  7203de20b31173e32d6c0876d1537e0b147eada8 \
                            sha256  71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832 \
                            size    13047
    } elseif {${python.version} eq 37} {
        version             3.15.0
        revision            0
        checksums           rmd160  1b019c27f6f26c21b2aa514c5836c9495402a761 \
                            sha256  112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b \
                            size    18454
    } elseif {${python.version} eq 38} {
        version             3.20.2
        revision            0
        checksums           rmd160  43963cc937f6b313b3a5ae8940a7905584ce4f1d \
                            sha256  bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29 \
                            size    24199
    } elseif {${python.version} eq 39} {
        version             3.21.0
        revision            0
        checksums           rmd160  fb611faa0a96a54af13cf95a162ffdc89b6ad90c \
                            sha256  2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4 \
                            size    24545
    }

    if {${python.version} in {37 38 39}} {
        revision            1
        # Similar to: https://trac.macports.org/ticket/72425
        post-patch {
            reinplace "s|dynamic = \\\[\\\"version\\\"\\\]|version = \"${version}\"|" pyproject.toml
        }
        # break circular dependency with py-build
        python.add_dependencies no
        depends_build-append    port:py-bootstrap-modules \
                                port:py${python.version}-installer
        depends_lib-append      port:python${python.version}
        build.env-append        PYTHONPATH=${prefix}/share/py-bootstrap-modules
        build.args              --skip-dependency-check
    } else {
        depends_build-append \
                        port:py${python.version}-setuptools_scm
    }

    if {${python.version} eq 37} {
        python.pep517       no
        patchfiles-append   patch-setup.py.diff
        build.args-delete   --skip-dependency-check
    }

    if {${python.version} >= 310} {
        depends_build-append \
                        port:py${python.version}-coherent.licensed
    }

    livecheck.type      none
}
