Create explicit python2 subpackage.

epel8
Ralph Bean 9 years ago
parent 3c68e82397
commit 7da96d1546

@ -8,6 +8,7 @@
%filter_provides_in %{python2_sitearch}/zope/interface/.*\.so$
%filter_setup
%{!?py2ver: %global py2ver %(%{?__python2} -c 'import sys; print(sys.version[0:3])' 2>/dev/null)}
%if 0%{?fedora}
%global with_python3 1
%{!?py3ver: %global py3ver %(%{?__python3} -c 'import sys; print(sys.version[0:3])' 2>/dev/null)}
@ -16,30 +17,35 @@
Name: python-zope-interface
Version: 4.1.3
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Zope 3 Interface Infrastructure
Group: Development/Libraries
License: ZPLv2.1
URL: http://pypi.python.org/pypi/zope.interface
Source0: http://pypi.python.org/packages/source/z/zope.interface/zope.interface-%{version}.tar.gz
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-nose
BuildRequires: python-zope-event
# since F14
Obsoletes: python-zope-filesystem <= 1-8
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-nose
BuildRequires: python3-zope-event
%endif
%description
Interfaces are a mechanism for labeling objects as conforming to a given API
or contract.
Requires: python-zope-event
This is a separate distribution of the zope.interface package used in Zope 3.
%package -n python2-zope-interface
Summary: Zope 3 Interface Infrastructure
Group: Development/Libraries
%{?python_provide:%python_provide python2-zope-interface}
%description
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-nose
BuildRequires: python2-zope-event
Requires: python2-zope-event
# since F14
Obsoletes: python-zope-filesystem <= 1-8
%description -n python2-zope-interface
Interfaces are a mechanism for labeling objects as conforming to a given API
or contract.
@ -49,6 +55,12 @@ This is a separate distribution of the zope.interface package used in Zope 3.
%package -n python3-zope-interface
Summary: Zope 3 Interface Infrastructure
Group: Development/Libraries
%{?python_provide:%python_provide python3-zope-interface}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-nose
BuildRequires: python3-zope-event
Requires: python3-zope-event
@ -64,37 +76,28 @@ This is a separate distribution of the zope.interface package used in Zope 3.
rm -rf %{modname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
CFLAGS="%{optflags}" %{__python2} setup.py build
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="%{optflags}" %{__python3} setup.py build
popd
%py3_build
%endif
%install
# python3 block
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
%py3_install
# Will put docs in %%{_docdir} instead
%{__rm} -f %{buildroot}%{python3_sitearch}/zope/interface/{,tests/}*.txt
# C files don't need to be packaged
%{__rm} -f %{buildroot}%{python3_sitearch}/zope/interface/_zope_interface_coptimizations.c
popd
%endif
# do it again for python2
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
%py2_install
# Will put docs in %%{_docdir} instead
%{__rm} -f %{buildroot}%{python2_sitearch}/zope/interface/{,tests/}*.txt
@ -103,17 +106,14 @@ popd
%{__rm} -f %{buildroot}%{python2_sitearch}/zope/interface/_zope_interface_coptimizations.c
%check
PYTHONPATH=$(pwd) nosetests
PYTHONPATH=$(pwd) nosetests-%{py2ver}
%if 0%{?with_python3}
pushd %{py3dir}
PYTHONPATH=$(pwd) nosetests-%{py3ver}
popd
%endif
%files
%defattr(-,root,root,-)
%doc README.rst LICENSE.txt CHANGES.rst COPYRIGHT.txt docs/
%files -n python2-zope-interface
%doc README.rst CHANGES.rst COPYRIGHT.txt docs/
%license LICENSE.txt
%{python2_sitearch}/zope/interface/
# Co-own %%{python2_sitearch}/zope/
%dir %{python2_sitearch}/zope/
@ -124,7 +124,8 @@ popd
%if 0%{?with_python3}
%files -n python3-zope-interface
%doc README.rst LICENSE.txt CHANGES.rst COPYRIGHT.txt docs/
%doc README.rst CHANGES.rst COPYRIGHT.txt docs/
%license LICENSE.txt
%{python3_sitearch}/zope/interface/
# Co-own %%{python3_sitearch}/zope/
%dir %{python3_sitearch}/zope/
@ -135,6 +136,10 @@ popd
%endif
%changelog
* Tue Jun 28 2016 Ralph Bean <rbean@redhat.com> - 4.1.3-2
- Modernize python macros.
- Provide an explicit python2 subpackage.
* Mon Oct 05 2015 Ralph Bean <rbean@redhat.com> - 4.1.3-1
- new version

Loading…
Cancel
Save