# -*- 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-shapely
version             2.1.2
revision            0
python.versions     39 310 311 312 313
categories-append   devel
maintainers         {snc @nerdling} openmaintainer
license             BSD
homepage            https://shapely.readthedocs.io/en/stable/
description         Shapely is a Python package for manipulation \
                    and analysis of 2D geospatial geometries

long_description    Shapely is a Python package for manipulation and \
                    analysis of 2D geospatial geometries. It is based on \
                    GEOS (http://geos.refractions.net). Shapely 1.0 is not \
                    concerned with data formats or coordinate reference \
                    systems.

checksums           rmd160  1db5c2910eff20f0dbb6894a04e0dff9d89182b6 \
                    sha256  2ed4ecb28320a433db18a5bf029986aa8afcfd740745e78847e330d5d94922a9 \
                    size    315489

if {${name} ne ${subport}} {
    if {${python.version} == 39} {
        version     2.0.7
        revision    0
        checksums   rmd160  e4024922c974ec160df6d01607e3f644770af318 \
                    sha256  28fe2997aab9a9dc026dc6a355d04e85841546b2a5d232ed953e3321ab958ee5 \
                    size    283413
    }

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

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

    # pycore_frame.h:134: error: ‘for’ loop initial declaration used outside C99 mode
    # Since it depends on py-numpy, which requires modern gcc, avoid Xcode one here.
    compiler.blacklist-append \
                            *gcc-4.0 *gcc-4.2

    # https://github.com/shapely/shapely/issues/2161
    if {[string match *gcc* ${configure.compiler}]} {
        patchfiles-append   patch-setup.py.diff
    }
}
