# -*- 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-berkeleydb
version                 18.1.14
revision                0

categories-append       databases
license                 BSD
maintainers             {mascguy @mascguy} openmaintainer

description             Python 3 bindings for Oracle Berkeley DB
long_description        This port provides a nearly complete wrapping \
                        of the Oracle/Sleepycat C API for the Database \
                        Environment, Database, Cursor, Log Cursor, \
                        Sequence and Transaction objects.
homepage                https://pypi.org/project/${python.rootname}

checksums               rmd160  d2512fff2e351670ff1fe8c109f2c4907fd9f062 \
                        sha256  8c260282f57ebd5b9c3ce53da0eb75be5957addb303e3190935b716448f32f7d \
                        size    320796

python.versions         310 311 312 313

set db_version          62

if {${name} ne ${subport}} {
    # FIXME: Disable use of static_assert; remove when added to legacysupport
    # See: https://trac.macports.org/ticket/65909
    patchfiles-append \
                        patch-static_assert.diff

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

    depends_lib-append \
                        port:db${db_version}

    foreach env_phase {build destroot} {
        ${env_phase}.env-append \
                        BERKELEYDB_INCDIR=${prefix}/include/db${db_version} \
                        BERKELEYDB_LIBDIR=${prefix}/lib/db${db_version} \
                        YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION=1
    }

    # FIXME: Tests fail with: No module named 'test.support'; 'test' is not a package
    test.run            yes
}
