Blob Blame History Raw
%global srcname     fastavro
%global sum     Fast Avro for Python
%global _description    Apache Avro is a data serialization system. The current \
Python avro package is packed with features but dog slow. fastavro is less \
feature complete than avro, however it's much faster.

Name:       python-%{srcname}
Version:    0.17.3
Release:    2%{?dist}
Summary:    %{sum}

# https://github.com/tebeka/fastavro/issues/60
# Apache avro is under ASL 2.0
# https://avro.apache.org/docs/1.8.2/api/cpp/html/ResolvingReader_8hh_source.html etc
License:    ASL 2.0
URL:        https://github.com/tebeka/%{srcname}
Source0:    https://github.com/tebeka/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz

%description
%{_description}

%package -n python2-%{srcname}
Summary:        %{sum}
BuildRequires:  python2-devel
BuildRequires:  %{py2_dist setuptools}
BuildRequires:  %{py2_dist Cython}
BuildRequires:  %{py2_dist pytest}
BuildRequires:  %{py2_dist sphinx}
Requires:       %{py2_dist python-snappy}
Requires:       %{py2_dist ujson}

%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
%{_description}



%package -n python3-%{srcname}
Summary:        %{sum}
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist setuptools}
BuildRequires:  %{py3_dist Cython}
BuildRequires:  %{py3_dist pytest}
Requires:       %{py3_dist python-snappy}
Requires:       %{py3_dist ujson}
%{?python_provide:%python_provide python3-%{srcname}}

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

%package doc
Summary:        %{sum}
%description doc
Documentation for %{name}.

%prep
%autosetup -n %{srcname}-%{version}
rm -rf *.egg-info
# Remove cython constraint - the marked issue has been solved in Cython
sed -i "s/Cython>=.*',/Cython',/" setup.py
# We don't run the flake8 and manifest check tests so we remove this from the
# setup.py file to prevent it from trying to fetch stuff from pypi
sed -i "/tests_require=/d" setup.py

%build
%py2_build
%py3_build

pushd docs
    PYTHONPATH=../ make html man
    pushd _build/html
        rm .buildinfo -f || exit -1
        sed -i 's/\r$//' objects.inv
        iconv -f iso8859-1 -t utf-8 objects.inv > objects.inv.conv && mv -fv objects.inv.conv objects.inv
    popd
popd


%install
%py2_install
%py3_install

# Install man page
install -v -p -D -m 0644 docs/_build/man/%{srcname}.1 %{buildroot}%{_mandir}/man1/%{srcname}.1 || exit -1

# Fail only on i686 for some reason. Issue filed upstream:
# https://github.com/tebeka/fastavro/issues/147
# %check
# %{__python2} setup.py build_ext --inplace
# PYTHONPATH=. pytest-2  tests
#
# %{__python3} setup.py build_ext --inplace
# PYTHONPATH=. pytest-3 tests

%files -n python2-%{srcname}
%license NOTICE.txt
%{python2_sitearch}/%{srcname}-%{version}-py?.?.egg-info
%{python2_sitearch}/%{srcname}/

%files -n python3-%{srcname}
%license NOTICE.txt
%{python3_sitearch}/%{srcname}-%{version}-py?.?.egg-info
%{python3_sitearch}/%{srcname}/
%{_bindir}/%{srcname}
%{_mandir}/man1/%{srcname}.*

%files doc
%doc README.md
%license NOTICE.txt
%doc docs/_build/html

%changelog
* Mon Jan 22 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.17.3-2
- Disable tests temporarily - fail on i686 only. Issue filed upstream.

* Sun Jan 21 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.17.3-1
- Update for review (rhbz#1534787)
- Update to latest upstream release
- Generate separate doc subpackage for docs
- Install man page
- Rectify license
- Fix tests

* Mon Jan 15 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.17.1-1
- Initial build