# -*- 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             19.0.3
revision            0
categories-append   www
platforms           darwin
license             MIT
supported_archs     noarch

python.versions     26 27 33 34 35 36 37

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            http://www.pip-installer.org/
master_sites        pypi:[string index ${python.rootname} 0]/${python.rootname}

distname            ${python.rootname}-${version}

checksums           rmd160  9f9766bf6497c3e57b4ad263aa777188f66d9f0a \
                    sha256  6e6f197a1abfb45118dbb878b5c859a0edbdd33fd250100bc015b67fded4b9f2 \
                    size    1324617

if {${name} ne ${subport}} {
    depends_lib-append  port:py${python.version}-setuptools
    depends_run         port:pip_select

    if {[lsearch {26} ${python.version}] != -1} {
        version             9.0.3
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  9cf0429a7a7e9897339ffc5a141e9b2e1da8086e \
                            sha256  7bf48f9a693be1d58f49f7af7e0ae9fe29fd671cde8a55e6edca3581c4ef5796
    }

    if {[lsearch {33} ${python.version}] != -1} {
        version             10.0.1
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  008e4a069e4969ee08ad383eb1d0070eeb63b405 \
                            sha256  f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68 \
                            size    1246072
    }

    if {[lsearch {34} ${python.version}] != -1} {
        version             18.1
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  53409af5e0f06b66656d2d0d81c79ff0a7aba29f \
                            sha256  c0a292bd977ef590379a3f05d7b7f65135487b67470f6281289a94e015650ea1 \
                            size    1259370
    }

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

        if {[lsearch {26 33} ${python.version}] != -1} {
            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 range ${python.version} 0 end-1]-${python.branch}
        delete ${destroot}${prefix}/bin/pip${python.branch}-${python.branch}
    }

    select.group        ${python.rootname}
    select.file         ${filespath}/${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:

    port select --set ${select.group} [file tail ${select.file}]
    "

    livecheck.type      none
}