# -*- 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                sqlmap
version             1.9
revision            0

categories          security databases python
maintainers         {judaew @judaew} openmaintainer
supported_archs     noarch
platforms           {darwin any}
license             GPL-2+

description         Automatic SQL injection and database takeover tool
long_description    \
    sqlmap is an open source penetration testing tool that automates the \
    process of detecting and exploiting SQL injection flaws and taking over of \
    database servers. It comes with a powerful detection engine, many niche \
    features for the ultimate penetration tester, and a broad range of \
    switches including database fingerprinting, over data fetching from the \
    database, accessing the underlying file system, and executing commands on \
    the operating system via out-of-band connections.
homepage            https://sqlmap.org/

checksums           rmd160  92aaa13748fc78dd9134979a08f0ccf9c49f0161 \
                    sha256  6eeb80fabd51e3648c86b9accc41a1156f473de689560d4a8a1025593e36253b \
                    size    7244621

patchfiles          patch-cmd-usage-string.diff

post-patch {
    fs-traverse f ${worksrcpath} {
        switch [file extension ${f}] {
            .py {
                reinplace "s|^#! */usr/bin/env python\$|#!${python.bin}|" ${f}
            }
        }
    }
}

variant python27 conflicts python39 python310 python311 python312 python313 \
    description {Build for Python 2.7} {
    python.default_version 27
}

variant python39 conflicts python27 python310 python311 python312 python313 \
    description {Build for Python 3.9} {
    python.default_version 39
}

variant python310 conflicts python27 python39 python311 python312 python313 \
    description {Build for Python 3.10} {
    python.default_version 310
}

variant python311 conflicts python27 python39 python310 python312 python313 \
    description {Build for Python 3.11} {
    python.default_version 311
}

variant python312 conflicts python27 python39 python310 python311 python313 \
    description {Build for Python 3.12} {
    python.default_version 312
}

variant python313 conflicts python27 python39 python310 python311 python312 \
    description {Build for Python 3.13} {
    python.default_version 313
}

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

if {![variant_isset python27] && \
    ![variant_isset python39] && \
    ![variant_isset python310] && ![variant_isset python311] && \
    ![variant_isset python312] && ![variant_isset python313]} {
    default_variants +python313
}

post-destroot {
    ln -s ${frameworks_dir}/Python.framework/Versions/[string index ${python.version} 0].[string range ${python.version} 1 end]/bin/${name} \
        ${destroot}${prefix}/bin/${name}
}