Ship python2-pyxdg

- Enable python 3 builds for EPEL
- Use %license
- Modernize spec
This commit is contained in:
Orion Poplawski 2016-11-21 10:52:41 -07:00
parent a5dffc7b2e
commit f0ec8c3cb5

View File

@ -1,12 +1,8 @@
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
Name: pyxdg
Version: 0.25
Release: 9%{?dist}
Release: 10%{?dist}
Summary: Python library to access freedesktop.org standards
Group: Development/Libraries
License: LGPLv2
@ -17,22 +13,34 @@ Patch0: pyxdg-0.25-find-first-mimetype-match.patch
# https://bugs.freedesktop.org/show_bug.cgi?id=73878
Patch1: pyxdg-0.25-CVE-2014-1624.patch
BuildArch: noarch
# These are needed for the nose tests.
BuildRequires: python-nose, hicolor-icon-theme
BuildRequires: python2-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif # if with_python3
%description
PyXDG is a python library to access freedesktop.org standards
%package -n python2-pyxdg
Summary: Python2 library to access freedesktop.org standards
Group: Development/Libraries
BuildRequires: python2-devel
# These are needed for the nose tests.
BuildRequires: python-nose, hicolor-icon-theme
%{?python_provide:%python_provide python2-pyxdg}
Provides: pyxdg = %{version}-%{release}
Obsoletes: pyxdg < 0.25-10
%description -n python2-pyxdg
PyXDG is a python library to access freedesktop.org standards. This
package contains a Python 2 version of PyXDG.
%if 0%{?with_python3}
%package -n python3-pyxdg
%package -n python%{python3_pkgversion}-pyxdg
Summary: Python3 library to access freedesktop.org standards
Group: Development/Libraries
BuildRequires: python%{python3_pkgversion}-devel
# These are needed for the nose tests.
BuildRequires: python%{python3_pkgversion}-nose
%{?python_provide:%python_provide python%{python3_pkgversion}-pyxdg}
%description -n python3-pyxdg
%description -n python%{python3_pkgversion}-pyxdg
PyXDG is a python library to access freedesktop.org standards. This
package contains a Python 3 version of PyXDG.
%endif # with_python3
@ -42,60 +50,48 @@ package contains a Python 3 version of PyXDG.
%patch0 -p1 -b .pngfix
%patch1 -p1 -b .CVE-2014-1624
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'
%build
%{__python} setup.py build
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%py3_build
%endif # with_python3
%install
rm -rf $RPM_BUILD_ROOT
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root=$RPM_BUILD_ROOT
popd
%py3_install
%endif # with_python3
%{__python} setup.py install --skip-build --root=$RPM_BUILD_ROOT
%py2_install
%check
nosetests
nosetests-%{python2_version}
%if 0%{?with_python3}
pushd %{py3dir}
nosetests
popd
nosetests-%{python3_version}
%endif # with_python3
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog README TODO
%files -n python2-pyxdg
%license COPYING
%doc AUTHORS ChangeLog README TODO
%{python_sitelib}/xdg
%{python_sitelib}/pyxdg-*.egg-info
%if 0%{?with_python3}
%files -n python3-pyxdg
%doc AUTHORS COPYING ChangeLog README TODO
%files -n python%{python3_pkgversion}-pyxdg
%license COPYING
%doc AUTHORS ChangeLog README TODO
%{python3_sitelib}/xdg
%{python3_sitelib}/pyxdg-*.egg-info
%endif #with_python3
%changelog
* Mon Nov 21 2016 Orion Poplawski <orion@cora.nwra.com> - 0.25-10
- Ship python2-pyxdg
- Enable python 3 builds for EPEL
- Use %%license
- Modernize spec
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.25-9
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages