# -*- 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
# $Id: Portfile 98787 2012-10-15 23:16:30Z pixilla@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                sqlmap
version             0.9
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          security databases python
maintainers         pixilla openmaintainer
platforms           darwin
license             GPL-2

description         sqlmap is an open source penetration testing 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 lasting from database fingerprinting, over data fetching from \
                    the database, to accessing the underlying file system and executing \
                    commands on the operating system via out-of-band connections.

homepage            http://sqlmap.sourceforge.net/
master_sites        sourceforge

checksums           rmd160  5a6a737157cda4ffe9c6fd326d9fa39f0a0bfe59 \
                    sha256  9c76666d0555620329d949aca87571825adb8fcda9cd564e6410e1d2b6228c55

worksrcdir          ${name}
python.link_binaries no

post-patch {
    fs-traverse f ${worksrcpath} {
        switch [file extension ${f}] {
            .svn {
                delete ${f}
                continue
            }
            .py {
                reinplace "s|^#! */usr/bin/env python\$|#!${python.bin}|" ${f}
            }
        }
    }
}
build {
    system "${python.bin} -m compileall ${worksrcpath}"
    system "${python.bin} -O -m compileall ${worksrcpath}"
}
destroot {
    delete ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${destroot}${python.pkgd}
    copy ${worksrcpath} ${destroot}${python.pkgd}/
}

variant python25 conflicts python26 python27 description {Build for python25} {
    python.default_version 25
}
variant python26 conflicts python25 python27 description {Build for python26} {
    python.default_version 26
}
variant python27 conflicts python25 python26 description {Build for python27} {
    python.default_version 27
}
if {    ![variant_isset python25]
    &&  ![variant_isset python26]
    &&  ![variant_isset python27]
    } {
    default_variants +python27
}
