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

name                py-pip
version             26.0.1
revision            0
categories-append   www
license             MIT
supported_archs     noarch
platforms           {darwin any}

maintainers         {stromnov @stromnov} openmaintainer

description         A tool for installing and managing Python packages.

long_description    pip is a replacement for easy_install. It uses mostly the \
                    same techniques for finding packages, so packages that \
                    were made easy_installable should be pip-installable as \
                    well.

homepage            https://pip.pypa.io

checksums           rmd160  1285abdf82edcaff79e3ed3aa02721c90315a45e \
                    sha256  c4037d8a277c89b320abe636d59f91e6d0922d08a05b60e85e53b296613346d8 \
                    size    1812747

# keep Python versions < 3.4 here, do add the EOL versions to the list below
# See <https://trac.macports.org/wiki/Python#VersionPolicy>
python.versions     26 27 32 33 310 311 312 313 314

python.pep517_backend flit

if {${name} ne ${subport}} {
    # add EOL warnings
    if {${python.version} <= 39} {
        PortGroup   deprecated 1.0

        deprecated.eol_version  yes
    }

    if {${python.version} <= 33} {
        python.pep517_backend   setuptools
    }

    depends_lib-append  port:py${python.version}-setuptools
    depends_run         port:pip_select

    switch ${python.version} {
        27 {
            version             20.3.4
            revision            0
            checksums           md5 577a375b66ec109e0ac6a4c4aa99bbd0 \
                                rmd160  63cd46d570b6d003143f11be9489d2bb41999d8f \
                                sha256  6773934e5f5fc3eaa8c5a44949b5b924fc122daa0a8aa9f80c835b4ca2a543fc \
                                size    1530646
        }
        33 {
            version             10.0.1
            revision            0
            checksums           rmd160  008e4a069e4969ee08ad383eb1d0070eeb63b405 \
                                sha256  f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68 \
                                size    1246072
        }
        26 {
            version             9.0.3
            revision            0
            checksums           rmd160  9cf0429a7a7e9897339ffc5a141e9b2e1da8086e \
                                sha256  7bf48f9a693be1d58f49f7af7e0ae9fe29fd671cde8a55e6edca3581c4ef5796 \
                                size    1343076
        }
        32 {
            version             7.1.2
            revision            0
            checksums           md5 3823d2343d9f3aaab21cf9c917710196 \
                                rmd160 3d748862e9db0b975db9a51105a4ca151c302a4a \
                                sha256 ca047986f0528cfa975a14fb9f7f106271d4e0c3fe1ddced6c1db2e7ae57a477
        }
    }

    post-destroot {
        xinstall -m 644 {*}[glob -types f ${worksrcpath}/docs/*] ${destroot}${prefix}/share/doc/${subport}

        if {${python.version} in {26 33}} {
            xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}/reference
            xinstall -m 644 {*}[glob -types f ${worksrcpath}/docs/reference/*] ${destroot}${prefix}/share/doc/${subport}/reference
        }

        delete ${destroot}${prefix}/bin/pip[string index ${python.version} 0]-${python.branch}
        delete ${destroot}${prefix}/bin/pip${python.branch}-${python.branch}
    }

    select.entries \
        [list ${python.rootname} ${python.rootname}${python.version}] \
        [list ${python.rootname}[string index ${python.version} 0] ${python.rootname}${python.version}]

    notes "
    To make the Python ${python.branch} version of pip the one that is run\
    when you execute the commands without a version suffix, e.g. 'pip', run:

    "

    foreach entry ${select.entries} {
        notes-append "sudo port select --set $entry"
    }

    livecheck.type      none
}
