commit python-mutagen for openSUSE:Leap:15.2
Hello community, here is the log from the commit of package python-mutagen for openSUSE:Leap:15.2 checked in at 2020-05-28 21:04:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-mutagen (Old) and /work/SRC/openSUSE:Leap:15.2/.python-mutagen.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-mutagen" Thu May 28 21:04:53 2020 rev:22 rq: version:1.43.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-mutagen/python-mutagen.changes 2020-04-22 14:13:04.390513938 +0200 +++ /work/SRC/openSUSE:Leap:15.2/.python-mutagen.new.3606/python-mutagen.changes 2020-05-28 21:04:54.896775932 +0200 @@ -2,11 +1,0 @@ -Tue Mar 31 08:32:31 UTC 2020 - pgajdos@suse.com - -- 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.44.0.tar.gz New: ---- mutagen-1.43.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mutagen.spec ++++++ --- /var/tmp/diff_new_pack.uh7Grz/_old 2020-05-28 21:04:55.236776945 +0200 +++ /var/tmp/diff_new_pack.uh7Grz/_new 2020-05-28 21:04:55.236776945 +0200 @@ -17,10 +17,8 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -# Exception: Python 2 no longer supported -%define skip_python2 1 Name: python-mutagen -Version: 1.44.0 +Version: 1.43.0 Release: 0 Summary: Python module to Handle Audio Metadata License: GPL-2.0-or-later @@ -73,9 +71,8 @@ %check export LANG=en_US.UTF-8 -#~ setup.py test --no-quality -rm -r tests/quality -%pytest +#export PATH="$PATH:%%{buildroot}%%{_bindir}" +%python_exec setup.py test --no-quality %files %{python_files} %defattr(-, root, root, 0755) ++++++ mutagen-1.44.0.tar.gz -> mutagen-1.43.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/NEWS new/mutagen-1.43.0/NEWS --- old/mutagen-1.44.0/NEWS 2020-02-10 08:14:18.000000000 +0100 +++ new/mutagen-1.43.0/NEWS 2019-11-17 20:57:29.000000000 +0100 @@ -1,16 +1,3 @@ -.. _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.44.0/PKG-INFO new/mutagen-1.43.0/PKG-INFO --- old/mutagen-1.44.0/PKG-INFO 2020-02-10 08:32:53.000000000 +0100 +++ new/mutagen-1.43.0/PKG-INFO 2019-11-17 21:07:11.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: mutagen -Version: 1.44.0 +Version: 1.43.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 3.5+ (CPython and PyPy) on Linux, Windows and + Mutagen works with Python 2.7, 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,6 +37,8 @@ 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 @@ -46,4 +48,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: >=3.5, <4 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/README.rst new/mutagen-1.43.0/README.rst --- old/mutagen-1.44.0/README.rst 2020-02-09 20:38:15.000000000 +0100 +++ new/mutagen-1.43.0/README.rst 2018-12-26 15:25:20.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 3.5+ (CPython and PyPy) on Linux, Windows and +Mutagen works with Python 2.7, 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.44.0/docs/api/base.rst new/mutagen-1.43.0/docs/api/base.rst --- old/mutagen-1.44.0/docs/api/base.rst 2020-02-10 08:21:23.000000000 +0100 +++ new/mutagen-1.43.0/docs/api/base.rst 2017-05-25 15:49:20.000000000 +0200 @@ -52,19 +52,20 @@ .. class:: text() This type only exists for documentation purposes. It represents - :obj:`python:str` under Python 3. + :obj:`unicode` under Python 2 and :obj:`str` under Python 3. .. class:: bytes() This type only exists for documentation purposes. It represents - :obj:`python:bytes` under Python 3. + :obj:`python:str` under Python 2 and :obj:`python3: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:bytes` under Python 3. + 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. .. class:: fileobj() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/docs/conf.py new/mutagen-1.43.0/docs/conf.py --- old/mutagen-1.44.0/docs/conf.py 2020-02-10 08:16:11.000000000 +0100 +++ new/mutagen-1.43.0/docs/conf.py 2018-11-08 18:50:38.000000000 +0100 @@ -16,7 +16,8 @@ 'sphinx.ext.extlinks', ] intersphinx_mapping = { - 'python': ('https://docs.python.org/3', None), + 'python': ('https://docs.python.org/2', None), + 'python3': ('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.44.0/docs/index.rst new/mutagen-1.43.0/docs/index.rst --- old/mutagen-1.44.0/docs/index.rst 2020-02-10 08:15:30.000000000 +0100 +++ new/mutagen-1.43.0/docs/index.rst 2018-07-08 23:33:34.000000000 +0200 @@ -31,13 +31,13 @@ :: - python3 -m pip install mutagen + pip install mutagen or :: - sudo apt-get install python3-mutagen + sudo apt-get install python-mutagen python3-mutagen Where do I get it? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/docs/user/filelike.rst new/mutagen-1.43.0/docs/user/filelike.rst --- old/mutagen-1.44.0/docs/user/filelike.rst 2020-02-10 08:18:39.000000000 +0100 +++ new/mutagen-1.43.0/docs/user/filelike.rst 2018-07-08 23:33:34.000000000 +0200 @@ -5,8 +5,9 @@ .. 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 `BytesIO <io.BytesIO>` -and mutagen will figure out what to do. +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. :: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/mutagen/__init__.py new/mutagen-1.43.0/mutagen/__init__.py --- old/mutagen-1.44.0/mutagen/__init__.py 2020-02-10 08:30:21.000000000 +0100 +++ new/mutagen-1.43.0/mutagen/__init__.py 2019-11-17 20:58:08.000000000 +0100 @@ -23,7 +23,7 @@ from mutagen._file import FileType, StreamInfo, File from mutagen._tags import Tags, Metadata, PaddingInfo -version = (1, 44, 0) +version = (1, 43, 0) """Version tuple.""" version_string = ".".join(map(str, version)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/mutagen/aiff.py new/mutagen-1.43.0/mutagen/aiff.py --- old/mutagen-1.44.0/mutagen/aiff.py 2020-01-12 21:20:18.000000000 +0100 +++ new/mutagen-1.43.0/mutagen/aiff.py 2019-11-17 17:49:09.000000000 +0100 @@ -359,12 +359,11 @@ 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.44.0/mutagen/asf/_objects.py new/mutagen-1.43.0/mutagen/asf/_objects.py --- old/mutagen-1.44.0/mutagen/asf/_objects.py 2020-01-12 21:20:18.000000000 +0100 +++ new/mutagen-1.43.0/mutagen/asf/_objects.py 2017-05-25 15:49:20.000000000 +0200 @@ -108,7 +108,7 @@ try: data = fileobj.read(payload_size) - except (OverflowError, MemoryError): + except OverflowError: # 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.44.0/mutagen/flac.py new/mutagen-1.43.0/mutagen/flac.py --- old/mutagen-1.44.0/mutagen/flac.py 2020-01-12 21:20:18.000000000 +0100 +++ new/mutagen-1.43.0/mutagen/flac.py 2019-05-18 08:12:40.000000000 +0200 @@ -284,9 +284,6 @@ 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.44.0/mutagen/mp4/__init__.py new/mutagen-1.43.0/mutagen/mp4/__init__.py --- old/mutagen-1.44.0/mutagen/mp4/__init__.py 2020-01-12 21:20:18.000000000 +0100 +++ new/mutagen-1.43.0/mutagen/mp4/__init__.py 2019-06-15 11:53:28.000000000 +0200 @@ -563,9 +563,6 @@ 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": @@ -605,9 +602,7 @@ 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], @@ -766,9 +761,6 @@ 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.44.0/mutagen/oggtheora.py new/mutagen-1.43.0/mutagen/oggtheora.py --- old/mutagen-1.44.0/mutagen/oggtheora.py 2020-01-12 21:20:18.000000000 +0100 +++ new/mutagen-1.43.0/mutagen/oggtheora.py 2017-06-01 14:43:24.000000000 +0200 @@ -61,8 +61,6 @@ 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.44.0/mutagen.egg-info/PKG-INFO new/mutagen-1.43.0/mutagen.egg-info/PKG-INFO --- old/mutagen-1.44.0/mutagen.egg-info/PKG-INFO 2020-02-10 08:32:53.000000000 +0100 +++ new/mutagen-1.43.0/mutagen.egg-info/PKG-INFO 2019-11-17 21:07:11.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: mutagen -Version: 1.44.0 +Version: 1.43.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 3.5+ (CPython and PyPy) on Linux, Windows and + Mutagen works with Python 2.7, 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,6 +37,8 @@ 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 @@ -46,4 +48,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: >=3.5, <4 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/setup.cfg new/mutagen-1.43.0/setup.cfg --- old/mutagen-1.44.0/setup.cfg 2020-02-10 08:32:53.000000000 +0100 +++ new/mutagen-1.43.0/setup.cfg 2019-11-17 21:07:11.000000000 +0100 @@ -13,7 +13,9 @@ [tool:pytest] markers = quality -junit_family = xunit2 + +[bdist_wheel] +universal = 1 [egg_info] tag_build = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/setup.py new/mutagen-1.43.0/setup.py --- old/mutagen-1.44.0/setup.py 2020-02-09 20:38:15.000000000 +0100 +++ new/mutagen-1.43.0/setup.py 2019-11-17 18:10:01.000000000 +0100 @@ -60,22 +60,7 @@ distutils_sdist = get_command_class("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): +class distcheck(distutils_sdist): def _check_manifest(self): assert self.get_archive_files() @@ -130,7 +115,7 @@ os.chdir(old_pwd) def run(self): - sdist.run(self) + distutils_sdist.run(self) self._check_manifest() self._check_dist() @@ -242,9 +227,6 @@ 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: @@ -263,7 +245,6 @@ "coverage": coverage_cmd, "distcheck": distcheck, "build_sphinx": build_sphinx, - "sdist": sdist, } setup(cmdclass=cmd_classes, @@ -276,6 +257,8 @@ 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', @@ -300,7 +283,7 @@ ('share/man/man1', glob.glob("man/*.1")), ], python_requires=( - '>=3.5, <4'), + '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4'), entry_points={ 'console_scripts': [ 'mid3cp=mutagen._tools.mid3cp:entry_point', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/tests/test___init__.py new/mutagen-1.43.0/tests/test___init__.py --- old/mutagen-1.44.0/tests/test___init__.py 2020-02-09 17:45:03.000000000 +0100 +++ new/mutagen-1.43.0/tests/test___init__.py 2019-11-17 17:49:09.000000000 +0100 @@ -542,16 +542,13 @@ 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}) - tests[new_type.__name__] = new_type - for name, test_type in sorted(tests.items()): - globals()[name] = test_type + globals()[new_type.__name__] = new_type create_filetype_tests() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/tests/test__id3frames.py new/mutagen-1.43.0/tests/test__id3frames.py --- old/mutagen-1.44.0/tests/test__id3frames.py 2020-02-09 17:45:03.000000000 +0100 +++ new/mutagen-1.43.0/tests/test__id3frames.py 2018-11-08 18:50:38.000000000 +0100 @@ -1441,14 +1441,11 @@ @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 tests - tests[new_type.__name__] = new_type - for name, test_type in sorted(tests.items()): - globals()[name] = test_type + assert new_type.__name__ not in globals() + globals()[new_type.__name__] = new_type TFrameTest.create_frame_tests() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mutagen-1.44.0/tests/test_apev2.py new/mutagen-1.43.0/tests/test_apev2.py --- old/mutagen-1.44.0/tests/test_apev2.py 2020-02-07 13:17:53.000000000 +0100 +++ new/mutagen-1.43.0/tests/test_apev2.py 2018-07-08 23:33:34.000000000 +0200 @@ -1,8 +1,11 @@ # -*- 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, get_temp_empty +from tests import TestCase, DATA_DIR, get_temp_copy import mutagen.apev2 from mutagen import MutagenError @@ -14,6 +17,8 @@ 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): @@ -35,8 +40,7 @@ # https://github.com/quodlibet/mutagen/issues/145 def test_load(self): - x = mutagen.apev2.APEv2( - os.path.join(DATA_DIR, "145-invalid-item-count.apev2")) + x = mutagen.apev2.APEv2(INVAL_ITEM_COUNT) self.failUnlessEqual(len(x.keys()), 17) @@ -44,45 +48,36 @@ offset = 0 def setUp(self): - self.sample_new = get_temp_copy(SAMPLE) - self.broken_new = get_temp_copy(BROKEN) - + shutil.copy(SAMPLE, SAMPLE + ".new") + shutil.copy(BROKEN, BROKEN + ".new") 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(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) + 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") def test_changed(self): - size = os.path.getsize(self.sample_new) + size = os.path.getsize(SAMPLE + ".new") self.tag.save() self.failUnlessEqual( - os.path.getsize(self.sample_new), size - self.offset) + os.path.getsize(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(self.broken_new) + tag.save(BROKEN + ".new") self.failUnlessEqual( - os.path.getsize(OLD), os.path.getsize(self.broken_new)) + os.path.getsize(OLD), os.path.getsize(BROKEN + ".new")) def test_readback(self): for k, v in self.tag.items(): @@ -90,16 +85,16 @@ def test_size(self): self.failUnlessEqual( - os.path.getsize(self.sample_new), - os.path.getsize(SAMPLE) + os.path.getsize(self.just_tag)) + os.path.getsize(SAMPLE + ".new"), + os.path.getsize(SAMPLE) + os.path.getsize(SAMPLE + ".justtag")) def test_delete(self): - mutagen.apev2.delete(self.just_tag) - tag = mutagen.apev2.APEv2(self.sample_new) + mutagen.apev2.delete(SAMPLE + ".justtag") + tag = mutagen.apev2.APEv2(SAMPLE + ".new") tag.delete() - self.failUnlessEqual(os.path.getsize(self.just_tag), self.offset) + self.failUnlessEqual(os.path.getsize(SAMPLE + ".justtag"), self.offset) self.failUnlessEqual(os.path.getsize(SAMPLE) + self.offset, - os.path.getsize(self.sample_new)) + os.path.getsize(SAMPLE + ".new")) self.failIf(tag) def test_empty(self): @@ -108,21 +103,22 @@ os.path.join(DATA_DIR, "emptyfile.mp3")) def test_tag_at_start(self): - tag = mutagen.apev2.APEv2(self.tag_at_start) + filename = SAMPLE + ".tag_at_start" + tag = mutagen.apev2.APEv2(filename) self.failUnlessEqual(tag["album"], "Mutagen tests") def test_tag_at_start_write(self): - filename = self.tag_at_start + filename = SAMPLE + ".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(self.just_tag), + os.path.getsize(SAMPLE + ".justtag"), os.path.getsize(filename) - (len("tag garbage") * 1000)) def test_tag_at_start_delete(self): - filename = self.tag_at_start + filename = SAMPLE + ".tag_at_start" tag = mutagen.apev2.APEv2(filename) tag.delete() self.failUnlessRaises(APEv2Error, mutagen.apev2.APEv2, filename) @@ -130,42 +126,51 @@ os.path.getsize(filename), len("tag garbage") * 1000) def test_case_preservation(self): - mutagen.apev2.delete(self.just_tag) - tag = mutagen.apev2.APEv2(self.sample_new) + mutagen.apev2.delete(SAMPLE + ".justtag") + tag = mutagen.apev2.APEv2(SAMPLE + ".new") tag["FoObaR"] = "Quux" tag.save() - tag = mutagen.apev2.APEv2(self.sample_new) + tag = mutagen.apev2.APEv2(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(self.sample_new) + tag = mutagen.apev2.APEv2(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(self.sample_new) + tag = mutagen.apev2.APEv2(SAMPLE + ".new") tag["cba"] = "my cba value" tag["abc"] = "my abc value" tag.save() - with open(self.sample_new, 'rb') as fobj: + with open(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() - 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) + 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() def test_tag_at_start_write(self): pass @@ -287,8 +292,7 @@ class TAPEv2WithLyrics2(TestCase): def setUp(self): - self.tag = mutagen.apev2.APEv2( - os.path.join(DATA_DIR, "apev2-lyricsv2.mp3")) + self.tag = mutagen.apev2.APEv2(LYRICS2) def test_values(self): self.failUnlessEqual(self.tag["MP3GAIN_MINMAX"], "000,179")
participants (1)
-
root