%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_py3 1
%endif
%global pkgname zodbpickle
Name: python-%{pkgname}
Version: 0.6.0
Release: 1%{?dist}
Summary: Fork of Python 2 pickle module for ZODB
# Code taken from the python 3 sources is covered by the Python license.
# Additions to that code are covered by the ZPLv2.1 license.
License: Python and ZPLv2.1
URL: https://pypi.python.org/pypi/%{pkgname}
Source0: https://pypi.python.org/packages/source/z/%{pkgname}/%{pkgname}-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python-nose
BuildRequires: python-test
%if 0%{?with_py3}
BuildRequires: python3-devel
BuildRequires: python3-nose
BuildRequires: python3-test
%endif
%global common_desc \
This package presents a uniform pickling interface for ZODB: \
- Under Python2, this package forks both Python 2.7's pickle and cPickle \
modules, adding support for the protocol 3 opcodes. It also provides \
a new subclass of bytes, zodbpickle.binary, which Python2 applications \
can use to pickle binary values such that they will be unpickled as \
bytes under Py3k. \
- Under Py3k, this package forks the pickle module (and the supporting C \
extension) from Python 3.2, Python 3.3, and Python 3.4. The fork adds \
support for the noload operations used by ZODB.
%description
%{common_desc}
%if 0%{?with_py3}
%package -n python3-%{pkgname}
Summary: Fork of Python 3 pickle module for ZODB
%description -n python3-%{pkgname}
%{common_desc}
%endif
%prep
%setup -q -c
# Remove prebuilt egg
rm -fr %{pkgname}-%{version}/src/%{pkgname}.egg-info
%if 0%{?with_py3}
# Prepare for a python3 build
cp -a %{pkgname}-%{version} python3-%{pkgname}-%{version}
%endif
%build
# Python 2 build
pushd %{pkgname}-%{version}
%{__python2} setup.py build
popd
%if 0%{?with_py3}
# Python 3 build
pushd python3-%{pkgname}-%{version}
%{__python3} setup.py build
popd
%endif
%install
# Python 2 install
pushd %{pkgname}-%{version}
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
rm -f %{buildroot}%{python2_sitearch}/%{pkgname}/*.c
rm -f %{buildroot}%{python2_sitearch}/%{pkgname}/pickle*_3*.py
rm -f %{buildroot}%{python2_sitearch}/%{pkgname}/tests/*_3*.py*
chmod 0755 %{buildroot}%{python2_sitearch}/%{pkgname}/*.so
popd
%if 0%{?with_py3}
# Python 3 install
pushd python3-%{pkgname}-%{version}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
rm -f %{buildroot}%{python3_sitearch}/%{pkgname}/*.c
rm -f %{buildroot}%{python3_sitearch}/%{pkgname}/pickle*_2.py
rm -fr %{buildroot}%{python3_sitearch}/%{pkgname}/tests/*_2.py*
rm -fr %{buildroot}%{python3_sitearch}/%{pkgname}/tests/__pycache__/*_2.cpy*
chmod 0755 %{buildroot}%{python3_sitearch}/%{pkgname}/*.so
popd
%endif
%check
# Python 2 tests
pushd %{pkgname}-%{version}
%{__python2} setup.py test
popd
%if 0%{?with_py3}
# Python 3 tests
pushd python3-%{pkgname}-%{version}
%{__python3} setup.py test
popd
%endif
%files
%license %{pkgname}-%{version}/LICENSE.txt
%{python2_sitearch}/%{pkgname}*
%if 0%{?with_py3}
%files -n python3-%{pkgname}
%license %{pkgname}-%{version}/LICENSE.txt
%{python3_sitearch}/%{pkgname}*
%endif
%changelog
* Tue Apr 14 2015 Jerry James <loganjerry@gmail.com> - 0.6.0-1
- New upstream version
- Drop upstreamed -python34 patch
* Sat Feb 21 2015 Jerry James <loganjerry@gmail.com> - 0.5.2-3
- Use license macro
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Mon Jun 9 2014 Jerry James <loganjerry@gmail.com> - 0.5.2-1
- Initial RPM