Blob Blame History Raw
%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

%if 0%{?fedora}
%global with_python3 1
%endif

%global srcname regex

Name:           python-%{srcname}
Version:        2015.05.28
Release:        1%{?dist}
Summary:        Alternative regular expression module, to replace re
# see also https://code.google.com/p/mrab-regex-hg/issues/detail?id=124
License:        Python and CNRI
URL:            https://code.google.com/p/mrab-regex-hg
Source0:        https://pypi.python.org/packages/source/r/%{srcname}/%{srcname}-%{version}.tar.gz
BuildRequires:  python2-devel
BuildRequires:  /usr/bin/rst2html
%if 0%{?with_python3}
BuildRequires:  python3-devel
%endif # with_python3


%description
This new regex implementation is intended eventually to replace
Python's current re module implementation.

For testing and comparison with the current 're' module the new
implementation is in the form of a module called 'regex'.


%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary:        Alternative regular expression module, to replace re
Group:          Development/Languages

%description -n python3-%{srcname}
This new regex implementation is intended eventually to replace
Python's current re module implementation.

For testing and comparison with the current 're' module the new
implementation is in the form of a module called 'regex'.
%endif # with_python3


%prep
%setup -qc -n %{srcname}-%{version}
mv %{srcname}-%{version} python2

pushd python2

# will be rebuilt
rm docs/Features.html

popd

%if 0%{?with_python3}
cp -a python2 python3
%endif # with_python3


%build
pushd python2
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build

# rebuild the HTML doc
rst2html docs/Features.rst > docs/Features.html

popd

%if 0%{?with_python3}
pushd python3
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build

# rebuild the HTML doc
rst2html docs/Features.rst > docs/Features.html

popd
%endif # with_python3


%install
pushd python2
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
popd
%endif # with_python3


%files
%doc python2/README
%doc python2/docs/Features.html
%doc python2/docs/UnicodeProperties.txt
%{python2_sitearch}/*


%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc python3/README
%doc python3/docs/Features.html
%doc python3/docs/UnicodeProperties.txt
%{python3_sitearch}/*
%endif # with_python3


%changelog
* Fri May 29 2015 Thomas Moschny <thomas.moschny@gmx.de> - 2015.05.28-1
- Update to 2015.05.28.

* Sat May 23 2015 Thomas Moschny <thomas.moschny@gmx.de> - 2015.05.10-1
- Update to 2015.05.10.

* Sat Mar 21 2015 Thomas Moschny <thomas.moschny@gmx.de> - 2015.03.18-1
- Update to 2015.03.18.
- Apply updated Python packaging guidelines.

* Thu Jan  8 2015 Thomas Moschny <thomas.moschny@gmx.de> - 2014.12.24-1
- Update to 2014.12.24.

* Sun Dec 21 2014 Thomas Moschny <thomas.moschny@gmx.de> - 2014.12.15-1
- Update to 2014.12.15.

* Sat Dec 13 2014 Thomas Moschny <thomas.moschny@gmx.de> - 2014.11.14-1
- Update to 2014.11.14.
- Rebuild the HTML docs.
- Update License tag.
- Update upstream URL.

* Wed Oct 22 2014 Thomas Moschny <thomas.moschny@gmx.de> - 2014.10.09-1
- Initial version.