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

github.setup        Zverik regional db24f93deacde92f48e703d8c07409c6c6729449
version             20220518
revision            0
github.tarball_from archive

name                trim_osc

platforms           any
supported_archs     noarch
maintainers         {@frankdean fdsd.co.uk:frank.dean} openmaintainer

license             WTFPL

description         Scripts for regional OSM extracts support

long_description    It is hard to maintain OSM tile service with a small \
                    server: you can't have a properly updated regional \
                    extract or even run osm2pgsql on low memory. This \
                    package contains some scripts that help.

python.default_version  312

depends_lib-append  port:py${python.version}-lxml \
                    port:py${python.version}-psycopg2 \
                    port:py${python.version}-shapely

checksums           rmd160  d1d18de9335bb8e634eeaf5b7962d1aa6a6e0113 \
                    sha256  17ea1c4f72ba4b9cc1164f513a87be75b10f17de28638ac85fba4f4c417a2c07 \
                    size    7046

variant postgresql15 conflicts postgresql16 description {Use with PostgreSQL 15} {
    require_active_variants py${python.version}-psycopg2 postgresql15
    depends_lib-append port:postgresql15
}

variant postgresql16 conflicts postgresql15 description {Use with PostgreSQL 16} {
    require_active_variants py${python.version}-psycopg2 postgresql16
    depends_lib-append port:postgresql16
}

post-patch {
    reinplace "s#/usr/bin/python3#${python.bin}#g" \
        ${worksrcpath}/trim_osc.py
}

build {}

destroot {
    xinstall -d ${destroot}${prefix}/share/${name}
    xinstall -m 0755 \
        {*}[glob ${worksrcpath}/*.py] \
        ${destroot}${prefix}/share/${name}
}
