Blob Blame History Raw
%global srcname pypillowfight

Name:           python-%{srcname}
Version:        0.2.2
Release:        2%{?dist}
Summary:        Various image processing algorithms

License:        GPLv2+
URL:            https://github.com/jflesch/libpillowfight
# PyPI tarball does not include tests.
#Source0:        https://files.pythonhosted.org/packages/source/p/%%{srcname}/%%{srcname}-%%{version}.tar.gz
Source0:        https://github.com/openpaperwork/libpillowfight/archive/%{version}/%{srcname}-%{version}.tar.gz
# https://github.com/openpaperwork/libpillowfight/issues/9
Patch0001:      0001-Python-Make-sure-the-image-are-returned-in-RGBA-only.patch
# https://github.com/openpaperwork/libpillowfight/pull/10
Patch0002:      0002-Fix-ACE-when-rows-is-not-divisible-by-CPU-count.patch
Source1:        black_border_problem_all.jpg

%global _description \
Library containing various image processing algorithms: Automatic Color \
Equalization, Unpaper's algorithms, Stroke Width Transformation, etc.

%description %{_description}

%package -n     python3-%{srcname}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{srcname}}

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-nose >= 1.0
BuildRequires:  python3-pillow

Requires:       python3-pillow%{?_isa}

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


%prep
%autosetup -n libpillowfight-%{version} -p1
cp -p %SOURCE1 tests/data/black_border_problem_all.jpg

# Remove bundled egg-info
rm -rf %{srcname}.egg-info


%build
%py3_build


%install
%py3_install


%check
# https://github.com/openpaperwork/libpillowfight/issues/11
%ifarch i686
PYTHONPATH=%{buildroot}%{python3_sitearch} \
    nosetests-3 -v -P tests -e test_swt2
%else
%ifarch ppc64le
PYTHONPATH=%{buildroot}%{python3_sitearch} \
    nosetests-3 -v -P tests -I 'tests_swt.py' -I 'tests_canny.py'
%else
PYTHONPATH=%{buildroot}%{python3_sitearch} \
    nosetests-3 -v -P tests
%endif
%endif


%files -n python3-%{srcname}
%license LICENSE
%doc README.md
%{python3_sitearch}/pillowfight
%{python3_sitearch}/%{srcname}-%{version}-py?.?.egg-info


%changelog
* Sun Dec 31 2017 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.2.2-2
- Fix license and requires.

* Wed Dec 27 2017 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.2.2-1
- Initial package.