# -*- 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-audiocraft
version             1.3.0
revision            0

categories-append   audio science
platforms           {darwin any}
supported_archs     noarch
license             MIT
maintainers         {pguyot @pguyot} openmaintainer

description         Audio generation framework from Meta AI Research

long_description    AudioCraft is a library for audio generation from \
                    Meta AI Research, providing the code and models for \
                    MusicGen (music generation), AudioGen (audio \
                    generation), EnCodec (audio compression), and \
                    Multi Band Diffusion (enhancement).

homepage            https://github.com/facebookresearch/audiocraft

checksums           rmd160  906c8fcc99c2836fb003f5edf2a6b72bc4b20f54 \
                    sha256  d82ade3eb4f934ee1adb438ae687a2bf59d33ca4a20039beab072548c038ac80 \
                    size    635718

python.versions     313 314

# Upstream pins exact versions of torch, torchvision, torchtext, av, and xformers.
# Remove these pins to work with MacPorts versions.
# Also remove torchtext (deprecated upstream).
patchfiles-append   patch-remove-version-pins.diff

if {${name} ne ${subport}} {
    # spaCy uses pydantic v1 compat layer which is broken on Python 3.14.
    # Remove spaCy import and stub out WhiteSpaceTokenizer on 3.14.
    if {${python.version} >= 314} {
        patchfiles-append \
                    patch-conditioners-no-spacy.diff
    }

    depends_lib-append \
                    port:py${python.version}-av \
                    port:py${python.version}-demucs \
                    port:py${python.version}-einops \
                    port:py${python.version}-encodec \
                    port:py${python.version}-flashy \
                    port:py${python.version}-gradio \
                    port:py${python.version}-huggingface_hub \
                    port:py${python.version}-hydra-colorlog \
                    port:py${python.version}-hydra-core \
                    port:py${python.version}-julius \
                    port:py${python.version}-librosa \
                    port:py${python.version}-num2words \
                    port:py${python.version}-numpy \
                    port:py${python.version}-pesq \
                    port:py${python.version}-protobuf3 \
                    port:py${python.version}-pystoi \
                    port:py${python.version}-pytorch \
                    port:py${python.version}-sentencepiece \
                    port:py${python.version}-soundfile \
                    port:py${python.version}-torchaudio \
                    port:py${python.version}-torchdiffeq \
                    port:py${python.version}-torchmetrics \
                    port:py${python.version}-torchvision \
                    port:py${python.version}-transformers \
                    port:py${python.version}-xformers \
                    port:py${python.version}-tqdm

    if {${python.version} < 314} {
        depends_lib-append \
                    port:py${python.version}-spaCy
    }
}
