# -*- 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 118538 2014-04-04 08:07:23Z aronnax@macports.org $

PortSystem 1.0
PortGroup python 1.0
PortGroup select 1.0

set realname        django-htmlmin
name                py-${realname}
version             0.7.0
python.versions     26 27
license             BSD
platforms           darwin
supported_archs     noarch
maintainers         aronnax openmaintainer
description         html minify for django
long_description \
    django-html in an HTML minifier for Python with full support for HTML 5. \
    It supports Django, Flask and any other Python web framework. It also \
    provides a command line tool that can be used for static websites or \
    deployment scripts.
homepage            http://pypi.python.org/pypi/${realname}/
master_sites        http://pypi.python.org/packages/source/[string index ${realname} 0]/${realname}/
distname            ${realname}-${version}

checksums           md5     0a968e94b7f2c5ff642e8357d1d53aba \
                    sha1    f2c13a4f58be93621f814a9b1e72c023af05a161 \
                    rmd160  c6e4eec1925742c6742a9756b0e562793ef750a8

if {${name} eq ${subport}} {
    livecheck.type  regex
    livecheck.regex [format "%s-%s" ${realname} {(\d+(?:\.\d+)*)}]
} else {
    depends_build-append \
                    port:py${python.version}-setuptools

    depends_lib-append \
                    port:py${python.version}-django \
                    port:py${python.version}-beautifulsoup4 \
                    port:py${python.version}-html5lib

    # FIXME: Upstream source depends unconditionally on argparse,
    # but argparse is built in to Python >= 2.7
    if {${python.version} <= 26} {
        depends_lib-append \
                    port:py${python.version}-argparse
    } else {
        patchfiles  patch-setup.py.diff
    }

    depends_run-append \
                    port:${realname}_select

    select.group    ${realname}
    select.file     ${filespath}/${select.group}${python.version}

    notes "
To make the Python ${python.branch} version of bpython the one that is run\
when you execute the commands without a version suffix, e.g. 'pyminify', run:

port select --set ${select.group} [file tail ${select.file}]
"

    livecheck.type  none
}
