%bcond_with python2
%bcond_without python3
%global modname marshmallow
%global _docdir_fmt %{name}
Name: python-%{modname}
Version: 3.21.0
Release: %autorelease
Summary: Python library for converting complex datatypes to and from primitive types
License: MIT
URL: http://marshmallow.readthedocs.org/
Source0: https://github.com/marshmallow-code/marshmallow/archive/%{version}/%{modname}-%{version}.tar.gz
Patch0: ordered_set.patch
Patch1: versionwarning-disable.patch
# python3-autodocsumm is not in Fedora
# This is needed only for doc subpackage.
Patch2: disable-autodocsumm.patch
BuildArch: noarch
%global _description \
Marshmallow is a framework-agnostic library for converting complex datatypes,\
such as objects, to and from primitive Python datatypes.\
\
Marshmallow schemas can be used to:\
* Validate input data.\
* Deserialize input data to app-level objects.\
* Serialize app-level objects to primitive Python types. The serialized objects\
can then be rendered to standard formats such as JSON for use in an HTTP API.
%description %{_description}
%package doc
Summary: Documentation for %{name}
Provides: python3-%{modname}-doc = %{version}
Obsoletes: python3-%{modname}-doc < 2.8.0-1
BuildRequires: python3-sphinx
%description doc
Documentation for %{name}.
%if %{with python2}
%package -n python2-%{modname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
# for tests
BuildRequires: python2-pytest
BuildRequires: python2-pytz
BuildRequires: python2-ordered-set
BuildRequires: python2-dateutil
BuildRequires: python2-simplejson
Requires: python2-ordered-set
Recommends: python2-dateutil
Recommends: python2-simplejson
%description -n python2-%{modname} %{_description}
Python 2 version.
%endif
%if %{with python3}
%package -n python3-%{modname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
# for tests
BuildRequires: python3-pytest
BuildRequires: python3-pytz
BuildRequires: python3-ordered-set
BuildRequires: python3-dateutil
BuildRequires: python3-simplejson
BuildRequires: python3-sphinx-issues
Requires: python3-ordered-set
Recommends: python3-dateutil
Recommends: python3-simplejson
%description -n python3-%{modname} %{_description}
Python 3 version.
%endif
%prep
%autosetup -n %{modname}-%{version} -p1
# remove bundled library
# instead of orderedsett we patch code to usu python-ordered-set
rm -f ./marshmallow/orderedset.py
# unsupported theme option 'donate_url' given
sed -i -e "/donate_url/d" docs/conf.py
%build
%{?with_python2:%py2_build}
%{?with_python3:%py3_build}
sphinx-build -b html docs html
%install
%{?with_python2:%py2_install}
%{?with_python3:%py3_install}
rm -rf html/{.buildinfo,.doctrees}
%check
%{?with_python2:py.test-%{python2_version} -v --ignore tests/test_py3/}
%{?with_pythoN3:py.test-%{python3_version} -v}
%files doc
%license LICENSE
%doc html examples
%if %{with python2}
%files -n python2-%{modname}
%license LICENSE
%doc CHANGELOG.rst README.rst
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-*.egg-info/
%endif
%if %{with python3}
%files -n python3-%{modname}
%license LICENSE
%doc CHANGELOG.rst README.rst
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-*.egg-info/
%endif
%changelog
%autochangelog