From 52f98e55426e6231b534bd13c2222213580cf1277f9af6ef4c509ccefda1e163 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 6 Sep 2023 06:35:41 +0000 Subject: [PATCH] - Switch to pyproject and autosetup macros. - Add patch remove-future-requirement.patch, reove future requirement. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-ffmpeg-python?expand=0&rev=11 --- python-ffmpeg-python.changes | 6 + python-ffmpeg-python.spec | 17 +- remove-future-requirement.patch | 302 ++++++++++++++++++++++++++++++++ 3 files changed, 317 insertions(+), 8 deletions(-) create mode 100644 remove-future-requirement.patch diff --git a/python-ffmpeg-python.changes b/python-ffmpeg-python.changes index 1da31ac..398dc93 100644 --- a/python-ffmpeg-python.changes +++ b/python-ffmpeg-python.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Sep 6 06:34:25 UTC 2023 - Steve Kowalik + +- Switch to pyproject and autosetup macros. +- Add patch remove-future-requirement.patch, reove future requirement. + ------------------------------------------------------------------- Fri Dec 23 23:19:11 UTC 2022 - Ben Greiner diff --git a/python-ffmpeg-python.spec b/python-ffmpeg-python.spec index 2e1dcb8..77cb72e 100644 --- a/python-ffmpeg-python.spec +++ b/python-ffmpeg-python.spec @@ -1,7 +1,7 @@ # # spec file for package python-ffmpeg-python # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,6 @@ # -%define skip_python2 1 Name: python-ffmpeg-python Version: 0.2.0 Release: 0 @@ -24,14 +23,16 @@ Summary: Python bindings for FFmpeg License: Apache-2.0 URL: https://github.com/kkroening/ffmpeg-python Source: https://github.com/kkroening/ffmpeg-python/archive/%{version}.tar.gz#/ffmpeg-python-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#kkroening/ffmpeg-python#233 +Patch0: remove-future-requirement.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-future Recommends: ffmpeg BuildArch: noarch # SECTION test requirements -BuildRequires: %{python_module future} BuildRequires: %{python_module pytest-mock} BuildRequires: %{python_module pytest} BuildRequires: ffmpeg @@ -42,17 +43,17 @@ BuildRequires: ffmpeg Python bindings for FFmpeg - with complex filtering support %prep -%setup -q -n ffmpeg-python-%{version} +%autosetup -p1 -n ffmpeg-python-%{version} # https://github.com/kkroening/ffmpeg-python/issues/617 sed -i 's:pytest-runner::' setup.py # https://github.com/kkroening/ffmpeg-python/issues/624 sed -i 's/collections.Iterable/collections.abc.Iterable/' ffmpeg/_run.py %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check @@ -65,6 +66,6 @@ sed -i 's/collections.Iterable/collections.abc.Iterable/' ffmpeg/_run.py %license LICENSE %doc README.md %{python_sitelib}/ffmpeg -%{python_sitelib}/ffmpeg_python-%{version}*-info +%{python_sitelib}/ffmpeg_python-%{version}.dist-info %changelog diff --git a/remove-future-requirement.patch b/remove-future-requirement.patch new file mode 100644 index 0000000..0feb059 --- /dev/null +++ b/remove-future-requirement.patch @@ -0,0 +1,302 @@ +From d23ad83290d1760756e7edbebd46608e3141bd1e Mon Sep 17 00:00:00 2001 +From: Karl Kroening +Date: Fri, 5 Jul 2019 19:39:07 -0500 +Subject: [PATCH 1/5] Drop `future` install-requirement + +--- + ffmpeg/_ffmpeg.py | 2 -- + ffmpeg/_utils.py | 1 - + ffmpeg/nodes.py | 6 +++--- + setup.py | 28 +++++++++++++++++----------- + 4 files changed, 20 insertions(+), 17 deletions(-) + +diff --git a/ffmpeg/_ffmpeg.py b/ffmpeg/_ffmpeg.py +index 31e2b90..cfe6356 100644 +--- a/ffmpeg/_ffmpeg.py ++++ b/ffmpeg/_ffmpeg.py +@@ -1,6 +1,4 @@ + from __future__ import unicode_literals +- +-from past.builtins import basestring + from ._utils import basestring + + from .nodes import ( +diff --git a/ffmpeg/_utils.py b/ffmpeg/_utils.py +index d41f2fd..10d0c36 100644 +--- a/ffmpeg/_utils.py ++++ b/ffmpeg/_utils.py +@@ -1,6 +1,5 @@ + from __future__ import unicode_literals + from builtins import str +-from past.builtins import basestring + import hashlib + import sys + +diff --git a/ffmpeg/nodes.py b/ffmpeg/nodes.py +index cacab8e..f4b8f7f 100644 +--- a/ffmpeg/nodes.py ++++ b/ffmpeg/nodes.py +@@ -1,8 +1,8 @@ + from __future__ import unicode_literals +- +-from past.builtins import basestring + from .dag import KwargReprNode +-from ._utils import escape_chars, get_hash_int ++from ._utils import basestring ++from ._utils import escape_chars ++from ._utils import get_hash_int + from builtins import object + import os + +diff --git a/setup.py b/setup.py +index 0282c67..946fd5a 100644 +--- a/setup.py ++++ b/setup.py +@@ -1,5 +1,7 @@ + from setuptools import setup + from textwrap import dedent ++import sys ++ + + version = '0.2.0' + download_url = 'https://github.com/kkroening/ffmpeg-python/archive/v{}.zip'.format( +@@ -57,6 +59,19 @@ + + keywords = misc_keywords + file_formats + ++ ++dev_requires = [ ++ 'future>=0.17.1', ++ 'numpy>=1.16.4', ++ 'pytest-mock>=1.10.4', ++ 'pytest>=4.6.1', ++ 'tox>=3.12.1', ++] ++ ++if sys.version_info[0] >= 3: ++ dev_requires += ['Sphinx>=2.1.0'] ++ ++ + setup( + name='ffmpeg-python', + packages=['ffmpeg'], +@@ -70,17 +85,8 @@ + download_url=download_url, + keywords=keywords, + long_description=long_description, +- install_requires=['future'], +- extras_require={ +- 'dev': [ +- 'future==0.17.1', +- 'numpy==1.16.4', +- 'pytest-mock==1.10.4', +- 'pytest==4.6.1', +- 'Sphinx==2.1.0', +- 'tox==3.12.1', +- ] +- }, ++ install_requires=[], ++ extras_require={'dev': dev_requires}, + classifiers=[ + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + +From 7611a29ae6b8925f3f602ccc387c8543feb52116 Mon Sep 17 00:00:00 2001 +From: Karl Kroening +Date: Fri, 5 Jul 2019 19:50:57 -0500 +Subject: [PATCH 2/5] Drop `builtins` import + +--- + ffmpeg/_run.py | 1 - + ffmpeg/_utils.py | 7 +------ + ffmpeg/_view.py | 2 -- + ffmpeg/dag.py | 2 -- + ffmpeg/nodes.py | 1 - + ffmpeg/tests/test_ffmpeg.py | 7 +------ + 6 files changed, 2 insertions(+), 18 deletions(-) + +diff --git a/ffmpeg/_run.py b/ffmpeg/_run.py +index afc504d..aaa92fd 100644 +--- a/ffmpeg/_run.py ++++ b/ffmpeg/_run.py +@@ -1,7 +1,6 @@ + from __future__ import unicode_literals + from .dag import get_outgoing_edges, topo_sort + from ._utils import basestring, convert_kwargs_to_cmd_line_args +-from builtins import str + from functools import reduce + import collections + import copy +diff --git a/ffmpeg/_utils.py b/ffmpeg/_utils.py +index 10d0c36..1f61d4e 100644 +--- a/ffmpeg/_utils.py ++++ b/ffmpeg/_utils.py +@@ -1,5 +1,4 @@ + from __future__ import unicode_literals +-from builtins import str + import hashlib + import sys + +@@ -33,14 +32,10 @@ def __new__(cls, name, this_bases, d): + + + if sys.version_info.major >= 3: +- + class basestring(with_metaclass(BaseBaseString)): + pass +- +- + else: +- # noinspection PyUnresolvedReferences,PyCompatibility +- from builtins import basestring ++ basestring = basestring + + + def _recursive_repr(item): +diff --git a/ffmpeg/_view.py b/ffmpeg/_view.py +index fb129fa..2b8b0eb 100644 +--- a/ffmpeg/_view.py ++++ b/ffmpeg/_view.py +@@ -1,6 +1,4 @@ + from __future__ import unicode_literals +- +-from builtins import str + from .dag import get_outgoing_edges + from ._run import topo_sort + import tempfile +diff --git a/ffmpeg/dag.py b/ffmpeg/dag.py +index 9564d7f..02ce83f 100644 +--- a/ffmpeg/dag.py ++++ b/ffmpeg/dag.py +@@ -1,7 +1,5 @@ + from __future__ import unicode_literals +- + from ._utils import get_hash, get_hash_int +-from builtins import object + from collections import namedtuple + + +diff --git a/ffmpeg/nodes.py b/ffmpeg/nodes.py +index f4b8f7f..e4150c2 100644 +--- a/ffmpeg/nodes.py ++++ b/ffmpeg/nodes.py +@@ -3,7 +3,6 @@ + from ._utils import basestring + from ._utils import escape_chars + from ._utils import get_hash_int +-from builtins import object + import os + + +diff --git a/ffmpeg/tests/test_ffmpeg.py b/ffmpeg/tests/test_ffmpeg.py +index 279a323..c32b89e 100644 +--- a/ffmpeg/tests/test_ffmpeg.py ++++ b/ffmpeg/tests/test_ffmpeg.py +@@ -1,7 +1,4 @@ + from __future__ import unicode_literals +-from builtins import bytes +-from builtins import range +-from builtins import str + import ffmpeg + import os + import pytest +@@ -689,9 +686,7 @@ def test_pipe(): + cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) + +- in_data = bytes( +- bytearray([random.randint(0, 255) for _ in range(frame_size * frame_count)]) +- ) ++ in_data = bytearray([random.randint(0, 255) for _ in range(frame_size * frame_count)]) + p.stdin.write(in_data) # note: this could block, in which case need to use threads + p.stdin.close() + + +From e740f6bb49504d66567dc4d1956cea36b92ae3b5 Mon Sep 17 00:00:00 2001 +From: Karl Kroening +Date: Fri, 5 Jul 2019 19:53:29 -0500 +Subject: [PATCH 3/5] Re-blacken _utils.py + +--- + ffmpeg/_utils.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ffmpeg/_utils.py b/ffmpeg/_utils.py +index 1f61d4e..b871b2a 100644 +--- a/ffmpeg/_utils.py ++++ b/ffmpeg/_utils.py +@@ -32,8 +32,11 @@ def __new__(cls, name, this_bases, d): + + + if sys.version_info.major >= 3: ++ + class basestring(with_metaclass(BaseBaseString)): + pass ++ ++ + else: + basestring = basestring + + +From 8f3cb6cada976f81b7bc7ac350e578b32bff987b Mon Sep 17 00:00:00 2001 +From: Karl Kroening +Date: Fri, 5 Jul 2019 19:54:31 -0500 +Subject: [PATCH 4/5] Add python 3.7 test configuration; drop future import in + tox.ini + +--- + .travis.yml | 3 +++ + tox.ini | 3 +-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/.travis.yml b/.travis.yml +index c58274b..e51f420 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -20,6 +20,9 @@ matrix: + - python: 3.6 + env: + - TOX_ENV=py36 ++ - python: 3.7 ++ env: ++ - TOX_ENV=py37 + - python: pypy + env: + - TOX_ENV=pypy +diff --git a/tox.ini b/tox.ini +index f86ec4b..397d41a 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -4,11 +4,10 @@ + # and then run "tox" from this directory. + + [tox] +-envlist = py27, py34, py35, py36, pypy ++envlist = py27, py34, py35, py36, py37, pypy + + [testenv] + commands = py.test -vv + deps = +- future + pytest + pytest-mock + +From c580ae355bb18b3d3d0aaee0e9220f34441995e0 Mon Sep 17 00:00:00 2001 +From: Karl Kroening +Date: Fri, 5 Jul 2019 20:01:19 -0500 +Subject: [PATCH 5/5] Try using Xenial in Travis + +--- + .travis.yml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/.travis.yml b/.travis.yml +index e51f420..9859d03 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -1,4 +1,5 @@ + language: python ++dist: xenial + before_install: + - > + [ -f ffmpeg-release/ffmpeg ] || (