forked from pool/python-mutagen
Accepting request 486959 from home:alarrosa:branches:devel:languages:python
- Use singlespec macros. - Drop fix-tests-tools-names.diff which is not needed anymore. - Add reduce-test-length.diff to reduce the number of iterations in a test that is repeated for each data test file, for every byte, so it only tests each file for the first 10 bytes. This way we reduce the time it takes to test mutagen (and the corresponding cpu usage in obs) from 1078 seconds (nearly 18 minutes) to 53 seconds (for each python version). OBS-URL: https://build.opensuse.org/request/show/486959 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mutagen?expand=0&rev=28
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
Index: mutagen-1.36.1/tests/test_tools.py
|
||||
===================================================================
|
||||
--- mutagen-1.36.1.orig/tests/test_tools.py
|
||||
+++ mutagen-1.36.1/tests/test_tools.py
|
||||
@@ -12,7 +12,7 @@ from tests import TestCase
|
||||
|
||||
def get_var(tool_name, entry="main"):
|
||||
mod = importlib.import_module(
|
||||
- "mutagen._tools.%s" % tool_name.replace("-", "_"))
|
||||
+ "mutagen._tools.%s" % tool_name.replace("-", "_")[:tool_name.find('-2')])
|
||||
return getattr(mod, entry)
|
||||
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 6 15:52:21 UTC 2017 - alarrosa@suse.com
|
||||
|
||||
- Use singlespec macros.
|
||||
- Drop fix-tests-tools-names.diff which is not needed anymore.
|
||||
- Add reduce-test-length.diff to reduce the number of iterations in a test
|
||||
that is repeated for each data test file, for every byte, so it only tests
|
||||
each file for the first 10 bytes. This way we reduce the time it takes to
|
||||
test mutagen (and the corresponding cpu usage in obs) from 1078 seconds
|
||||
(nearly 18 minutes) to 53 seconds (for each python version).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 22 14:58:43 UTC 2017 - tbechtold@suse.com
|
||||
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
#
|
||||
|
||||
|
||||
%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
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-mutagen
|
||||
Version: 1.37
|
||||
Release: 0
|
||||
@@ -29,14 +25,16 @@ License: GPL-2.0+
|
||||
Group: Development/Libraries/Python
|
||||
Url: https://pypi.python.org/pypi/mutagen
|
||||
Source: https://files.pythonhosted.org/packages/source/m/mutagen/mutagen-%{version}.tar.gz
|
||||
# PATCH-FIX-OPENSUSE fix-tests-tools-names.diff -- Undo the alternate-names of the tools when importing the modules so tests build successfully.
|
||||
Patch0: fix-tests-tools-names.diff
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-pytest
|
||||
BuildRequires: python-setuptools
|
||||
Requires(post): update-alternatives
|
||||
Requires(preun): update-alternatives
|
||||
# PATCH-FIX-OPENSUSE reduce-test-length.diff alarrosa@suse.com -- Reduce the number of iterations so tests don't take so long to finish
|
||||
Patch0: reduce-test-length.diff
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Mutagen is a Python module to handle audio metadata. It supports FLAC,
|
||||
@@ -53,94 +51,45 @@ Ogg streams on an individual packet/page level.
|
||||
# remove shebangs from library files
|
||||
find mutagen/ -name "*.py" -exec sed -i -e '/^#!\s\?\/usr\/bin\/\(env\s\)\?python$/d' {} ';'
|
||||
|
||||
export LANG=en_US.UTF-8
|
||||
for i in mid3cp mid3iconv mid3v2 moggsplit mutagen-inspect mutagen-pony; do
|
||||
j=`echo $i|tr '-' '_'`
|
||||
sed -i "s/\"${i}\"/\"${i}-%{py_ver}\"/g" setup.py
|
||||
sed -i "s/u\"${i}\"/u\"${i}-%{py_ver}\"/g" tests/test_tools_${j}.py
|
||||
mv tools/${i} tools/${i}-%{py_ver}
|
||||
mv man/${i}.1 man/${i}-%{py_ver}.1
|
||||
done
|
||||
|
||||
%build
|
||||
python setup.py build
|
||||
%python_build
|
||||
|
||||
%install
|
||||
python setup.py install --root=%{buildroot} --prefix="%{_prefix}"
|
||||
%python_install
|
||||
|
||||
# Prepare for update-alternatives usage
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
||||
for p in mid3cp mid3iconv mid3v2 moggsplit mutagen-inspect mutagen-pony; do
|
||||
ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
|
||||
ln -s -f %{_sysconfdir}/alternatives/$p.1.gz %{buildroot}%{_mandir}/man1/${p}.1.gz
|
||||
for i in mid3cp mid3iconv mid3v2 moggsplit mutagen-inspect mutagen-pony; do
|
||||
%python_clone -a %{buildroot}%{_bindir}/${i}
|
||||
%python_clone -a %{buildroot}%{_mandir}/man1/${i}.1
|
||||
done
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}/mutagen
|
||||
|
||||
%post
|
||||
%{_sbindir}/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
|
||||
%{python_install_alternative mid3cp mid3iconv mid3v2 moggsplit mutagen-inspect mutagen-pony mid3cp.1 mid3iconv.1 mid3v2.1 moggsplit.1 mutagen-inspect.1 mutagen-pony.1}
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
%{_sbindir}/update-alternatives --remove mid3cp %{_bindir}/mid3cp-%{py_ver}
|
||||
fi
|
||||
%{python_uninstall_alternative mid3cp}
|
||||
|
||||
%check
|
||||
export LANG=en_US.UTF-8
|
||||
export PATH="$PATH:%{buildroot}%{_bindir}"
|
||||
export PYTHONPATH="$PYTHONPATH:%{buildroot}%{python_sitelib}"
|
||||
python setup.py test
|
||||
#export PATH="$PATH:%%{buildroot}%%{_bindir}"
|
||||
%python_exec setup.py test
|
||||
|
||||
%files
|
||||
%files %{python_files}
|
||||
%defattr(-, root, root, 0755)
|
||||
%doc COPYING NEWS README.rst
|
||||
%{_bindir}/mid3cp
|
||||
%{_bindir}/mid3iconv
|
||||
%{_bindir}/mid3v2
|
||||
%{_bindir}/moggsplit
|
||||
%{_bindir}/mutagen-inspect
|
||||
%{_bindir}/mutagen-pony
|
||||
%{_bindir}/mid3cp-%{py_ver}
|
||||
%{_bindir}/mid3iconv-%{py_ver}
|
||||
%{_bindir}/mid3v2-%{py_ver}
|
||||
%{_bindir}/moggsplit-%{py_ver}
|
||||
%{_bindir}/mutagen-inspect-%{py_ver}
|
||||
%{_bindir}/mutagen-pony-%{py_ver}
|
||||
%ghost %{_sysconfdir}/alternatives/mid3cp
|
||||
%ghost %{_sysconfdir}/alternatives/mid3iconv
|
||||
%ghost %{_sysconfdir}/alternatives/mid3v2
|
||||
%ghost %{_sysconfdir}/alternatives/moggsplit
|
||||
%ghost %{_sysconfdir}/alternatives/mutagen-inspect
|
||||
%ghost %{_sysconfdir}/alternatives/mutagen-pony
|
||||
%{_mandir}/man1/mid3cp.1%{ext_man}
|
||||
%{_mandir}/man1/mid3iconv.1%{ext_man}
|
||||
%{_mandir}/man1/mid3v2.1%{ext_man}
|
||||
%{_mandir}/man1/moggsplit.1%{ext_man}
|
||||
%{_mandir}/man1/mutagen-inspect.1%{ext_man}
|
||||
%{_mandir}/man1/mutagen-pony.1%{ext_man}
|
||||
%{_mandir}/man1/mid3cp-%{py_ver}.1%{ext_man}
|
||||
%{_mandir}/man1/mid3iconv-%{py_ver}.1%{ext_man}
|
||||
%{_mandir}/man1/mid3v2-%{py_ver}.1%{ext_man}
|
||||
%{_mandir}/man1/moggsplit-%{py_ver}.1%{ext_man}
|
||||
%{_mandir}/man1/mutagen-inspect-%{py_ver}.1%{ext_man}
|
||||
%{_mandir}/man1/mutagen-pony-%{py_ver}.1%{ext_man}
|
||||
%ghost %{_sysconfdir}/alternatives/mid3cp.1.gz
|
||||
%ghost %{_sysconfdir}/alternatives/mid3iconv.1.gz
|
||||
%ghost %{_sysconfdir}/alternatives/mid3v2.1.gz
|
||||
%ghost %{_sysconfdir}/alternatives/moggsplit.1.gz
|
||||
%ghost %{_sysconfdir}/alternatives/mutagen-inspect.1.gz
|
||||
%ghost %{_sysconfdir}/alternatives/mutagen-pony.1.gz
|
||||
%python_alternative %{_bindir}/mid3cp
|
||||
%python_alternative %{_bindir}/mid3iconv
|
||||
%python_alternative %{_bindir}/mid3v2
|
||||
%python_alternative %{_bindir}/moggsplit
|
||||
%python_alternative %{_bindir}/mutagen-inspect
|
||||
%python_alternative %{_bindir}/mutagen-pony
|
||||
%python_alternative %{_mandir}/man1/mid3cp.1%{ext_man}
|
||||
%python_alternative %{_mandir}/man1/mid3iconv.1%{ext_man}
|
||||
%python_alternative %{_mandir}/man1/mid3v2.1%{ext_man}
|
||||
%python_alternative %{_mandir}/man1/moggsplit.1%{ext_man}
|
||||
%python_alternative %{_mandir}/man1/mutagen-inspect.1%{ext_man}
|
||||
%python_alternative %{_mandir}/man1/mutagen-pony.1%{ext_man}
|
||||
%{python_sitelib}/mutagen
|
||||
%{python_sitelib}/mutagen-%{version}-py*.egg-info
|
||||
%{python_sitelib}/mutagen-%{version}-py%{python_version}.egg-info
|
||||
|
||||
%changelog
|
||||
|
||||
13
reduce-test-length.diff
Normal file
13
reduce-test-length.diff
Normal file
@@ -0,0 +1,13 @@
|
||||
Index: mutagen-1.37/tests/test___init__.py
|
||||
===================================================================
|
||||
--- mutagen-1.37.orig/tests/test___init__.py
|
||||
+++ mutagen-1.37/tests/test___init__.py
|
||||
@@ -270,7 +270,7 @@ def iter_test_file_objects(fileobj):
|
||||
# first figure out how much a successful attempt reads and how many
|
||||
# file object operations it executes.
|
||||
yield t
|
||||
- for i in xrange(t.dataread):
|
||||
+ for i in xrange(min(t.dataread, 10)):
|
||||
yield _TestFileObj(fileobj, stop_after=i)
|
||||
for i in xrange(t.operations):
|
||||
yield _TestFileObj(fileobj, fail_after=i)
|
||||
Reference in New Issue
Block a user