e21f96d
%global pypi_name fasjson-client
353caa2
%global pypi_underscore_name %{lua:s = string.gsub(rpm.expand("%pypi_name"), "-", "_"); print(s)}
e21f96d
77b69f8
# EL8 doesn't know the __default_python3_pkgversion macro
77b69f8
%if ! 0%{?__default_python3_pkgversion:1}
e610750
%global __default_python3_pkgversion %(%__python3 -c 'import sys; print(".".join(str(d) for d in sys.version_info[:2]))' || echo 3)
77b69f8
%endif
77b69f8
77b69f8
%define py3verdist() python%{__default_python3_pkgversion}dist(%1)
77b69f8
e21f96d
%if ! 0%{?rhel} || 0%{?rhel} >= 9
e21f96d
%bcond_without tests
e21f96d
%else
e21f96d
%bcond_with tests
e21f96d
%endif
e21f96d
e21f96d
Name:           python-%{pypi_name}
2cdcbcf
Version:        1.0.5
1f15597
Release:        %autorelease
e21f96d
Summary:        An OpenAPI client for FASJSON
e21f96d
e21f96d
License:        LGPLv3+
e21f96d
URL:            https://github.com/fedora-infra/fasjson-client
e21f96d
Source0:        %{pypi_source}
e21f96d
BuildArch:      noarch
e21f96d
a7a0ee6
# Split off fasjson-client into subpackage
a7a0ee6
Obsoletes:      python3-fasjson-client < 0.1.1
a7a0ee6
e21f96d
BuildRequires:  python3-devel
77b69f8
BuildRequires:  %{py3verdist setuptools}
e21f96d
# runtime
77b69f8
BuildRequires:  (%{py3verdist bravado} >= 10.6 with %{py3verdist bravado} < 12)
5389600
BuildRequires:  (%{py3verdist click} >= 6.7 with %{py3verdist click} < 9)
2cdcbcf
BuildRequires:  (%{py3verdist cryptography} >= 2.3 with %{py3verdist cryptography} < 37)
77b69f8
BuildRequires:  (%{py3verdist gssapi} >= 1.5.1 with %{py3verdist gssapi} < 2)
77b69f8
BuildRequires:  (%{py3verdist requests} >= 2.20.0 with %{py3verdist requests} < 3)
77b69f8
BuildRequires:  (%{py3verdist requests-gssapi} >= 1.2.1 with %{py3verdist requests-gssapi} < 2)
39493c7
%if %{with tests}
77b69f8
BuildRequires:  (%{py3verdist toml} >= 0.10.1 with %{py3verdist toml} < 0.11)
39493c7
%else
39493c7
# EL <= 8
77b69f8
BuildRequires:  (%{py3verdist toml} >= 0.10.0 with %{py3verdist toml} < 0.11)
39493c7
%endif
e21f96d
# unit tests
e21f96d
%if %{with tests}
77b69f8
BuildRequires:  (%{py3verdist coverage} >= 5.0.3 with %{py3verdist coverage} < 6)
77b69f8
BuildRequires:  (%{py3verdist pytest} >= 4.6.11 with %{py3verdist pytest} < 7)
9be5518
BuildRequires:  (%{py3verdist pytest-cov} >= 2.8.1 with %{py3verdist pytest-cov} < 4)
77b69f8
BuildRequires:  (%{py3verdist pytest-mock} >= 1.10.4 with %{py3verdist pytest-mock} < 4)
77b69f8
BuildRequires:  (%{py3verdist requests-mock} >= 1.7 with %{py3verdist requests-mock} < 2)
e21f96d
%endif
e21f96d
d9a2404
%description
d9a2404
A python client library for the FASJSON API.
d9a2404
d9a2404
%package -n     python3-%{pypi_name}
d9a2404
Summary:        %{summary}
d9a2404
%{?python_provide:%python_provide python3-%{pypi_name}}
d9a2404
365716c
%if 0%{?rhel} && 0%{?rhel} < 9
d9a2404
# Undefined deps of deps in EL8
365716c
# (-> bravado-core, -> swagger-spec-validator) -> jsonschema
77b69f8
Requires:       %{py3verdist attrs}
77b69f8
Requires:       %{py3verdist idna}
77b69f8
Requires:       %{py3verdist jsonpointer}
77b69f8
Requires:       %{py3verdist rfc3987}
77b69f8
Requires:       %{py3verdist setuptools}
77b69f8
Requires:       %{py3verdist six}
77b69f8
Requires:       %{py3verdist strict-rfc3339}
77b69f8
Requires:       %{py3verdist webcolors}
365716c
%endif
e21f96d
e21f96d
%description -n python3-%{pypi_name}
e21f96d
A python client library for the FASJSON API.
e21f96d
353caa2
%{?python_extras_subpkg:%python_extras_subpkg -n python3-%{pypi_name} -i %{python3_sitelib}/%{pypi_underscore_name}*.egg-info cli}
353caa2
353caa2
%package -n     fasjson-client
353caa2
Summary:        %{summary} - CLI
353caa2
Requires:       python3-%{pypi_name}%{?python_extras_subpkg:+cli} = %{version}-%{release}
a7a0ee6
Obsoletes:      python3-fasjson-client < 0.1.1
353caa2
319865f
%if 0%{?rhel} && 0%{?rhel} < 9
77b69f8
Requires:       %{py3verdist click}
77b69f8
Requires:       %{py3verdist cryptography}
319865f
%endif
319865f
353caa2
%description -n fasjson-client
353caa2
A command line interface for the FASJSON API.
e21f96d
e21f96d
%prep
e21f96d
%autosetup -n %{pypi_name}-%{version}
e21f96d
e21f96d
%build
e21f96d
%py3_build
e21f96d
e21f96d
%install
e21f96d
%py3_install
e21f96d
e21f96d
%if %{with tests}
e21f96d
%check
e21f96d
%{__python3} -m pytest -v
e21f96d
%endif
e21f96d
e21f96d
%files -n python3-%{pypi_name}
e21f96d
%license LICENSE
e21f96d
%doc README.md
e21f96d
%{python3_sitelib}/fasjson_client
e21f96d
%{python3_sitelib}/fasjson_client-%{version}-py%{python3_version}.egg-info
e21f96d
353caa2
%files -n fasjson-client
353caa2
%license LICENSE
353caa2
%{_bindir}/fasjson-client
353caa2
e21f96d
e21f96d
%changelog
1f15597
%autochangelog