# -*- 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

name                py-eyed3
python.rootname     eyeD3
version             0.9.4
revision            0

categories-append   audio
platforms           darwin
supported_archs     noarch
license             GPL-3+
maintainers         nomaintainer

description         Python audio data toolkit (ID3 and MP3)
long_description    eyeD3 is a Python program/module for processing \
                    (reading and writing) ID3 tags. Information about mp3 \
                    files (i.e bit rate, sample frequency, play time, \
                    etc.) is also available. The formats supported are ID3 \
                    v1.0/v1.1 and v2.3/v2.4.

homepage            https://eyed3.readthedocs.io

checksums           rmd160  e021b13c5f031d54e6b17af94e948e1e568ac40c \
                    sha256  11099464e438c11a1d701e723a5065c1556fb59878ad9dce29f924dac3a07a96 \
                    size    222818

python.versions     27 37 38

if {${name} ne ${subport}} {
    depends_lib-append \
                    port:py${python.version}-setuptools

    if {${python.version} eq 27} {
        version     0.8.12
        revision    0
        checksums   rmd160  9f694503bf313395d25e42b44c192e49c6c0c259 \
                    sha256  e54eec0a03fb8e7e9e8b509546c6d92efbc871ea7597611fe2c16f03e1c94b6d \
                    size    214073

        depends_lib-append \
                    port:py${python.version}-magic \
                    port:py${python.version}-pathlib2 \
                    port:py${python.version}-six

        # upstream is using pathlib, change that for pathlib2 which is already present in MacPorts
        # only needed for PY27, for which support will be removed in the next release
        post-patch {
            reinplace "s|pathlib|pathlib2|g" ${worksrcpath}/src/eyed3/core.py
            reinplace "s|pathlib|pathlib2|g" ${worksrcpath}/src/eyed3/plugins/art.py
            reinplace "s|pathlib|pathlib2|g" ${worksrcpath}/src/eyed3/utils/__init__.py
            reinplace "s|pathlib|pathlib2|g" ${worksrcpath}/requirements/requirements.yml
        }
    } else {
    # list here dependencies for Python != 2.7
        depends_lib-append \
                    port:py${python.version}-deprecation \
                    port:py${python.version}-filetype
    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} AUTHORS.rst CONTRIBUTING.rst \
           HISTORY.rst LICENSE README.rst ${destroot}${docdir}
    }

    livecheck.type  none
}
