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

name                animesnap
github.setup        YisusChrist AnimeSnap c4246f901e9754a3a0d050b05aae1373e03eb244
version             0.1.0-20260309
revision            0
categories-prepend  multimedia anime
platforms           any
license             MIT
maintainers         {@barracuda156 macos-powerpc.org:barracuda} \
                    openmaintainer
description         AnimeSnap helps you to identify the anime episode or even timestamp \
                    just from a screenshot of any scene from that episode
long_description    {*}${description}
checksums           rmd160  d8a39bf97ca5195f09403a035ac143250e128aec \
                    sha256  646a43b9afc45496a733c0ebe9e91739e800592a03c494c683bcdc94cb5a01ca \
                    size    673143
github.tarball_from archive
supported_archs     noarch

# Prefer Qt4 where it works, but avoid on arm64 and non-Darwin:
if {${os.platform} eq "darwin" && ${build_arch} in [list i386 ppc ppc64 x86_64]} {
    # Due to Qt4-related python deps.
    python.default_version  312

    # Notice, builds of pyqt4 against qt4-mac and qt4-mac-devel are binary-incompatible.
    depends_lib-append \
                    port:py${python.version}-pyqt4 \
                    port:py${python.version}-qt4py
} else {
    # Some dependencies do not have 3.13 subports yet.
    python.default_version  312

    depends_lib-append \
                    port:py${python.version}-pyqt5 \
                    port:py${python.version}-qtpy
}

python.pep517_backend   poetry

patchfiles          0001-Use-lower-case-module-name.patch

post-patch {
    system -W ${worksrcpath} "mv AnimeSnap animesnap"
}

depends_lib-append  port:py${python.version}-certifi \
                    port:py${python.version}-chardet \
                    port:py${python.version}-core-helpers \
                    port:py${python.version}-decorator \
                    port:py${python.version}-filetype \
                    port:py${python.version}-idna \
                    port:py${python.version}-packaging \
                    port:py${python.version}-qdarkstyle \
                    port:py${python.version}-requests \
                    port:py${python.version}-rich \
                    port:py${python.version}-setuptools \
                    port:py${python.version}-urllib3 \
                    port:py${python.version}-validators

# Allow using py${python.version}-urllib3-future port:
if {${python.version} >= 310} {
    depends_lib-replace \
                    port:py${python.version}-urllib3 \
                    path:${python.pkgd}/urllib3/__init__.py:py${python.version}-urllib3
}
