# -*- 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 103179 2013-02-18 03:27:31Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-pyusb
version             0.4.3
revision            1
categories-append   devel
platforms           darwin
license             BSD
maintainers         nomaintainer
description         Python library to provide easy USB device access
long_description    The PyUSB module provides Python with easy access to \
                    the host machine's Universal Serial Bus (USB) system

homepage            http://pyusb.sourceforge.net/
master_sites        sourceforge:pyusb
distname            pyusb-${version}

checksums           md5     a1a43bc6407caccbc22073c56439aa06 \
                    sha1    5a6729169e320e9dfb19c6af461eca6d45242787 \
                    rmd160  803794e073dd0f052ec9c31f0d3210751403c85b

python.versions 25 26 27

if {${name} != ${subport}} {
    conflicts           py${python.version}-pyusb-devel

    depends_lib-append  path:lib/pkgconfig/libusb.pc:libusb-compat

    patchfiles          setup.py.diff
    post-patch {
        reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/setup.py
    }

    post-destroot {
        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath} README LICENSE \
            ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 755 -d ${destroot}${prefix}/share/examples/${subport}
        eval file copy [glob ${worksrcpath}/samples/*] \
            ${destroot}${prefix}/share/examples/${subport}
    }
}
