Blob Blame Raw
%global srcname rebulk

Name:           python-%{srcname}
Version:        0.9.0
Release:        4%{?dist}
Summary:        ReBulk is a python library that performs advanced searches in strings
# Everything licensed as MIT, except:
# rebulk/toposort.py: Apache (v2.0)
# rebulk/test/test_toposort.py: Apache (v2.0)
License:        MIT and ASL 2.0
URL:            https://github.com/Toilal/rebulk
Source:         https://github.com/Toilal/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
BuildArch:      noarch
BuildRequires:  python2-devel 
BuildRequires:  python3-devel 
BuildRequires:  python2-pytest-runner
BuildRequires:  python3-pytest-runner
BuildRequires:  python2-six
BuildRequires:  python3-six

%global _description\
ReBulk is a python library that performs advanced searches in strings that\
would be hard to implement using re module or String methods only.\
\
It includes some features like Patterns, Match, Rule that allows developers\
to build a custom and complex string matcher using a readable and\
extendable API.

%description %_description

%package -n python2-%{srcname}
Summary:        %summary
%{?python_provide:%python_provide python2-%{srcname}}
Requires:       python2-six

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

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

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

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

%build
%py2_build
%py3_build

%install
%py2_install
# Remove shebang from Python2 libraries
for lib in `find %{buildroot}%{python2_sitelib} -name "*.py"`; do
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
 touch -r $lib $lib.new &&
 mv $lib.new $lib
done
%py3_install
# Remove shebang from Python3 libraries
for lib in `find %{buildroot}%{python3_sitelib} -name "*.py"`; do
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
 touch -r $lib $lib.new &&
 mv $lib.new $lib
done

%check
%{__python2} setup.py test
%{__python3} setup.py test

%files -n python2-%{srcname}
%doc README.rst
%license  LICENSE
%{python2_sitelib}/%{srcname}
%{python2_sitelib}/%{srcname}-%{version}-py*.egg-info

%files -n python3-%{srcname}
%doc README.rst
%license LICENSE
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py*.egg-info

%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Aug 29 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.9.0-3
- Simplify Source URL
- Remove shebang from libraries
- Some files licensed as ASL 2.0

* Tue Aug 29 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.9.0-2
- Require python-six

* Mon Aug 28 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.9.0-1
- Initial RPM release