# # spec file for package python-mutagen # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: python-mutagen Version: 1.28 Release: 0 Summary: Python module to Handle Audio Metadata License: GPL-2.0 Group: Development/Libraries/Python Url: https://pypi.python.org/pypi/mutagen Source: https://pypi.python.org/packages/source/m/mutagen/mutagen-%{version}.tar.gz BuildRequires: python-devel BuildRequires: python-setuptools Requires(post): update-alternatives Requires(postun): update-alternatives BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else BuildArch: noarch %endif %description Mutagen is a Python module to handle audio metadata. It supports FLAC, M4A, MP3, Ogg FLAC, Ogg Speex, Ogg Theora, Ogg Vorbis, True Audio, and WavPack audio files. All versions of ID3v2 are supported, and all standard ID3v2.4 frames are parsed. It can read Xing headers to accurately calculate the bitrate and length of MP3s. ID3 and APEv2 tags can be edited regardless of their audio format. It can also manipulate Ogg streams on an individual packet/page level. %prep %setup -q -n mutagen-%{version} # remove shebangs from library files find mutagen/ -name "*.py" -exec sed -i -e '/^#!\s\?\/usr\/bin\/\(env\s\)\?python$/d' {} ';' for i in mid3cp mid3iconv mid3v2 moggsplit mutagen-inspect mutagen-pony; do sed -i "s/\"${i}\"/\"${i}-%{py_ver}\"/g" setup.py mv tools/${i} tools/${i}-%{py_ver} mv man/${i}.1 man/${i}-%{py_ver}.1 done %build python setup.py build %install python setup.py install --root=%{buildroot} --prefix="%{_prefix}" ln -sf %{_bindir}/mid3cp-%{py_ver} %{buildroot}%{_bindir}/mid3cp ln -sf %{_bindir}/mid3iconv-%{py_ver} %{buildroot}%{_bindir}/mid3iconv ln -sf %{_bindir}/mid3v2-%{py_ver} %{buildroot}%{_bindir}/mid3v2 ln -sf %{_bindir}/moggsplit-%{py_ver} %{buildroot}%{_bindir}/moggsplit ln -sf %{_bindir}/mutagen-inspect-%{py_ver} %{buildroot}%{_bindir}/mutagen-inspect ln -sf %{_bindir}/mutagen-pony-%{py_ver} %{buildroot}%{_bindir}/mutagen-pony ln -sf %{_mandir}/man1/mid3cp-%{py_ver}.1.gz %{buildroot}%{_mandir}/man1/mid3cp.1.gz ln -sf %{_mandir}/man1/mid3iconv-%{py_ver}.1.gz %{buildroot}%{_mandir}/man1/mid3iconv.1.gz ln -sf %{_mandir}/man1/mid3v2-%{py_ver}.1.gz %{buildroot}%{_mandir}/man1/mid3v2.1.gz ln -sf %{_mandir}/man1/moggsplit-%{py_ver}.1.gz %{buildroot}%{_mandir}/man1/moggsplit.1.gz ln -sf %{_mandir}/man1/mutagen-inspect-%{py_ver}.1.gz %{buildroot}%{_mandir}/man1/mutagen-inspect.1.gz ln -sf %{_mandir}/man1/mutagen-pony-%{py_ver}.1.gz %{buildroot}%{_mandir}/man1/mutagen-pony.1.gz %pre # Since binaries became ghosted to be used with update-alternatives, we have to get rid # of the old binary resulting from the non-update-alternativies-ified package: [ -h %{_bindir}/mid3cp ] || rm -f %{_bindir}/mid3cp [ -h %{_bindir}/mid3iconv ] || rm -f %{_bindir}/mid3iconv [ -h %{_bindir}/mid3v2 ] || rm -f %{_bindir}/mid3v2 [ -h %{_bindir}/moggsplit ] || rm -f %{_bindir}/moggsplit [ -h %{_bindir}/mutagen-inspect ] || rm -f %{_bindir}/mutagen-inspect [ -h %{_bindir}/mutagen-pony ] || rm -f %{_bindir}/mutagen-pony [ -h %{_mandir}/man1/mid3cp.1.gz ] || rm -f %{_mandir}/man1/mid3cp.1.gz [ -h %{_mandir}/man1/mid3iconv.1.gz ] || rm -f %{_mandir}/man1/mid3iconv.1.gz [ -h %{_mandir}/man1/mid3v2.1.gz ] || rm -f %{_mandir}/man1/mid3v2.1.gz [ -h %{_mandir}/man1/moggsplit.1.gz ] || rm -f %{_mandir}/man1/moggsplit.1.gz [ -h %{_mandir}/man1/mutagen-inspect.1.gz ] || rm -f %{_mandir}/man1/mutagen-inspect.1.gz [ -h %{_mandir}/man1/mutagen-pony.1.gz ] || rm -f %{_mandir}/man1/mutagen-pony.1.gz %post update-alternatives \ --install %{_bindir}/mid3cp mid3cp %{_bindir}/mid3cp-%{py_ver} 30 \ --slave %{_bindir}/mid3iconv mid3iconv %{_bindir}/mid3iconv-%{py_ver} \ --slave %{_bindir}/mid3v2 mid3v2 %{_bindir}/mid3v2-%{py_ver} \ --slave %{_bindir}/moggsplit moggsplit %{_bindir}/moggsplit-%{py_ver} \ --slave %{_bindir}/mutagen-inspect mutagen-inspect %{_bindir}/mutagen-inspect-%{py_ver} \ --slave %{_bindir}/mutagen-pony mutagen-pony %{_bindir}/mutagen-pony-%{py_ver} \ --slave %{_mandir}/man1/mid3cp.1.gz mid3cp.1.gz %{_mandir}/man1/mid3cp-%{py_ver}.1.gz \ --slave %{_mandir}/man1/mid3iconv.1.gz mid3iconv.1.gz %{_mandir}/man1/mid3iconv-%{py_ver}.1.gz \ --slave %{_mandir}/man1/mid3v2.1.gz mid3v2.1.gz %{_mandir}/man1/mid3v2-%{py_ver}.1.gz \ --slave %{_mandir}/man1/moggsplit.1.gz moggsplit.1.gz %{_mandir}/man1/moggsplit-%{py_ver}.1.gz \ --slave %{_mandir}/man1/mutagen-inspect.1.gz mutagen-inspect.1.gz %{_mandir}/man1/mutagen-inspect-%{py_ver}.1.gz \ --slave %{_mandir}/man1/mutagen-pony.1.gz mutagen-pony.1.gz %{_mandir}/man1/mutagen-pony-%{py_ver}.1.gz %preun if [ $1 -eq 0 ] ; then update-alternatives --remove mid3cp %{_bindir}/mid3cp-%{py_ver} fi %files %defattr(-, root, root, 0755) %doc COPYING NEWS README.rst %ghost %{_bindir}/mid3cp %{_bindir}/mid3cp-%{py_ver} %ghost %{_bindir}/mid3iconv %{_bindir}/mid3iconv-%{py_ver} %ghost %{_bindir}/mid3v2 %{_bindir}/mid3v2-%{py_ver} %ghost %{_bindir}/moggsplit %{_bindir}/moggsplit-%{py_ver} %ghost %{_bindir}/mutagen-inspect %{_bindir}/mutagen-inspect-%{py_ver} %ghost %{_bindir}/mutagen-pony %{_bindir}/mutagen-pony-%{py_ver} %{python_sitelib}/mutagen %{python_sitelib}/mutagen-%{version}-py%{py_ver}.egg-info %ghost %{_mandir}/man1/mid3cp.1.gz %{_mandir}/man1/mid3cp-%{py_ver}.1.gz %ghost %{_mandir}/man1/mid3iconv.1.gz %{_mandir}/man1/mid3iconv-%{py_ver}.1.gz %ghost %{_mandir}/man1/mid3v2.1.gz %{_mandir}/man1/mid3v2-%{py_ver}.1.gz %ghost %{_mandir}/man1/moggsplit.1.gz %{_mandir}/man1/moggsplit-%{py_ver}.1.gz %ghost %{_mandir}/man1/mutagen-inspect.1.gz %{_mandir}/man1/mutagen-inspect-%{py_ver}.1.gz %ghost %{_mandir}/man1/mutagen-pony.1.gz %{_mandir}/man1/mutagen-pony-%{py_ver}.1.gz %changelog