# -*- 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                yt-dlp-ejs
homepage            https://github.com/yt-dlp/ejs
version             0.3.1

master_sites        https://files.pythonhosted.org/packages/e7/fd/34fbdaf0d53386c47e219c532a479766cd9336fde34c00834c8e0123df7a/
distname            yt_dlp_ejs-${version}-py3-none-any
extract.suffix      .whl
extract.only

revision            0
categories          net
license             public-domain ISC MIT

maintainers         {@akierig fastmail.de:akierig} \
                    {@ryandesign ryandesign}

checksums           rmd160  f952db52d48e810454de82a5a3e2c80136954564 \
                    sha256  a6e3548874db7c774388931752bb46c7f4642c044b2a189e56968f3d5ecab622 \
                    size    53155

description         ${name} is an external JavaScript utility for \
                    yt-dlp that supports multiple JS runtimes.
long_description    {*}${description} It enables yt-dlp to solve \
                    JavaScript challenges for YouTube and other sites.

supported_archs     noarch
platforms           {darwin any}

variant python310 conflicts python311 python312 python313 description {Use Python 3.10} {}
variant python311 conflicts python310 python312 python313 description {Use Python 3.11} {}
variant python312 conflicts python310 python311 python313 description {Use Python 3.12} {}
variant python313 conflicts python310 python311 python312 description {Use Python 3.13} {}

if {![variant_isset python310] && ![variant_isset python311] && ![variant_isset python312] && ![variant_isset python313]} {
    default_variants +python313
}

if {[variant_isset python310]} {
    python.default_version  310
} elseif {[variant_isset python311]} {
    python.default_version  311
} elseif {[variant_isset python312]} {
    python.default_version  312
} elseif {[variant_isset python313]} {
    python.default_version  313
}

depends_run-append  port:deno

if {${os.major} <= 16} {
    depends_run-delete port:deno
    depends_run-append path:bin/qjs:quickjs

    notes "
    If you are using macOS 10.12 or older, you will need to pass the
    '--js-runtimes quickjs:${prefix}/bin/qjs' flag or add the appropriate
    changes to your yt-dlp configuration file. For example, you can run
    this command to set up the default configuration file:

    echo --js-runtimes quickjs:${prefix}/bin/qjs >> ~/yt-dlp.conf
    "
}

python.pep517_backend

build {}

destroot.target         ${distpath}/${distfiles}

