Blob Blame History Raw
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_py3 1
%endif

%global srcname zodbpickle

Name:           python-%{srcname}
Version:        0.6.0
Release:        4%{?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/%{srcname}
Source0:        https://pypi.python.org/packages/source/z/%{srcname}/%{srcname}-%{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}

%package -n python2-%{srcname}
Summary:        Fork of Python 3 pickle module for ZODB

%{?python_provide:%python_provide python2-%{srcname}}

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

%if 0%{?with_py3}
%package -n python3-%{srcname}
Summary:        Fork of Python 3 pickle module for ZODB

%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
%{common_desc}
%endif

%prep
%setup -q -c

# Remove prebuilt egg
rm -fr %{srcname}-%{version}/src/%{srcname}.egg-info

%if 0%{?with_py3}
# Prepare for a python3 build
cp -a %{srcname}-%{version} python3-%{srcname}-%{version}
%endif

%build
# Python 2 build
pushd %{srcname}-%{version}
%py2_build
popd

%if 0%{?with_py3}
# Python 3 build
pushd python3-%{srcname}-%{version}
%py3_build
popd
%endif

%install
# Python 2 install
pushd %{srcname}-%{version}
%py2_install
rm -f %{buildroot}%{python2_sitearch}/%{srcname}/*.c
rm -f %{buildroot}%{python2_sitearch}/%{srcname}/pickle*_3*.py
rm -f %{buildroot}%{python2_sitearch}/%{srcname}/tests/*_3*.py*
chmod 0755 %{buildroot}%{python2_sitearch}/%{srcname}/*.so
popd

%if 0%{?with_py3}
# Python 3 install
pushd python3-%{srcname}-%{version}
%py3_install
rm -f %{buildroot}%{python3_sitearch}/%{srcname}/*.c
rm -f %{buildroot}%{python3_sitearch}/%{srcname}/pickle*_2.py
rm -fr %{buildroot}%{python3_sitearch}/%{srcname}/tests/*_2.py*
rm -fr %{buildroot}%{python3_sitearch}/%{srcname}/tests/__pycache__/*_2.cpy*
chmod 0755 %{buildroot}%{python3_sitearch}/%{srcname}/*.so
popd
%endif

%check
# Python 2 tests
pushd %{srcname}-%{version}
%{__python2} setup.py test
popd

%if 0%{?with_py3}
# Python 3 tests
pushd python3-%{srcname}-%{version}
%{__python3} setup.py test
popd
%endif
 
%files -n python2-%{srcname}
%license %{srcname}-%{version}/LICENSE.txt
%{python2_sitearch}/%{srcname}*

%if 0%{?with_py3}
%files -n python3-%{srcname}
%license %{srcname}-%{version}/LICENSE.txt
%{python3_sitearch}/%{srcname}*
%endif

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Feb  1 2016 Jerry James <loganjerry@gmail.com> - 0.6.0-3
- Comply with latest python packaging guidelines

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* 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