# -*- 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-virtualenv
version             20.4.3
revision            0

categories-append   devel
platforms           darwin
supported_archs     noarch
license             MIT
maintainers         {larryv @larryv} openmaintainer

description         Virtual Python Environment builder
long_description    virtualenv is a tool to create isolated Python \
                    environments.

homepage            https://virtualenv.pypa.io

checksums           rmd160  3f57f54f5eef300856e49dd6a3fd715bd4b78c4a \
                    sha256  49ec4eb4c224c6f7dd81bb6d0a28a09ecae5894f4e593c89b0db0885f565a107 \
                    size    10579193

# keep older Python versions here, do add the EOL version to the list below
python.versions     27 34 35 36 37 38 39

if {${name} ne ${subport}} {
    # add EOL warnings
    if {${python.version} in "27 34 35"} {
        PortGroup   deprecated 1.0

        deprecated.eol_version  yes
    }

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

    depends_lib-append      port:py${python.version}-appdirs \
                            port:py${python.version}-distlib \
                            port:py${python.version}-filelock \
                            port:py${python.version}-setuptools \
                            port:py${python.version}-six

    if {${python.version} == 27} {
        depends_lib-append  port:py${python.version}-contextlib2 \
                            port:py${python.version}-pathlib2
    }

    if {${python.version} < 37} {
        depends_lib-append  port:py${python.version}-importlib-resources
    }

    if {${python.version} < 38} {
        depends_lib-append  port:py${python.version}-importlib-metadata
    }

    depends_run-append  port:virtualenv_select

    select.group        virtualenv
    select.file         virtualenv${python.version}

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}/docs/changelog
        xinstall -m 0644 -W ${worksrcpath} README.md LICENSE \
            ${destroot}${docdir}
        xinstall -m 0644 {*}[glob -directory ${worksrcpath}/docs *.rst] \
                ${destroot}${docdir}/docs
        xinstall -m 0644 {*}[glob -directory ${worksrcpath}/docs/changelog *] \
                ${destroot}${docdir}/docs/changelog
    }

    notes-append "
    The executable is installed as\
    '${prefix}/bin/virtualenv-${python.branch}'. To symlink it to\
    '${prefix}/bin/virtualenv', run:

        sudo port select --set ${select.group} ${select.file}
    "

    livecheck.type  none
}
