Fix python3 conditionals

This commit is contained in:
yatin 2019-03-04 19:49:41 +05:30
parent 723b05d994
commit c4fb9d89af

View File

@ -1,20 +1,20 @@
%global py2_incdir %(python2 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())')
%global py3_incdir %(python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())')
%global py2_libbuilddir %(python2 -c 'import sys; import sysconfig; print("lib.{p}-{v[0]}.{v[1]}".format(p=sysconfig.get_platform(), v=sys.version_info))')
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%global py3_incdir %(python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())')
%global py3_libbuilddir %(python3 -c 'import sys; import sysconfig; print("lib.{p}-{v[0]}.{v[1]}".format(p=sysconfig.get_platform(), v=sys.version_info))')
%endif
%global srcname pillow
# bootstrap building docs (pillow is required by docutils, docutils are
# required by sphinx; pillow build-requires sphinx)
%global with_docs 1
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%endif
Name: python-%{srcname}
Version: 5.4.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Python image processing library
# License: see http://www.pythonware.com/products/pil/license.htm
@ -46,7 +46,7 @@ BuildRequires: python2-sphinx_rtd_theme
%endif # with_docs
BuildRequires: python2-tkinter
%if %{with_python3}
%if 0%{?with_python3}
BuildRequires: python3-cffi
BuildRequires: python3-devel
BuildRequires: python3-numpy
@ -142,7 +142,7 @@ Provides: python2-imaging-qt = %{version}-%{release}
Qt %{srcname} image wrapper.
%if %{with_python3}
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Python 3 image processing library
%{?python_provide:%python_provide python3-%{srcname}}
@ -218,7 +218,7 @@ PYTHONPATH=$PWD/build/%py2_libbuilddir make -C docs html BUILDDIR=_build_py2 SPH
rm -f docs/_build_py2/html/.buildinfo
%endif # with_docs
%if %{with_python3}
%if 0%{?with_python3}
# Build Python 3 modules
%py3_build
@ -235,7 +235,7 @@ install -d %{buildroot}/%{py2_incdir}/Imaging
install -m 644 src/libImaging/*.h %{buildroot}/%{py2_incdir}/Imaging
%py2_install
%if %{with_python3}
%if 0%{?with_python3}
# Install Python 3 modules
install -d %{buildroot}/%{py3_incdir}/Imaging
install -m 644 src/libImaging/*.h %{buildroot}/%{py3_incdir}/Imaging
@ -252,7 +252,7 @@ pushd build/%py2_libbuilddir
PYTHONPATH=$PWD %{__python2} selftest.py
popd
%if %{with_python3}
%if 0%{?with_python3}
# Check Python 3 modules
ln -s $PWD/Images $PWD/build/%py3_libbuilddir/Images
cp -R $PWD/Tests $PWD/build/%py3_libbuilddir/Tests
@ -289,7 +289,7 @@ popd
%files -n python2-%{srcname}-qt
%{python2_sitearch}/PIL/ImageQt*
%if %{with_python3}
%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc README.rst CHANGES.rst
%license docs/COPYING
@ -325,6 +325,9 @@ popd
%changelog
* Mon Mar 04 2019 Yatin Karel <ykarel@redhat.com> - 5.4.1-3
- Fix python3 conditional
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild