# -*- 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 84550 2011-09-27 21:05:11Z snc@macports.org $

PortSystem 1.0
PortGroup           python26 1.0

name             hellanzb
version          0.13
revision         2
categories       news python
maintainers      groovie.org:pjenvey
description      Nzb downloader and post processor
long_description hellanzb is an easy to use app designed to retrieve nzb \
                 files and fully process them. The goal being to make \
                 getting files from Usenet as hands-free as possible. Once \
                 fully installed, all that's required is moving an nzb file \
                 to the queue directory. The rest: downloading, \
                 par-checking, un-raring, etc. is done automatically by \
                 hellanzb.
homepage         http://www.hellanzb.com
platforms        darwin

master_sites     ${homepage}/distfiles/
checksums        md5 d3510c6b1b2c7b935332a469fdc8e7e2

depends_run      bin:par2:par2 \
                 bin:unrar:unrar \
                 bin:flac:flac \
                 bin:shorten:shorten \
                 port:py26-twisted \
                 port:py26-openssl

patchfiles       patch-hellanzb.py.diff \
                 patch-hellanzb_for_twisted-10.0.0.diff

variant no_ssl description {Disable ssl support} {
    depends_run-delete  port:py26-openssl
}

post-destroot {
   move ${destroot}${python.prefix}/bin/${name}.py ${destroot}${prefix}/bin
   move ${destroot}${python.prefix}/etc/${name}.conf.sample ${destroot}${prefix}/share/doc/hellanzb/
   
   eval xinstall [glob ${destroot}${python.prefix}/share/doc/hellanzb/*] ${destroot}${prefix}/share/doc/hellanzb/
   
   system "rm -rf ${destroot}${python.prefix}/share"
}

post-activate {
  if { ![file exists ${prefix}/etc/${name}.conf] } {
    copy ${prefix}/share/doc/hellanzb/${name}.conf.sample ${prefix}/etc/${name}.conf
  }
}
