From 1579f94dc0a1d9756ffb8a64fbee309396992794 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 31 Dec 2016 16:11:47 +0100 Subject: [PATCH] Modernize spec Signed-off-by: Igor Gnatenko --- python-mutagen.spec | 153 +++++++++++++++++++------------------------- sources | 2 +- 2 files changed, 68 insertions(+), 87 deletions(-) diff --git a/python-mutagen.spec b/python-mutagen.spec index 618d291..63e46a9 100644 --- a/python-mutagen.spec +++ b/python-mutagen.spec @@ -1,137 +1,118 @@ -%global realname mutagen -# Share doc between python- and python3- +%global modname mutagen +# Share doc between python2- and python3- %global _docdir_fmt %{name} -%if 0%{?fedora} -%bcond_without python3 -%else +%if 0%{?rhel} && 0%{?rhel} <= 7 %bcond_with python3 +%else +%bcond_without python3 %endif -Name: python-%{realname} +Name: python-%{modname} Version: 1.36 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Mutagen is a Python module to handle audio meta-data -Group: Development/Languages -License: GPLv2 -URL: https://bitbucket.org/lazka/mutagen/overview -Source0: https://bitbucket.org/lazka/mutagen/downloads/mutagen-%{version}.tar.gz +License: GPLv2+ +URL: https://github.com/quodlibet/mutagen +Source0: %{url}/archive/release-%{version}/%{modname}-%{version}.tar.gz BuildArch: noarch + +%global _description \ +Mutagen is a Python module to handle audio meta-data. It supports\ +reading ID3 (all versions), APEv2, FLAC, and Ogg Vorbis/FLAC/Theora.\ +It can write ID3v1.1, ID3v2.4, APEv2, FLAC, and Ogg Vorbis/FLAC/Theora\ +comments. It can also read MPEG audio and Xing headers, FLAC stream\ +info blocks, and Ogg Vorbis/FLAC/Theora stream headers. Finally, it\ +includes a module to handle generic Ogg bit-streams. + +%description %{_description} + +%package -n python2-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python2-%{modname}} BuildRequires: python2-devel BuildRequires: python2-pytest -BuildRequires: python2-sphinx + +%description -n python2-%{modname} %{_description} + +Python 2 version. + %if %{with python3} +%package -n python3-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{modname}} BuildRequires: python3-devel BuildRequires: python3-pytest -%endif -%description -Mutagen is a Python module to handle audio meta-data. It supports -reading ID3 (all versions), APEv2, FLAC, and Ogg Vorbis/FLAC/Theora. -It can write ID3v1.1, ID3v2.4, APEv2, FLAC, and Ogg Vorbis/FLAC/Theora -comments. It can also read MPEG audio and Xing headers, FLAC stream -info blocks, and Ogg Vorbis/FLAC/Theora stream headers. Finally, it -includes a module to handle generic Ogg bit-streams. +%description -n python3-%{modname} %{_description} + +Python 3 version. +%endif %package doc Summary: Documentation for python-mutagen +BuildRequires: %{_bindir}/sphinx-build %description doc Contains the html documentation for python mutagen. -%if %{with python3} -%package -n python3-%{realname} -Summary: Mutagen is a Python module to handle audio meta-data - -%description -n python3-%{realname} -Mutagen is a Python module to handle audio meta-data. It supports -reading ID3 (all versions), APEv2, FLAC, and Ogg Vorbis/FLAC/Theora. -It can write ID3v1.1, ID3v2.4, APEv2, FLAC, and Ogg Vorbis/FLAC/Theora -comments. It can also read MPEG audio and Xing headers, FLAC stream -info blocks, and Ogg Vorbis/FLAC/Theora stream headers. Finally, it -includes a module to handle generic Ogg bit-streams. -%endif - %prep -%setup -q -n %{realname}-%{version} - -%if %{with python3} -rm -rf %{py3dir} -cp -a . %{py3dir} -%endif +%autosetup -n %{modname}-release-%{version} %build -%{__python} setup.py build - -pushd docs -make -popd - +%py2_build %if %{with python3} -pushd %{py3dir} -%{__python3} setup.py build -popd +%py3_build %endif +sphinx-build -b html -n docs docs/_build + %install +%py2_install %if %{with python3} -pushd %{py3dir} -%{__python3} setup.py install --skip-build --root %{buildroot} -popd -for file in mid3cp mid3iconv mid3v2 moggsplit mutagen-inspect mutagen-pony ; do -mv %{buildroot}%{_bindir}/$file ./$file.py3 -done +%py3_install %endif -%{__python} setup.py install --skip-build --root %{buildroot} -%{__install} -d %{buildroot}%{_mandir}/man1 -%{__install} -p -m 0644 man/*.1 %{buildroot}%{_mandir}/man1 +%{__install} -D -p -m 0644 man/*.1 %{buildroot}%{_mandir}/man1 -%if %{with python3} -for file in mid3cp mid3iconv mid3v2 moggsplit mutagen-inspect mutagen-pony ; do -mv ./$file.py3 %{buildroot}%{_bindir}/$file -done -%endif +# Remove hidden files +rm -rf docs/_build/{.buildinfo,.doctrees} %check # Without this the testsuite fails with # RuntimeError: This test suite needs a unicode locale encoding. Try setting LANG=C.UTF-8 -# Hopefully all builders have this locale installed/configured -export LANG=en_US.UTF-8 -%{__python} setup.py test - +export LANG=C.UTF-8 +%{__python2} setup.py test %if %{with python3} -pushd %{py3dir} %{__python3} setup.py test %endif -%files -%defattr(-,root,root,-) -%doc COPYING NEWS README.rst -%if !%{with python3} -%{_bindir}/m* -%{_mandir}/*/* +%files -n python2-%{modname} +%license COPYING +%doc NEWS README.rst +%{python2_sitelib}/%{modname}-*.egg-info +%{python2_sitelib}/%{modname}/ + +%if %{with python3} +%files -n python3-%{modname} +%license COPYING +%doc NEWS README.rst +%{python3_sitelib}/%{modname}-*.egg-info +%{python3_sitelib}/%{modname}/ %endif -%{python_sitelib}/%{realname} -%{python_sitelib}/%{realname}-%{version}-*.egg-info + +%{_bindir}/* +%{_mandir}/man1/*.1* %files doc %doc docs/_build/* -%if %{with python3} -%files -n python3-%{realname} -%doc COPYING NEWS README.rst -%if %{with python3} -%{_bindir}/m* -%{_mandir}/*/* -%endif -%{python3_sitelib}/%{realname} -%{python3_sitelib}/%{realname}*.egg-info -%endif - %changelog +* Sat Dec 31 2016 Igor Gnatenko - 1.36-2 +- Modernize spec + * Fri Dec 23 2016 Michele Baldessari - 1.36-1 - New upstream release diff --git a/sources b/sources index 54c685e..2b0d1e4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mutagen-1.36.tar.gz) = 82aabebdd5df5a6e68a6e983073feced972c5cfd74711c52d12559617fd29ed0835a9067ea5b8b7be7fb34dda0b9c46b81dfa0338834eedfe7e482e2cfcc249f +SHA512 (mutagen-1.36.tar.gz) = d5c30af820729ea56cd4d730d640812c4ef2e8e6f08727e964a4b63b0ff581d2a73551fbbbae8580560b42433f94e6c165624b00d498649af0ea8710e529383d