# -*- 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                maestral
categories          sysutils python
license             MIT
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
description         Light-weight and open-source Dropbox client for macOS and Linux
long_description    Maestral is an open-source Dropbox client written in Python. \
                    The project’s main goal is to provide a client for platforms \
                    and file systems that are no longer directly supported by Dropbox.
supported_archs     noarch
platforms           {darwin any}

# We want to have GUI, but pyqt4 is broken with python 3.11:
# https://bugzilla.redhat.com/show_bug.cgi?id=2062145
# Set the custom Python first, otherwise we get wrong dependencies.
# Below the default is changed to Python 3.12,
# unless we are on macOS < 11.
python.default_version 310

if {${os.platform} eq "darwin" && ${os.major} < 11} {
    # Version for old systems; keep pegged until/unless a newer it fixed.
    # Notice, it should be compatible with py-watchdog version. Related issues:
    # https://github.com/samschott/maestral/issues/997
    # https://github.com/samschott/maestral-qt/issues/28
    # https://github.com/gorakhargosh/watchdog/issues/1021
    github.setup    samschott maestral 1.3.1 v
    revision        0
    checksums       rmd160  a63f51eae443f929bc99f2023ac58667dde644ca \
                    sha256  6427f13256bf970eeaea5d6d37489cf8d185da614997a46324d9d36f0f8f830e \
                    size    6709092
    github.tarball_from archive

    depends_lib-append \
                    port:py${python.version}-alembic \
                    port:py${python.version}-bugsnag \
                    port:py${python.version}-sdnotify \
                    port:py${python.version}-sqlalchemy
} else {
    github.setup    samschott maestral 1.9.4 v
    revision        0
    checksums       rmd160  a9d295c472694a4120573854ee7d2fe35d82a533 \
                    sha256  bb03ff59418a35786ef1c5a5ac0c66bb67390fdab8ebee011f1f8ba151677789 \
                    size    8126850
    github.tarball_from archive

    python.default_version 312

    depends_lib-append \
                    port:py${python.version}-desktop-notifier \
                    port:py${python.version}-rich \
                    port:py${python.version}-typing_extensions
}

depends_build-append \
                    port:py${python.version}-wheel
depends_lib-append  port:py${python.version}-alembic \
                    port:py${python.version}-bugsnag \
                    port:py${python.version}-click \
                    port:py${python.version}-dropbox \
                    port:py${python.version}-fasteners \
                    port:py${python.version}-keyring \
                    port:py${python.version}-keyrings.alt \
                    port:py${python.version}-packaging \
                    port:py${python.version}-pathspec \
                    port:py${python.version}-Pyro5 \
                    port:py${python.version}-requests \
                    port:py${python.version}-survey \
                    port:py${python.version}-watchdog

if {${os.platform} eq "darwin"} {
    depends_lib-append \
                    port:py${python.version}-rubicon-objc
} else {
    depends_lib-append \
                    py${python.version}-dbus_next
}

depends_lib-append  port:py${python.version}-pytest \
                    port:py${python.version}-pytest-benchmark \
                    port:py${python.version}-pytest-cov \
                    port:py${python.version}-pytest-rerunfailures

# Some tests may fail: https://github.com/samschott/maestral/issues/1001
test.run            yes
