Hello community,
here is the log from the commit of package python-mutagen for
openSUSE:Leap:15.2 checked in at 2020-04-22 14:13:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-mutagen (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-mutagen.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mutagen"
Wed Apr 22 14:13:03 2020 rev:21 rq:795596 version:1.44.0
Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/python-mutagen/python-mutagen.changes
2020-02-21 23:48:45.100494939 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.python-mutagen.new.2738/python-mutagen.changes
2020-04-22 14:13:04.390513938 +0200
@@ -1,0 +2,11 @@
+Tue Mar 31 08:32:31 UTC 2020 - [email protected]
+
+- version update to 1.44.0
+ * Python 2 is no longer supported :bug:`410`
+ * mp4: Fix some infinite loops in the mp4 parser :pr:`429` (:user:`Julien
Voisin <jvoisin>`)
+ * flac: Fix pickle support for SeekPoint :pr:`428` (:user:`point-source`)
+ * aiff: Fix a division by zero :pr:`431` (:user:`Julien Voisin <jvoisin>`)
+ * asf: Catch a MemoryError :pr:`432` (:user:`Julien Voisin <jvoisin>`)
+ * oggtheora: Fix a division by zero :pr:`430` (:user:`Julien Voisin
<jvoisin>`)
+
+-------------------------------------------------------------------
Old:
----
mutagen-1.43.0.tar.gz
New:
----
mutagen-1.44.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-mutagen.spec ++++++
--- /var/tmp/diff_new_pack.drUMMO/_old 2020-04-22 14:13:04.762514689 +0200
+++ /var/tmp/diff_new_pack.drUMMO/_new 2020-04-22 14:13:04.766514698 +0200
@@ -17,8 +17,10 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+# Exception: Python 2 no longer supported
+%define skip_python2 1
Name: python-mutagen
-Version: 1.43.0
+Version: 1.44.0
Release: 0
Summary: Python module to Handle Audio Metadata
License: GPL-2.0-or-later
@@ -71,8 +73,9 @@
%check
export LANG=en_US.UTF-8
-#export PATH="$PATH:%%{buildroot}%%{_bindir}"
-%python_exec setup.py test --no-quality
+#~ setup.py test --no-quality
+rm -r tests/quality
+%pytest
%files %{python_files}
%defattr(-, root, root, 0755)
++++++ mutagen-1.43.0.tar.gz -> mutagen-1.44.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/NEWS new/mutagen-1.44.0/NEWS
--- old/mutagen-1.43.0/NEWS 2019-11-17 20:57:29.000000000 +0100
+++ new/mutagen-1.44.0/NEWS 2020-02-10 08:14:18.000000000 +0100
@@ -1,3 +1,16 @@
+.. _release-1.44.0:
+
+1.44.0 - 2020-02-10
+-------------------
+
+* Python 2 is no longer supported :bug:`410`
+* mp4: Fix some infinite loops in the mp4 parser :pr:`429` (:user:`Julien
Voisin <jvoisin>`)
+* flac: Fix pickle support for SeekPoint :pr:`428` (:user:`point-source`)
+* aiff: Fix a division by zero :pr:`431` (:user:`Julien Voisin <jvoisin>`)
+* asf: Catch a MemoryError :pr:`432` (:user:`Julien Voisin <jvoisin>`)
+* oggtheora: Fix a division by zero :pr:`430` (:user:`Julien Voisin <jvoisin>`)
+
+
.. _release-1.43.0:
1.43.0 - 2019-11-17
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/PKG-INFO new/mutagen-1.44.0/PKG-INFO
--- old/mutagen-1.43.0/PKG-INFO 2019-11-17 21:07:11.000000000 +0100
+++ new/mutagen-1.44.0/PKG-INFO 2020-02-10 08:32:53.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: mutagen
-Version: 1.43.0
+Version: 1.44.0
Summary: read and write audio tags for many formats
Home-page: https://github.com/quodlibet/mutagen
Author: Christoph Reiter
@@ -20,7 +20,7 @@
MP3s. ID3 and APEv2 tags can be edited regardless of audio format. It
can also
manipulate Ogg streams on an individual packet/page level.
- Mutagen works with Python 2.7, 3.5+ (CPython and PyPy) on Linux,
Windows and
+ Mutagen works with Python 3.5+ (CPython and PyPy) on Linux, Windows and
macOS, and has no dependencies outside the Python standard library.
Mutagen
is licensed under the GPL version 2 or later.
@@ -37,8 +37,6 @@
Platform: UNKNOWN
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
@@ -48,4 +46,4 @@
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: License :: OSI Approved :: GNU General Public License v2 or later
(GPLv2+)
Classifier: Topic :: Multimedia :: Sound/Audio
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4
+Requires-Python: >=3.5, <4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/README.rst
new/mutagen-1.44.0/README.rst
--- old/mutagen-1.43.0/README.rst 2018-12-26 15:25:20.000000000 +0100
+++ new/mutagen-1.44.0/README.rst 2020-02-09 20:38:15.000000000 +0100
@@ -12,7 +12,7 @@
MP3s. ID3 and APEv2 tags can be edited regardless of audio format. It can also
manipulate Ogg streams on an individual packet/page level.
-Mutagen works with Python 2.7, 3.5+ (CPython and PyPy) on Linux, Windows and
+Mutagen works with Python 3.5+ (CPython and PyPy) on Linux, Windows and
macOS, and has no dependencies outside the Python standard library. Mutagen
is licensed under the GPL version 2 or later.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/docs/api/base.rst
new/mutagen-1.44.0/docs/api/base.rst
--- old/mutagen-1.43.0/docs/api/base.rst 2017-05-25 15:49:20.000000000
+0200
+++ new/mutagen-1.44.0/docs/api/base.rst 2020-02-10 08:21:23.000000000
+0100
@@ -52,20 +52,19 @@
.. class:: text()
This type only exists for documentation purposes. It represents
- :obj:`unicode` under Python 2 and :obj:`str` under Python 3.
+ :obj:`python:str` under Python 3.
.. class:: bytes()
This type only exists for documentation purposes. It represents
- :obj:`python:str` under Python 2 and :obj:`python3:bytes` under Python 3.
+ :obj:`python:bytes` under Python 3.
.. class:: fspath()
This type only exists for documentation purposes. It represents a file
- name which can be :obj:`python:str` or :obj:`python:unicode` under Python
- 2 and :obj:`python3:bytes` or :obj:`python3:str` under Python 3.
+ name which can be :obj:`python:str` or :obj:`python:bytes` under Python 3.
.. class:: fileobj()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/docs/conf.py
new/mutagen-1.44.0/docs/conf.py
--- old/mutagen-1.43.0/docs/conf.py 2018-11-08 18:50:38.000000000 +0100
+++ new/mutagen-1.44.0/docs/conf.py 2020-02-10 08:16:11.000000000 +0100
@@ -16,8 +16,7 @@
'sphinx.ext.extlinks',
]
intersphinx_mapping = {
- 'python': ('https://docs.python.org/2', None),
- 'python3': ('https://docs.python.org/3', None),
+ 'python': ('https://docs.python.org/3', None),
}
source_suffix = '.rst'
master_doc = 'index'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/docs/index.rst
new/mutagen-1.44.0/docs/index.rst
--- old/mutagen-1.43.0/docs/index.rst 2018-07-08 23:33:34.000000000 +0200
+++ new/mutagen-1.44.0/docs/index.rst 2020-02-10 08:15:30.000000000 +0100
@@ -31,13 +31,13 @@
::
- pip install mutagen
+ python3 -m pip install mutagen
or
::
- sudo apt-get install python-mutagen python3-mutagen
+ sudo apt-get install python3-mutagen
Where do I get it?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/docs/user/filelike.rst
new/mutagen-1.44.0/docs/user/filelike.rst
--- old/mutagen-1.43.0/docs/user/filelike.rst 2018-07-08 23:33:34.000000000
+0200
+++ new/mutagen-1.44.0/docs/user/filelike.rst 2020-02-10 08:18:39.000000000
+0100
@@ -5,9 +5,8 @@
.. currentmodule:: mutagen
The first argument passed to a :class:`FileType` or :class:`Metadata` can
-either be a file name or a file-like object, such as `StringIO
-<StringIO.StringIO>` (`BytesIO <io.BytesIO>` in Python 3) and mutagen will
-figure out what to do.
+either be a file name or a file-like object, such as `BytesIO <io.BytesIO>`
+and mutagen will figure out what to do.
::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/mutagen/__init__.py
new/mutagen-1.44.0/mutagen/__init__.py
--- old/mutagen-1.43.0/mutagen/__init__.py 2019-11-17 20:58:08.000000000
+0100
+++ new/mutagen-1.44.0/mutagen/__init__.py 2020-02-10 08:30:21.000000000
+0100
@@ -23,7 +23,7 @@
from mutagen._file import FileType, StreamInfo, File
from mutagen._tags import Tags, Metadata, PaddingInfo
-version = (1, 43, 0)
+version = (1, 44, 0)
"""Version tuple."""
version_string = ".".join(map(str, version))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/mutagen/aiff.py
new/mutagen-1.44.0/mutagen/aiff.py
--- old/mutagen-1.43.0/mutagen/aiff.py 2019-11-17 17:49:09.000000000 +0100
+++ new/mutagen-1.44.0/mutagen/aiff.py 2020-01-12 21:20:18.000000000 +0100
@@ -359,11 +359,12 @@
channels, frame_count, sample_size, sample_rate = info
self.sample_rate = int(read_float(sample_rate))
+ if self.sample_rate > 0:
+ self.length = frame_count / float(self.sample_rate)
self.bits_per_sample = sample_size
self.sample_size = sample_size # For backward compatibility
self.channels = channels
self.bitrate = channels * sample_size * self.sample_rate
- self.length = frame_count / float(self.sample_rate)
def pprint(self):
return u"%d channel AIFF @ %d bps, %s Hz, %.2f seconds" % (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/mutagen/asf/_objects.py
new/mutagen-1.44.0/mutagen/asf/_objects.py
--- old/mutagen-1.43.0/mutagen/asf/_objects.py 2017-05-25 15:49:20.000000000
+0200
+++ new/mutagen-1.44.0/mutagen/asf/_objects.py 2020-01-12 21:20:18.000000000
+0100
@@ -108,7 +108,7 @@
try:
data = fileobj.read(payload_size)
- except OverflowError:
+ except (OverflowError, MemoryError):
# read doesn't take 64bit values
raise ASFHeaderError("invalid header size")
if len(data) != payload_size:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/mutagen/flac.py
new/mutagen-1.44.0/mutagen/flac.py
--- old/mutagen-1.43.0/mutagen/flac.py 2019-05-18 08:12:40.000000000 +0200
+++ new/mutagen-1.44.0/mutagen/flac.py 2020-01-12 21:20:18.000000000 +0100
@@ -284,6 +284,9 @@
return super(cls, SeekPoint).__new__(
cls, (first_sample, byte_offset, num_samples))
+ def __getnewargs__(self):
+ return self.first_sample, self.byte_offset, self.num_samples
+
first_sample = property(lambda self: self[0])
byte_offset = property(lambda self: self[1])
num_samples = property(lambda self: self[2])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/mutagen/mp4/__init__.py
new/mutagen-1.44.0/mutagen/mp4/__init__.py
--- old/mutagen-1.43.0/mutagen/mp4/__init__.py 2019-06-15 11:53:28.000000000
+0200
+++ new/mutagen-1.44.0/mutagen/mp4/__init__.py 2020-01-12 21:20:18.000000000
+0100
@@ -563,6 +563,9 @@
if len(head) != 12:
raise MP4MetadataError("truncated atom % r" % atom.name)
length, name = struct.unpack(">I4s", head[:8])
+ if length < 1:
+ raise MP4MetadataError(
+ "atom %r has a length of zero" % atom.name)
version = ord(head[8:9])
flags = struct.unpack(">I", b"\x00" + head[9:12])[0]
if name != b"data":
@@ -602,7 +605,9 @@
if atom_name != b"data":
raise MP4MetadataError(
"unexpected atom %r inside %r" % (atom_name, atom.name))
-
+ if length < 1:
+ raise MP4MetadataError(
+ "atom %r has a length of zero" % atom.name)
version = ord(data[pos + 8:pos + 8 + 1])
flags = struct.unpack(">I", b"\x00" + data[pos + 9:pos + 12])[0]
value.append(MP4FreeForm(data[pos + 16:pos + length],
@@ -761,6 +766,9 @@
continue
raise MP4MetadataError(
"unexpected atom %r inside 'covr'" % name)
+ if length < 1:
+ raise MP4MetadataError(
+ "atom %r has a length of zero" % atom.name)
if imageformat not in (MP4Cover.FORMAT_JPEG, MP4Cover.FORMAT_PNG):
# Sometimes AtomDataType.IMPLICIT or simply wrong.
# In all cases it was jpeg, so default to it
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/mutagen/oggtheora.py
new/mutagen-1.44.0/mutagen/oggtheora.py
--- old/mutagen-1.43.0/mutagen/oggtheora.py 2017-06-01 14:43:24.000000000
+0200
+++ new/mutagen-1.44.0/mutagen/oggtheora.py 2020-01-12 21:20:18.000000000
+0100
@@ -61,6 +61,8 @@
raise OggTheoraHeaderError(
"found Theora version %d.%d != 3.2" % (vmaj, vmin))
fps_num, fps_den = struct.unpack(">2I", data[22:30])
+ if not fps_den:
+ raise OggTheoraHeaderError("fps_den is equal to zero")
self.fps = fps_num / float(fps_den)
self.bitrate = cdata.uint_be(b"\x00" + data[37:40])
self.granule_shift = (cdata.ushort_be(data[40:42]) >> 5) & 0x1F
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/mutagen.egg-info/PKG-INFO
new/mutagen-1.44.0/mutagen.egg-info/PKG-INFO
--- old/mutagen-1.43.0/mutagen.egg-info/PKG-INFO 2019-11-17
21:07:11.000000000 +0100
+++ new/mutagen-1.44.0/mutagen.egg-info/PKG-INFO 2020-02-10
08:32:53.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: mutagen
-Version: 1.43.0
+Version: 1.44.0
Summary: read and write audio tags for many formats
Home-page: https://github.com/quodlibet/mutagen
Author: Christoph Reiter
@@ -20,7 +20,7 @@
MP3s. ID3 and APEv2 tags can be edited regardless of audio format. It
can also
manipulate Ogg streams on an individual packet/page level.
- Mutagen works with Python 2.7, 3.5+ (CPython and PyPy) on Linux,
Windows and
+ Mutagen works with Python 3.5+ (CPython and PyPy) on Linux, Windows and
macOS, and has no dependencies outside the Python standard library.
Mutagen
is licensed under the GPL version 2 or later.
@@ -37,8 +37,6 @@
Platform: UNKNOWN
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
@@ -48,4 +46,4 @@
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: License :: OSI Approved :: GNU General Public License v2 or later
(GPLv2+)
Classifier: Topic :: Multimedia :: Sound/Audio
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4
+Requires-Python: >=3.5, <4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/setup.cfg new/mutagen-1.44.0/setup.cfg
--- old/mutagen-1.43.0/setup.cfg 2019-11-17 21:07:11.000000000 +0100
+++ new/mutagen-1.44.0/setup.cfg 2020-02-10 08:32:53.000000000 +0100
@@ -13,9 +13,7 @@
[tool:pytest]
markers =
quality
-
-[bdist_wheel]
-universal = 1
+junit_family = xunit2
[egg_info]
tag_build =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/setup.py new/mutagen-1.44.0/setup.py
--- old/mutagen-1.43.0/setup.py 2019-11-17 18:10:01.000000000 +0100
+++ new/mutagen-1.44.0/setup.py 2020-02-09 20:38:15.000000000 +0100
@@ -60,7 +60,22 @@
distutils_sdist = get_command_class("sdist")
-class distcheck(distutils_sdist):
+def check_setuptools_for_dist():
+ if "setuptools" not in sys.modules:
+ raise Exception("setuptools not available")
+ version = tuple(map(int, sys.modules["setuptools"].__version__.split(".")))
+ if version < (24, 2, 0):
+ raise Exception("setuptools too old")
+
+
+class sdist(distutils_sdist):
+
+ def run(self):
+ check_setuptools_for_dist()
+ distutils_sdist.run(self)
+
+
+class distcheck(sdist):
def _check_manifest(self):
assert self.get_archive_files()
@@ -115,7 +130,7 @@
os.chdir(old_pwd)
def run(self):
- distutils_sdist.run(self)
+ sdist.run(self)
self._check_manifest()
self._check_dist()
@@ -227,6 +242,9 @@
if __name__ == "__main__":
+ if sys.version_info[0] < 3:
+ raise Exception("Python 2 no longer supported")
+
from mutagen import version
with open('README.rst') as h:
@@ -245,6 +263,7 @@
"coverage": coverage_cmd,
"distcheck": distcheck,
"build_sphinx": build_sphinx,
+ "sdist": sdist,
}
setup(cmdclass=cmd_classes,
@@ -257,8 +276,6 @@
license="GPL-2.0-or-later",
classifiers=[
'Operating System :: OS Independent',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
@@ -283,7 +300,7 @@
('share/man/man1', glob.glob("man/*.1")),
],
python_requires=(
- '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4'),
+ '>=3.5, <4'),
entry_points={
'console_scripts': [
'mid3cp=mutagen._tools.mid3cp:entry_point',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/tests/test___init__.py
new/mutagen-1.44.0/tests/test___init__.py
--- old/mutagen-1.43.0/tests/test___init__.py 2019-11-17 17:49:09.000000000
+0100
+++ new/mutagen-1.44.0/tests/test___init__.py 2020-02-09 17:45:03.000000000
+0100
@@ -542,13 +542,16 @@
def create_filetype_tests():
+ tests = {}
for kind, paths in _FILETYPES.items():
for i, path in enumerate(paths):
suffix = "_" + str(i + 1) if i else ""
new_type = type("TFileType" + kind.__name__ + suffix,
(TAbstractFileType, TestCase),
{"PATH": path, "KIND": kind})
- globals()[new_type.__name__] = new_type
+ tests[new_type.__name__] = new_type
+ for name, test_type in sorted(tests.items()):
+ globals()[name] = test_type
create_filetype_tests()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/tests/test__id3frames.py
new/mutagen-1.44.0/tests/test__id3frames.py
--- old/mutagen-1.43.0/tests/test__id3frames.py 2018-11-08 18:50:38.000000000
+0100
+++ new/mutagen-1.44.0/tests/test__id3frames.py 2020-02-09 17:45:03.000000000
+0100
@@ -1441,11 +1441,14 @@
@classmethod
def create_frame_tests(cls):
+ tests = {}
for kind in (list(Frames.values()) + list(Frames_2_2.values())):
new_type = type(cls.__name__ + kind.__name__,
(cls, TestCase), {"FRAME": kind})
- assert new_type.__name__ not in globals()
- globals()[new_type.__name__] = new_type
+ assert new_type.__name__ not in tests
+ tests[new_type.__name__] = new_type
+ for name, test_type in sorted(tests.items()):
+ globals()[name] = test_type
TFrameTest.create_frame_tests()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mutagen-1.43.0/tests/test_apev2.py
new/mutagen-1.44.0/tests/test_apev2.py
--- old/mutagen-1.43.0/tests/test_apev2.py 2018-07-08 23:33:34.000000000
+0200
+++ new/mutagen-1.44.0/tests/test_apev2.py 2020-02-07 13:17:53.000000000
+0100
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
-# FIXME: This test suite is a mess, a lot of it dates from PyMusepack so
-# it doesn't match the other Mutagen test conventions/quality.
import os
-import shutil
-from tests import TestCase, DATA_DIR, get_temp_copy
+from tests import TestCase, DATA_DIR, get_temp_copy, get_temp_empty
import mutagen.apev2
from mutagen import MutagenError
@@ -17,8 +14,6 @@
SAMPLE = os.path.join(DATA_DIR, "click.mpc")
OLD = os.path.join(DATA_DIR, "oldtag.apev2")
BROKEN = os.path.join(DATA_DIR, "brokentag.apev2")
-LYRICS2 = os.path.join(DATA_DIR, "apev2-lyricsv2.mp3")
-INVAL_ITEM_COUNT = os.path.join(DATA_DIR, "145-invalid-item-count.apev2")
class Tis_valid_apev2_key(TestCase):
@@ -40,7 +35,8 @@
# https://github.com/quodlibet/mutagen/issues/145
def test_load(self):
- x = mutagen.apev2.APEv2(INVAL_ITEM_COUNT)
+ x = mutagen.apev2.APEv2(
+ os.path.join(DATA_DIR, "145-invalid-item-count.apev2"))
self.failUnlessEqual(len(x.keys()), 17)
@@ -48,36 +44,45 @@
offset = 0
def setUp(self):
- shutil.copy(SAMPLE, SAMPLE + ".new")
- shutil.copy(BROKEN, BROKEN + ".new")
+ self.sample_new = get_temp_copy(SAMPLE)
+ self.broken_new = get_temp_copy(BROKEN)
+
tag = mutagen.apev2.APEv2()
self.values = {"artist": "Joe Wreschnig\0unittest",
"album": "Mutagen tests",
"title": "Not really a song"}
for k, v in self.values.items():
tag[k] = v
- tag.save(SAMPLE + ".new")
- tag.save(SAMPLE + ".justtag")
- tag.save(SAMPLE + ".tag_at_start")
- fileobj = open(SAMPLE + ".tag_at_start", "ab")
- fileobj.write(b"tag garbage" * 1000)
- fileobj.close()
- self.tag = mutagen.apev2.APEv2(SAMPLE + ".new")
+ tag.save(self.sample_new)
+ self.just_tag = get_temp_empty()
+ tag.save(self.just_tag)
+ self.tag_at_start = get_temp_empty()
+ tag.save(self.tag_at_start)
+ with open(self.tag_at_start, "ab") as fileobj:
+ fileobj.write(b"tag garbage" * 1000)
+
+ self.tag = mutagen.apev2.APEv2(self.sample_new)
+
+ def tearDown(self):
+ os.unlink(self.sample_new)
+ os.unlink(self.broken_new)
+ os.unlink(self.just_tag)
+ os.unlink(self.tag_at_start)
def test_changed(self):
- size = os.path.getsize(SAMPLE + ".new")
+ size = os.path.getsize(self.sample_new)
self.tag.save()
self.failUnlessEqual(
- os.path.getsize(SAMPLE + ".new"), size - self.offset)
+ os.path.getsize(self.sample_new), size - self.offset)
def test_fix_broken(self):
# Clean up garbage from a bug in pre-Mutagen APEv2.
# This also tests removing ID3v1 tags on writes.
self.failIfEqual(os.path.getsize(OLD), os.path.getsize(BROKEN))
tag = mutagen.apev2.APEv2(BROKEN)
- tag.save(BROKEN + ".new")
+ tag.save(self.broken_new)
self.failUnlessEqual(
- os.path.getsize(OLD), os.path.getsize(BROKEN + ".new"))
+ os.path.getsize(OLD), os.path.getsize(self.broken_new))
def test_readback(self):
for k, v in self.tag.items():
@@ -85,16 +90,16 @@
def test_size(self):
self.failUnlessEqual(
- os.path.getsize(SAMPLE + ".new"),
- os.path.getsize(SAMPLE) + os.path.getsize(SAMPLE + ".justtag"))
+ os.path.getsize(self.sample_new),
+ os.path.getsize(SAMPLE) + os.path.getsize(self.just_tag))
def test_delete(self):
- mutagen.apev2.delete(SAMPLE + ".justtag")
- tag = mutagen.apev2.APEv2(SAMPLE + ".new")
+ mutagen.apev2.delete(self.just_tag)
+ tag = mutagen.apev2.APEv2(self.sample_new)
tag.delete()
- self.failUnlessEqual(os.path.getsize(SAMPLE + ".justtag"), self.offset)
+ self.failUnlessEqual(os.path.getsize(self.just_tag), self.offset)
self.failUnlessEqual(os.path.getsize(SAMPLE) + self.offset,
- os.path.getsize(SAMPLE + ".new"))
+ os.path.getsize(self.sample_new))
self.failIf(tag)
def test_empty(self):
@@ -103,22 +108,21 @@
os.path.join(DATA_DIR, "emptyfile.mp3"))
def test_tag_at_start(self):
- filename = SAMPLE + ".tag_at_start"
- tag = mutagen.apev2.APEv2(filename)
+ tag = mutagen.apev2.APEv2(self.tag_at_start)
self.failUnlessEqual(tag["album"], "Mutagen tests")
def test_tag_at_start_write(self):
- filename = SAMPLE + ".tag_at_start"
+ filename = self.tag_at_start
tag = mutagen.apev2.APEv2(filename)
tag.save()
tag = mutagen.apev2.APEv2(filename)
self.failUnlessEqual(tag["album"], "Mutagen tests")
self.failUnlessEqual(
- os.path.getsize(SAMPLE + ".justtag"),
+ os.path.getsize(self.just_tag),
os.path.getsize(filename) - (len("tag garbage") * 1000))
def test_tag_at_start_delete(self):
- filename = SAMPLE + ".tag_at_start"
+ filename = self.tag_at_start
tag = mutagen.apev2.APEv2(filename)
tag.delete()
self.failUnlessRaises(APEv2Error, mutagen.apev2.APEv2, filename)
@@ -126,51 +130,42 @@
os.path.getsize(filename), len("tag garbage") * 1000)
def test_case_preservation(self):
- mutagen.apev2.delete(SAMPLE + ".justtag")
- tag = mutagen.apev2.APEv2(SAMPLE + ".new")
+ mutagen.apev2.delete(self.just_tag)
+ tag = mutagen.apev2.APEv2(self.sample_new)
tag["FoObaR"] = "Quux"
tag.save()
- tag = mutagen.apev2.APEv2(SAMPLE + ".new")
+ tag = mutagen.apev2.APEv2(self.sample_new)
self.failUnless("FoObaR" in tag.keys())
self.failIf("foobar" in tag.keys())
def test_unicode_key(self):
# https://github.com/quodlibet/mutagen/issues/123
- tag = mutagen.apev2.APEv2(SAMPLE + ".new")
+ tag = mutagen.apev2.APEv2(self.sample_new)
tag["abc"] = u'\xf6\xe4\xfc'
tag[u"cba"] = "abc"
tag.save()
def test_save_sort_is_deterministic(self):
- tag = mutagen.apev2.APEv2(SAMPLE + ".new")
+ tag = mutagen.apev2.APEv2(self.sample_new)
tag["cba"] = "my cba value"
tag["abc"] = "my abc value"
tag.save()
- with open(SAMPLE + ".new", 'rb') as fobj:
+ with open(self.sample_new, 'rb') as fobj:
content = fobj.read()
self.assertTrue(content.index(b"abc") < content.index(b"cba"))
- def tearDown(self):
- os.unlink(SAMPLE + ".new")
- os.unlink(BROKEN + ".new")
- os.unlink(SAMPLE + ".justtag")
- os.unlink(SAMPLE + ".tag_at_start")
-
class TAPEv2ThenID3v1Writer(TAPEWriter):
offset = 128
def setUp(self):
super(TAPEv2ThenID3v1Writer, self).setUp()
- f = open(SAMPLE + ".new", "ab+")
- f.write(b"TAG" + b"\x00" * 125)
- f.close()
- f = open(BROKEN + ".new", "ab+")
- f.write(b"TAG" + b"\x00" * 125)
- f.close()
- f = open(SAMPLE + ".justtag", "ab+")
- f.write(b"TAG" + b"\x00" * 125)
- f.close()
+ with open(self.sample_new, "ab+") as f:
+ f.write(b"TAG" + b"\x00" * 125)
+ with open(self.broken_new, "ab+") as f:
+ f.write(b"TAG" + b"\x00" * 125)
+ with open(self.just_tag, "ab+") as f:
+ f.write(b"TAG" + b"\x00" * 125)
def test_tag_at_start_write(self):
pass
@@ -292,7 +287,8 @@
class TAPEv2WithLyrics2(TestCase):
def setUp(self):
- self.tag = mutagen.apev2.APEv2(LYRICS2)
+ self.tag = mutagen.apev2.APEv2(
+ os.path.join(DATA_DIR, "apev2-lyricsv2.mp3"))
def test_values(self):
self.failUnlessEqual(self.tag["MP3GAIN_MINMAX"], "000,179")