## START: Set by rpmautospec
## (rpmautospec version 0.3.2)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global projname slack-sdk
%global srcname slack_sdk

# Missing test deps:
# * https://pypi.org/project/Flask-Sockets/
#   * depends on gevent-websocket, which is broken with Python 3 and
#     half-dead:
#     * https://gitlab.com/noppo/gevent-websocket/-/issues/24
#     * https://gitlab.com/noppo/gevent-websocket/-/issues/14
# * https://pypi.org/project/moto/
# Leaving the conditional skeleton here in case the situation improves...
%bcond_with tests

Name:           python-%{projname}
Version:        3.19.5
Release:        %autorelease
Summary:        Python Slack SDK

License:        MIT
URL:            https://slack.dev/python-slack-sdk/
Source0:        %{pypi_source %{srcname}}

BuildArch:      noarch

BuildRequires:  python3-devel

%global _description %{expand:
The Slack platform offers several APIs to build apps. Each Slack API delivers
part of the capabilities from the platform, so that you can pick just those
that fit for your needs. This SDK offers a corresponding package for each of
Slack’s APIs. They are small and powerful when used independently, and work
seamlessly when used together, too.}

%description %_description

%package     -n python3-%{projname}
Summary:        %{summary}

%description -n python3-%{projname} %_description

%prep
%autosetup -n %{srcname}-%{version}

# https://github.com/slackapi/python-slack-sdk/pull/1328
chmod -x README.md

%generate_buildrequires
%if %{with tests}
%pyproject_buildrequires -x optional -x testing
%else
%pyproject_buildrequires -x optional
%endif

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files slack slack_sdk

%check
%if %{with tests}
%python3 setup.py test
%else
%pyproject_check_import
%endif

%files -n python3-%{projname} -f %{pyproject_files}
%license LICENSE
%doc README.md

%changelog
* Sun Feb 12 2023 John Doe <packager@example.com> - 3.19.5-1
- Uncommitted changes