From 0b66fb0cf1252e8ba314f5b9bf3d9505a434e116145e352446cf48ffccc88115 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 20 Nov 2024 16:08:09 +0000 Subject: [PATCH] - update to 0.13.0: * Add a mapping compatible with Plex and ffmpeg for the "original date" fields. * Remove an unnecessary dependency on `six`. * Replace `imghdr` with `filetype` to support Python 3.13. - drop python-mediafile-remove-six.patch (upstream) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mediafile?expand=0&rev=13 --- mediafile-0.12.0.tar.gz | 3 - mediafile-0.13.0.tar.gz | 3 + python-mediafile-remove-six.patch | 393 ------------------------------ python-mediafile.changes | 10 + python-mediafile.spec | 9 +- 5 files changed, 18 insertions(+), 400 deletions(-) delete mode 100644 mediafile-0.12.0.tar.gz create mode 100644 mediafile-0.13.0.tar.gz delete mode 100644 python-mediafile-remove-six.patch diff --git a/mediafile-0.12.0.tar.gz b/mediafile-0.12.0.tar.gz deleted file mode 100644 index 8a6764b..0000000 --- a/mediafile-0.12.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d75d805a06ed56150dbcea76505e700f9809abd9e98f98117ae46f5df2ccf1d7 -size 563534 diff --git a/mediafile-0.13.0.tar.gz b/mediafile-0.13.0.tar.gz new file mode 100644 index 0000000..454f23a --- /dev/null +++ b/mediafile-0.13.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de71063e1bffe9733d6ccad526ea7dac8a9ce760105827f81ab0cb034c729a6d +size 562194 diff --git a/python-mediafile-remove-six.patch b/python-mediafile-remove-six.patch deleted file mode 100644 index e841776..0000000 --- a/python-mediafile-remove-six.patch +++ /dev/null @@ -1,393 +0,0 @@ -From f2db5237e435e788fc810353df8756e23e38ddd6 Mon Sep 17 00:00:00 2001 -From: Alexandre Detiste -Date: Sat, 23 Sep 2023 16:59:35 +0200 -Subject: [PATCH] remove usage of six & __future__ - ---- - mediafile.py | 61 ++++++++++++++++++------------------- - pyproject.toml | 1 - - setup.cfg | 9 +----- - test/__init__.py | 2 -- - test/_common.py | 2 -- - test/test_mediafile.py | 11 +++---- - test/test_mediafile_edge.py | 11 +++---- - 7 files changed, 38 insertions(+), 59 deletions(-) - -diff --git a/mediafile.py b/mediafile.py -index b0c80a0..5f488d7 100644 ---- a/mediafile.py -+++ b/mediafile.py -@@ -33,8 +33,6 @@ - data from the tags. In turn ``MediaField`` uses a number of - ``StorageStyle`` strategies to handle format specific logic. - """ --from __future__ import division, absolute_import, print_function -- - import mutagen - import mutagen.id3 - import mutagen.mp3 -@@ -54,7 +52,6 @@ - import math - import os - import re --import six - import struct - import traceback - -@@ -136,8 +133,8 @@ def mutagen_call(action, filename, func, *args, **kwargs): - try: - return func(*args, **kwargs) - except mutagen.MutagenError as exc: -- log.debug(u'%s failed: %s', action, six.text_type(exc)) -- raise UnreadableFileError(filename, six.text_type(exc)) -+ log.debug(u'%s failed: %s', action, str(exc)) -+ raise UnreadableFileError(filename, str(exc)) - except UnreadableFileError: - # Reraise our errors without changes. - # Used in case of decorating functions (e.g. by `loadfile`). -@@ -202,8 +199,8 @@ def _safe_cast(out_type, val): - # Process any other type as a string. - if isinstance(val, bytes): - val = val.decode('utf-8', 'ignore') -- elif not isinstance(val, six.string_types): -- val = six.text_type(val) -+ elif not isinstance(val, str): -+ val = str(val) - # Get a number from the front of the string. - match = re.match(r'[\+-]?[0-9]+', val.strip()) - return int(match.group(0)) if match else 0 -@@ -215,13 +212,13 @@ def _safe_cast(out_type, val): - except ValueError: - return False - -- elif out_type == six.text_type: -+ elif out_type == str: - if isinstance(val, bytes): - return val.decode('utf-8', 'ignore') -- elif isinstance(val, six.text_type): -+ elif isinstance(val, str): - return val - else: -- return six.text_type(val) -+ return str(val) - - elif out_type == float: - if isinstance(val, int) or isinstance(val, float): -@@ -230,7 +227,7 @@ def _safe_cast(out_type, val): - if isinstance(val, bytes): - val = val.decode('utf-8', 'ignore') - else: -- val = six.text_type(val) -+ val = str(val) - match = re.match(r'[\+-]?([0-9]+\.?[0-9]*|[0-9]*\.[0-9]+)', - val.strip()) - if match: -@@ -289,7 +286,7 @@ def _sc_decode(soundcheck): - """ - # We decode binary data. If one of the formats gives us a text - # string, interpret it as UTF-8. -- if isinstance(soundcheck, six.text_type): -+ if isinstance(soundcheck, str): - soundcheck = soundcheck.encode('utf-8') - - # SoundCheck tags consist of 10 numbers, each represented by 8 -@@ -437,7 +434,7 @@ class Image(object): - def __init__(self, data, desc=None, type=None): - assert isinstance(data, bytes) - if desc is not None: -- assert isinstance(desc, six.text_type) -+ assert isinstance(desc, str) - self.data = data - self.desc = desc - if isinstance(type, int): -@@ -495,7 +492,7 @@ class StorageStyle(object): - """List of mutagen classes the StorageStyle can handle. - """ - -- def __init__(self, key, as_type=six.text_type, suffix=None, -+ def __init__(self, key, as_type=str, suffix=None, - float_places=2, read_only=False): - """Create a basic storage strategy. Parameters: - -@@ -520,8 +517,8 @@ def __init__(self, key, as_type=six.text_type, suffix=None, - self.read_only = read_only - - # Convert suffix to correct string type. -- if self.suffix and self.as_type is six.text_type \ -- and not isinstance(self.suffix, six.text_type): -+ if self.suffix and self.as_type is str \ -+ and not isinstance(self.suffix, str): - self.suffix = self.suffix.decode('utf-8') - - # Getter. -@@ -544,7 +541,7 @@ def deserialize(self, mutagen_value): - """Given a raw value stored on a Mutagen object, decode and - return the represented value. - """ -- if self.suffix and isinstance(mutagen_value, six.text_type) \ -+ if self.suffix and isinstance(mutagen_value, str) \ - and mutagen_value.endswith(self.suffix): - return mutagen_value[:-len(self.suffix)] - else: -@@ -566,17 +563,17 @@ def serialize(self, value): - """Convert the external Python value to a type that is suitable for - storing in a Mutagen file object. - """ -- if isinstance(value, float) and self.as_type is six.text_type: -+ if isinstance(value, float) and self.as_type is str: - value = u'{0:.{1}f}'.format(value, self.float_places) - value = self.as_type(value) -- elif self.as_type is six.text_type: -+ elif self.as_type is str: - if isinstance(value, bool): - # Store bools as 1/0 instead of True/False. -- value = six.text_type(int(bool(value))) -+ value = str(int(bool(value))) - elif isinstance(value, bytes): - value = value.decode('utf-8', 'ignore') - else: -- value = six.text_type(value) -+ value = str(value) - else: - value = self.as_type(value) - -@@ -702,7 +699,7 @@ class MP4StorageStyle(StorageStyle): - - def serialize(self, value): - value = super(MP4StorageStyle, self).serialize(value) -- if self.key.startswith('----:') and isinstance(value, six.text_type): -+ if self.key.startswith('----:') and isinstance(value, str): - value = value.encode('utf-8') - return value - -@@ -881,7 +878,7 @@ def fetch(self, mutagen_file): - - def store(self, mutagen_file, value): - # This field type stores text data as encoded data. -- assert isinstance(value, six.text_type) -+ assert isinstance(value, str) - value = value.encode('utf-8') - - frames = mutagen_file.tags.getall(self.key) -@@ -905,7 +902,7 @@ class MP3DescStorageStyle(MP3StorageStyle): - """ - def __init__(self, desc=u'', key='TXXX', attr='text', multispec=True, - **kwargs): -- assert isinstance(desc, six.text_type) -+ assert isinstance(desc, str) - self.description = desc - self.attr = attr - self.multispec = multispec -@@ -994,7 +991,7 @@ def __init__(self, key, pack_pos=0, **kwargs): - def _fetch_unpacked(self, mutagen_file): - data = self.fetch(mutagen_file) - if data: -- items = six.text_type(data).split('/') -+ items = str(data).split('/') - else: - items = [] - packing_length = 2 -@@ -1010,7 +1007,7 @@ def set(self, mutagen_file, value): - items[0] = '' - if items[1] is None: - items.pop() # Do not store last value -- self.store(mutagen_file, '/'.join(map(six.text_type, items))) -+ self.store(mutagen_file, '/'.join(map(str, items))) - - def delete(self, mutagen_file): - if self.pack_pos == 0: -@@ -1277,7 +1274,7 @@ def __init__(self, *styles, **kwargs): - getting this property. - - """ -- self.out_type = kwargs.get('out_type', six.text_type) -+ self.out_type = kwargs.get('out_type', str) - self._styles = styles - - def styles(self, mutagen_file): -@@ -1317,7 +1314,7 @@ def _none_value(self): - return 0.0 - elif self.out_type == bool: - return False -- elif self.out_type == six.text_type: -+ elif self.out_type == str: - return u'' - - -@@ -1400,9 +1397,9 @@ def _get_date_tuple(self, mediafile): - """ - # Get the underlying data and split on hyphens and slashes. - datestring = super(DateField, self).__get__(mediafile, None) -- if isinstance(datestring, six.string_types): -- datestring = re.sub(r'[Tt ].*$', '', six.text_type(datestring)) -- items = re.split('[-/]', six.text_type(datestring)) -+ if isinstance(datestring, str): -+ datestring = re.sub(r'[Tt ].*$', '', str(datestring)) -+ items = re.split('[-/]', str(datestring)) - else: - items = [] - -@@ -1439,7 +1436,7 @@ def _set_date_tuple(self, mediafile, year, month=None, day=None): - date.append(u'{0:02d}'.format(int(month))) - if month and day: - date.append(u'{0:02d}'.format(int(day))) -- date = map(six.text_type, date) -+ date = map(str, date) - super(DateField, self).__set__(mediafile, u'-'.join(date)) - - if hasattr(self, '_year_field'): -diff --git a/pyproject.toml b/pyproject.toml -index 3ce8c9d..f558885 100644 ---- a/pyproject.toml -+++ b/pyproject.toml -@@ -9,7 +9,6 @@ author-email = "adrian@radbox.org" - home-page = "https://github.com/beetbox/mediafile" - description-file = "README.rst" - requires = [ -- "six>=1.9", - "mutagen>=1.46", - ] - requires-python = ">=3.7" -diff --git a/setup.cfg b/setup.cfg -index 32d3e06..98d931f 100644 ---- a/setup.cfg -+++ b/setup.cfg -@@ -10,11 +10,4 @@ min-version=2.7 - # - E221: multiple spaces before operator (used to align visually) - # - E731: do not assign a lambda expression, use a def - # - C901: function/method complexity --# `flake8-future-import` errors we ignore: --# - FI50: `__future__` import "division" present --# - FI51: `__future__` import "absolute_import" present --# - FI12: `__future__` import "with_statement" missing --# - FI53: `__future__` import "print_function" present --# - FI14: `__future__` import "unicode_literals" missing --# - FI15: `__future__` import "generator_stop" missing --ignore=C901,E241,E221,E731,FI50,FI51,FI12,FI53,FI14,FI15 -+ignore=C901,E241,E221,E731 -diff --git a/test/__init__.py b/test/__init__.py -index f7fd0e2..40a96af 100644 ---- a/test/__init__.py -+++ b/test/__init__.py -@@ -1,3 +1 @@ - # -*- coding: utf-8 -*- -- --from __future__ import division, absolute_import, print_function -diff --git a/test/_common.py b/test/_common.py -index e29c54a..16d126d 100644 ---- a/test/_common.py -+++ b/test/_common.py -@@ -14,8 +14,6 @@ - # included in all copies or substantial portions of the Software. - - """Some common functionality for mediafile tests.""" --from __future__ import division, absolute_import, print_function -- - import os - import tempfile - import shutil -diff --git a/test/test_mediafile.py b/test/test_mediafile.py -index 8105983..957187a 100644 ---- a/test/test_mediafile.py -+++ b/test/test_mediafile.py -@@ -16,14 +16,11 @@ - """Automatically-generated blanket testing for the MediaFile metadata - layer. - """ --from __future__ import division, absolute_import, print_function -- - import os - import shutil - import datetime - import time - import unittest --from six import assertCountEqual - - from test import _common - from mediafile import MediaFile, Image, \ -@@ -269,7 +266,7 @@ class GenreListTestMixin(object): - - def test_read_genre_list(self): - mediafile = self._mediafile_fixture('full') -- assertCountEqual(self, mediafile.genres, ['the genre']) -+ self.assertCountEqual(mediafile.genres, ['the genre']) - - def test_write_genre_list(self): - mediafile = self._mediafile_fixture('empty') -@@ -277,7 +274,7 @@ def test_write_genre_list(self): - mediafile.save() - - mediafile = MediaFile(mediafile.filename) -- assertCountEqual(self, mediafile.genres, [u'one', u'two']) -+ self.assertCountEqual(mediafile.genres, [u'one', u'two']) - - def test_write_genre_list_get_first(self): - mediafile = self._mediafile_fixture('empty') -@@ -294,7 +291,7 @@ def test_append_genre_list(self): - mediafile.save() - - mediafile = MediaFile(mediafile.filename) -- assertCountEqual(self, mediafile.genres, [u'the genre', u'another']) -+ self.assertCountEqual(mediafile.genres, [u'the genre', u'another']) - - - class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin, -@@ -1116,7 +1113,7 @@ def test_known_fields(self): - 'albumtypes', 'catalognums', 'languages', 'artists_credit', - 'artists_sort', 'albumartists_credit', 'albumartists_sort') - ) -- assertCountEqual(self, MediaFile.fields(), fields) -+ self.assertCountEqual(MediaFile.fields(), fields) - - def test_fields_in_readable_fields(self): - readable = MediaFile.readable_fields() -diff --git a/test/test_mediafile_edge.py b/test/test_mediafile_edge.py -index 3119861..337c610 100644 ---- a/test/test_mediafile_edge.py -+++ b/test/test_mediafile_edge.py -@@ -15,8 +15,6 @@ - - """Specific, edge-case tests for the MediaFile metadata layer. - """ --from __future__ import division, absolute_import, print_function -- - import os - import shutil - import unittest -@@ -25,7 +23,6 @@ - from test import _common - - import mediafile --import six - - - _sc = mediafile._safe_cast -@@ -130,8 +127,8 @@ def test_safe_cast_negative_string_to_float(self): - self.assertAlmostEqual(_sc(float, u'-1.234'), -1.234) - - def test_safe_cast_special_chars_to_unicode(self): -- us = _sc(six.text_type, 'caf\xc3\xa9') -- self.assertTrue(isinstance(us, six.text_type)) -+ us = _sc(str, 'caf\xc3\xa9') -+ self.assertTrue(isinstance(us, str)) - self.assertTrue(us.startswith(u'caf')) - - def test_safe_cast_float_with_no_numbers(self): -@@ -359,7 +356,7 @@ def test_v24_year_tag(self): - mf.year = 2013 - mf.save() - frame = mf.mgfile['TDRC'] -- self.assertTrue('2013' in six.text_type(frame)) -+ self.assertTrue('2013' in str(frame)) - self.assertTrue('TYER' not in mf.mgfile) - finally: - self._delete_test() -@@ -370,7 +367,7 @@ def test_v23_year_tag(self): - mf.year = 2013 - mf.save() - frame = mf.mgfile['TYER'] -- self.assertTrue('2013' in six.text_type(frame)) -+ self.assertTrue('2013' in str(frame)) - self.assertTrue('TDRC' not in mf.mgfile) - finally: - self._delete_test() diff --git a/python-mediafile.changes b/python-mediafile.changes index b896031..747f9fb 100644 --- a/python-mediafile.changes +++ b/python-mediafile.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Nov 20 16:06:58 UTC 2024 - Dirk Müller + +- update to 0.13.0: + * Add a mapping compatible with Plex and ffmpeg for the "original date" + fields. + * Remove an unnecessary dependency on `six`. + * Replace `imghdr` with `filetype` to support Python 3.13. +- drop python-mediafile-remove-six.patch (upstream) + ------------------------------------------------------------------- Sat Dec 16 20:48:28 UTC 2023 - Dirk Müller diff --git a/python-mediafile.spec b/python-mediafile.spec index c710659..9e7b76e 100644 --- a/python-mediafile.spec +++ b/python-mediafile.spec @@ -1,7 +1,7 @@ # # spec file for package python-mediafile # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,14 +18,14 @@ %{?sle15_python_module_pythons} Name: python-mediafile -Version: 0.12.0 +Version: 0.13.0 Release: 0 -Summary: Handles low-level interfacing for files' tags Wraps Mutagen to +Summary: Read and write audio files tags in Python License: MIT URL: https://github.com/beetbox/mediafile Source: https://files.pythonhosted.org/packages/source/m/mediafile/mediafile-%{version}.tar.gz -Patch1: python-mediafile-remove-six.patch BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module filetype} BuildRequires: %{python_module flit-core >= 2} BuildRequires: %{python_module mutagen >= 1.45} BuildRequires: %{python_module pip} @@ -33,6 +33,7 @@ BuildRequires: %{python_module pytest} BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros +Requires: python-filetype Requires: python-mutagen >= 1.45 BuildArch: noarch %python_subpackages