fbo / rpms / python-re2

Forked from rpms/python-re2 4 years ago
Clone
Blob Blame History Raw
%{!?_licensedir: %global license %%doc}

%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%global commit 382bb743f16722b582cc2bac8fc08ff121dec20e
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global checkout 20150211git%{shortcommit}

%global gh_owner axiak
%global gh_project pyre2

%global modname re2



Name:               python-re2
Version:            0.2.20
Release:            2.%{checkout}%{?dist}
Summary:            Python wrapper for Google's RE2 using Cython

Group:              Development/Libraries
License:            BSD
URL:                http://pypi.python.org/pypi/re2
Source0:            https://github.com/%{gh_owner}/%{gh_project}/archive/%{commit}/%{gh_project}-%{commit}.tar.gz

BuildRequires:      python2-devel
BuildRequires:      re2-devel
BuildRequires:      Cython

Requires:           re2

%description
python-re2 is a Python extension that wraps Google's RE2 regular expression
library.

This version of python-re2 is similar to the one you'd find at facebook's
github repository except that the stated goal of this version is to be a
drop-in replacement for the stdlib re module.

%prep
%setup -q -n %{gh_project}-%{commit}

# Strip rpath stuff
sed -i 's/runtime_library_dirs/#runtime_library_dirs/' setup.py

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py --cython build

%install
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

## Tests don't run currently
#%%check
#%%{__python2} setup.py test

%files
%doc README.rst AUTHORS CHANGELIST
%license LICENSE
%{python2_sitearch}/%{modname}.so
%{python2_sitearch}/%{modname}-%{version}*.egg-info

%changelog
* Thu Feb 12 2015 Ralph Bean <rbean@redhat.com> - 0.2.20-2.20150211git382bb74
- Move to a post-release git checkout to include various bugfixes.
- Remove rpath settings.
- Use Cython for the build.

* Wed Feb 11 2015 Ralph Bean <rbean@redhat.com> - 0.2.20-1
- initial package for Fedora