# -*- 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 119557 2014-04-30 12:40:36Z stromnov@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-construct
version             2.5.2
revision            0
categories-append   devel
platforms           darwin
license             MIT
supported_archs     noarch

python.versions     24 25 27 33 34

maintainers         macfreek.nl:software dckd.nl:macports openmaintainer

description         python module for parsing and building binary or textual data structures

long_description    Construct is a python library for parsing and building of data structures \
                    (binary or textual). It is based on the concept of defining data \
                    structures in a declarative manner, rather than procedural code: more \
                    complex constructs are composed of a hierarchy of simpler ones.

homepage            http://construct.wikispaces.com/
master_sites        https://pypi.python.org/packages/source/c/construct/

distname            construct-${version}

checksums           rmd160  0c75f72cb06a4abd039499cf216a2e66fd921192 \
                    sha256  665b6271eeadf15219c726b180c8d7a641d026784d72ca3dad90a20aae009020

if {${name} ne ${subport}} {
    if {[lsearch {24 25} ${python.version}] != -1} {
        version             2.00
        revision            0
        master_sites        sourceforge:pyconstruct

        if {${subport} eq "py24-construct"} {
            # we download the 2.00-py24 "backport" version, since that is backward compatible in
             # Python 2.4 (and it works fine with Python 2.5 too)
            distname            construct-${version}-distro-py24b
            checksums           rmd160  0f3b1c2fca257599275757535a1c2e7f319d7075 \
                                sha256  e4bcfde8afccaaa5a98bb7af26d120c1259c3327023a394a1905f37bb58ee299
        } elseif {${subport} eq "py25-construct"} {
            distname            construct-${version}-distro
            checksums           rmd160  084b0c14260d3b9eb93c9034c4b336c0fa30df1e \
                                sha256  d8d8e25c51a293da82ee7dbe1b38cc0b81d7602fc695001e5c31006dd7eb41a1
        }

        use_zip             yes

        worksrcdir          construct

        # nothing to build
        build               {}

        destroot {
            xinstall -d ${destroot}${python.pkgd}
            file copy ${workpath}/construct ${destroot}${python.pkgd}
        }
    } else {
        depends_build-append \
                            port:py${python.version}-setuptools
        depends_lib-append  port:py${python.version}-six
    }

    livecheck.type      none
} else {
    livecheck.type      regex
    livecheck.url       ${master_sites}
    livecheck.regex     {construct-(\d+(?:\.\d+)*)\.[tz]}
}
