# -*- 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
PortGroup           deprecated 1.0

name                py-hyperestraier
version             0.0.15

platforms           darwin
categories-append   textproc
maintainers         nomaintainer

description         a Python module for Hyper Estraier
long_description    ${description}

homepage            http://web.archive.org/web/20100103195728/http://hyperestraier.sourceforge.net/
master_sites        macports_distfiles
dist_subdir         hyperestraier

deprecated.upstream_support no
livecheck.type      none
python.versions     27

if {${name} ne ${subport}} {
    distfiles       hyper_estraier_wrappers-${version}.tar.gz:main \
                    HyperEstraier.py:sub HyperEstraier_wrap.cxx:sub
    extract.only    hyper_estraier_wrappers-${version}.tar.gz
    distname        hyper_estraier_wrappers-${version}
    checksums       hyper_estraier_wrappers-${version}.tar.gz \
                    md5     26f81dbc06954a6030f801b4d8b06fa9 \
                    sha1    e348fd6c337ca2e41a322f210902a0d4aeaad056 \
                    rmd160  d53a872587f370e39e193dfc3de1d1316db77695 \
                    sha256  fef975da295f7a393a3a0fbaf2e00d06f1d58f6486bbfdd3fc0af26dd7cc3bd2 \
                    size    368409 \
                    HyperEstraier.py \
                    md5     7d577bf8a50a34ef50b3b6ebbecd3993 \
                    sha1    05f63a3af75ba7d0aaaa6041dd96f8c9f7fafc01 \
                    rmd160  a51d15e42b1f71b76861c8ee83d5b4ef5fce6099 \
                    sha256  d6b1c65dac7583c0b035ea79d749ee1f4a9fb9dfaf9711c95162f009ee90d82f \
                    size    18579 \
                    HyperEstraier_wrap.cxx \
                    md5     44c0d0abdc6bc67ed5667f98f155e409 \
                    sha1    5df821e6f9510bca05949c395e57049fb58e8fa8 \
                    rmd160  2a666360ebc68de1faf4079db2aae172317d57fd \
                    sha256  6a7c86daec1985286c56be9a25e080dc9d642585d5496c27e772c885b141bfda \
                    size    474306

    patchfiles      patch-setup.py patch-examples-search.py

    depends_lib-append  port:hyperestraier
    #depends_build      port:swig-python

    post-extract {
        file copy ${distpath}/HyperEstraier.py ${worksrcpath}
        file copy ${distpath}/HyperEstraier_wrap.cxx ${worksrcpath}
    }

    #pre-build {
    #    system "cd ${worksrcpath}; swig -python -c++ HyperEstraier.i"
    #}

    post-destroot {
        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}/examples
        xinstall -m 644 -W ${worksrcpath}/examples \
            dbinfo.py gatherer.py iter.py oogatherer.py search.py \
            ${destroot}${prefix}/share/doc/${subport}/examples

        reinplace s|'/tmp/casket'|'casket'| \
            ${destroot}${prefix}/share/doc/${subport}/examples/dbinfo.py
        reinplace s|'/tmp/casket'|'casket'| \
            ${destroot}${prefix}/share/doc/${subport}/examples/iter.py

        file copy ${worksrcpath}/examples/subway \
            ${destroot}${prefix}/share/doc/${subport}/examples

        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}/test
        xinstall -m 644 ${worksrcpath}/test/python.py \
            ${destroot}${prefix}/share/doc/${subport}/test
    }
}
