# -*- 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           github 1.0
PortGroup           python 1.0

github.setup        MagicStack asyncpg 0.22.0 v
revision            0
name                py-${github.project}
categories-append   devel
fetch.type          git

license             Apache-2
maintainers         nomaintainer
platforms           darwin

description         An asyncio PostgreSQL driver

long_description    asyncpg is a database interface library designed \
                    specifically for PostgreSQL and \
                    Python/asyncio. asyncpg is an efficient, clean \
                    implementation of PostgreSQL server binary \
                    protocol for use with Python's asyncio \
                    framework.

python.versions     37 38 39

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

    depends_lib-append \
                    port:py${python.version}-cython

    depends_run-append \
                    port:py${python.version}-typing_extensions

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

    post-fetch {
        system -W ${worksrcpath}/${github.project} "git submodule update --init pgproto"
    }
    
    pre-test {
        test.env-append \
                    PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
        # See https://docs.pytest.org/en/stable/pythonpath.html
        delete ${test.dir}/${test.target}/__init__.py
    }

    test.run        yes
    test.cmd        py.test-${python.branch}
    test.target     tests

    livecheck.type  none
}
