From eff2f914461b2721a1de6b15aa715f0981b87c86 Mon Sep 17 00:00:00 2001 From: dirkmueller <> Date: Dec 13 2022 18:58:08 +0000 Subject: Update python-python-multipart to version 0.0.5 / rev 4 via SR 1042468 https://build.opensuse.org/request/show/1042468 by user dirkmueller + dimstar_suse --- diff --git a/.files b/.files index 7cd892b..adda8b1 100644 Binary files a/.files and b/.files differ diff --git a/.rev b/.rev index bb9fd9d..d1e8c42 100644 --- a/.rev +++ b/.rev @@ -25,4 +25,12 @@ Also a dep of fastapi (https://repology.org/project/python:fastapi/versions) and 967920 + + 94f2b0c89e46b16a397fc3b37c5f38e8 + 0.0.5 + + dimstar_suse + + 1042468 + diff --git a/python-python-multipart-no-six.patch b/python-python-multipart-no-six.patch new file mode 100644 index 0000000..2e130e1 --- /dev/null +++ b/python-python-multipart-no-six.patch @@ -0,0 +1,127 @@ +Index: python-multipart-0.0.5/multipart/multipart.py +=================================================================== +--- python-multipart-0.0.5.orig/multipart/multipart.py ++++ python-multipart-0.0.5/multipart/multipart.py +@@ -1,11 +1,5 @@ + from __future__ import with_statement, absolute_import, print_function + +-from six import ( +- binary_type, +- text_type, +- PY3, +-) +- + from .decoders import * + from .exceptions import * + +@@ -74,14 +68,9 @@ NULL = b'\x00'[0] + # str on Py2, and bytes on Py3. Same with getting the ordinal value of a byte, + # and joining a list of bytes together. + # These functions abstract that. +-if PY3: # pragma: no cover +- lower_char = lambda c: c | 0x20 +- ord_char = lambda c: c +- join_bytes = lambda b: bytes(list(b)) +-else: # pragma: no cover +- lower_char = lambda c: c.lower() +- ord_char = lambda c: ord(c) +- join_bytes = lambda b: b''.join(list(b)) ++lower_char = lambda c: c | 0x20 ++ord_char = lambda c: c ++join_bytes = lambda b: bytes(list(b)) + + # These are regexes for parsing header values. + SPECIAL_CHARS = re.escape(b'()<>@,;:\\"/[]?={} \t') +@@ -104,7 +93,7 @@ def parse_options_header(value): + + # If we are passed a string, we assume that it conforms to WSGI and does + # not contain any code point that's not in latin-1. +- if isinstance(value, text_type): # pragma: no cover ++ if isinstance(value, str): # pragma: no cover + value = value.encode('latin-1') + + # If we have no options, return the string as-is. +@@ -454,13 +443,13 @@ class File(object): + options = {} + if keep_extensions: + ext = self._ext +- if isinstance(ext, binary_type): ++ if isinstance(ext, bytes): + ext = ext.decode(sys.getfilesystemencoding()) + + options['suffix'] = ext + if file_dir is not None: + d = file_dir +- if isinstance(d, binary_type): ++ if isinstance(d, bytes): + d = d.decode(sys.getfilesystemencoding()) + + options['dir'] = d +@@ -478,7 +467,7 @@ class File(object): + fname = tmp_file.name + + # Encode filename as bytes. +- if isinstance(fname, text_type): ++ if isinstance(fname, str): + fname = fname.encode(sys.getfilesystemencoding()) + + self._actual_file_name = fname +@@ -1037,7 +1026,7 @@ class MultipartParser(BaseParser): + # self.skip = tuple(skip) + + # Save our boundary. +- if isinstance(boundary, text_type): # pragma: no cover ++ if isinstance(boundary, str): # pragma: no cover + boundary = boundary.encode('latin-1') + self.boundary = b'\r\n--' + boundary + +Index: python-multipart-0.0.5/multipart/tests/test_multipart.py +=================================================================== +--- python-multipart-0.0.5.orig/multipart/tests/test_multipart.py ++++ python-multipart-0.0.5/multipart/tests/test_multipart.py +@@ -14,7 +14,6 @@ from .compat import ( + unittest, + ) + from io import BytesIO +-from six import binary_type, text_type + + try: + from unittest.mock import MagicMock, Mock, patch +@@ -29,7 +28,7 @@ curr_dir = os.path.abspath(os.path.dirna + + + def force_bytes(val): +- if isinstance(val, text_type): ++ if isinstance(val, str): + val = val.encode(sys.getfilesystemencoding()) + + return val +@@ -799,7 +798,7 @@ class TestFormParser(unittest.TestCase): + def test_http(self, param): + # Firstly, create our parser with the given boundary. + boundary = param['result']['boundary'] +- if isinstance(boundary, text_type): ++ if isinstance(boundary, str): + boundary = boundary.encode('latin-1') + self.make(boundary) + +Index: python-multipart-0.0.5/multipart/exceptions.py +=================================================================== +--- python-multipart-0.0.5.orig/multipart/exceptions.py ++++ python-multipart-0.0.5/multipart/exceptions.py +@@ -1,7 +1,5 @@ + import binascii + +-from six import PY3 +- + + class FormParserError(ValueError): + """Base error class for our form parser.""" +@@ -52,7 +50,4 @@ else: # pragma + + # We check which version of Python we're on to figure out what error we need + # to catch for invalid Base64. +-if PY3: # pragma: no cover + Base64Error = binascii.Error +-else: # pragma: no cover +- Base64Error = TypeError diff --git a/python-python-multipart.changes b/python-python-multipart.changes index 23e4201..157b1d9 100644 --- a/python-python-multipart.changes +++ b/python-python-multipart.changes @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Mon Dec 12 16:51:23 UTC 2022 - pgajdos@suse.com + +- do not require six +- added patches + fix https://github.com/andrew-d/python-multipart/commit/c54ad6006bacc77623864ec8e5c96bfd32230e01 + + python-python-multipart-no-six.patch + +------------------------------------------------------------------- Fri Apr 8 09:51:38 UTC 2022 - pgajdos@suse.com - do not require python-mock for build diff --git a/python-python-multipart.spec b/python-python-multipart.spec index 138d93f..9761ffb 100644 --- a/python-python-multipart.spec +++ b/python-python-multipart.spec @@ -16,8 +16,6 @@ # -%{?!python_module:%define python_module() python3-%{**}} -%define skip_python2 1 Name: python-python-multipart Version: 0.0.5 Release: 0 @@ -27,7 +25,10 @@ URL: http://github.com/andrew-d/python-multipart Source: https://files.pythonhosted.org/packages/source/p/python-multipart/python-multipart-%{version}.tar.gz Patch0: support-pyyaml-6.patch # https://github.com/andrew-d/python-multipart/commit/8cff1aac7479fbb69087e355f66315b21640bab0 +# https://github.com/andrew-d/python-multipart/commit/2c7e95c7236fcecdb5660823936403d1359fdb85 Patch1: python-python-multipart-no-mock.patch +# https://github.com/andrew-d/python-multipart/commit/c54ad6006bacc77623864ec8e5c96bfd32230e01 +Patch2: python-python-multipart-no-six.patch BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION test requirements @@ -60,6 +61,7 @@ A streaming multipart parser for Python. %files %{python_files} %doc README.rst %license LICENSE.txt -%{python_sitelib}/* +%{python_sitelib}/multipart +%{python_sitelib}/python_multipart-*.egg-info %changelog