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

github.setup        magenta magenta 2.1.2 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
name                py-${github.project}
categories-append   audio

license             Apache-2
maintainers         nomaintainer
platforms           {darwin any}
supported_archs     noarch

description         Magenta: Music and Art Generation with Machine Intelligence

long_description    Magenta is a research project exploring the role\
                    of machine learning in the process of creating art\
                    and music. Primarily this involves developing new\
                    deep learning and reinforcement learning\
                    algorithms for generating songs, images, drawings,\
                    and other materials. But it's also an exploration\
                    in building smart tools and interfaces that allow\
                    artists and musicians to extend (not replace!)\
                    their processes using these models.

checksums           rmd160  69a2206915539effab4448b76e131c9f3ecd5c66 \
                    sha256  75cdd463167e16b4cda21c4e89a5d17502d9d607c733a47f6e18f66689a34a10 \
                    size    19676359

python.versions     39

if {${name} ne ${subport}} {
    depends_lib-append \
                    port:py${python.version}-absl \
                    port:py${python.version}-apache-beam \
                    port:py${python.version}-dm-sonnet \
                    port:py${python.version}-imageio \
                    port:py${python.version}-librosa \
                    port:py${python.version}-matplotlib \
                    port:py${python.version}-mido \
                    port:py${python.version}-mir_eval \
                    port:py${python.version}-note-seq \
                    port:py${python.version}-numba \
                    port:py${python.version}-numpy \
                    port:py${python.version}-Pillow \
                    port:py${python.version}-pygtrie \
                    port:py${python.version}-pretty-midi \
                    port:py${python.version}-scikit-image \
                    port:py${python.version}-scipy \
                    port:py${python.version}-six \
                    port:py${python.version}-sk-video \
                    port:py${python.version}-sox \
                    port:py${python.version}-tensor2tensor \
                    path:${python.pkgd}/tensorflow:py${python.version}-tensorflow \
                    port:py${python.version}-tensorflow-datasets \
                    port:py${python.version}-tensorflow-probability \
                    port:py${python.version}-tf-slim \
                    port:py${python.version}-wheel \
                    port:sox

    depends_test-append \
                    port:py${python.version}-pydub \
                    port:py${python.version}-pytest-xdist

    # diff -NaurdwB ./setup.py ./patch-setup.py | sed -E -e 's|patch-||' > ./patch-setup.py.diff
    patchfiles      patch-setup.py.diff

    test.run        yes

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

    notes "One example Magenta application is piano transcription:

onsets_frames_transcription_transcribe-${python.branch} --model_dir=path/to/maestro_checkpoint piano_recording.wav

See:
* https://github.com/magenta/magenta/tree/master/magenta/models/onsets_frames_transcription
* https://storage.googleapis.com/magentadata/models/onsets_frames_transcription/maestro_checkpoint.zip
"
}
