Accepting request 1144548 from home:pgajdos:python

- version update to 0.0.7
  0.0.7 (2024-02-03)
  * Refactor header option parser to use the standard library instead of a custom RegEx #75.
  [bsc#1219610] CVE-2024-24762 
  0.0.6 (2023-02-27)
  * Migrate package installation to pyproject.toml (PEP 621) #54.
  * Use yaml.safe_load instead of yaml.load #46.
  * Add support for Python 3.11, drop EOL 3.6 #51.
  * Add support for Python 3.8-3.10, drop EOL 2.7-3.5 #42.
  * QuerystringParser: don't raise an AttributeError in __repr__ #30.
- deleted patches
  - python-python-multipart-no-mock.patch (upstreamed)
  - python-python-multipart-no-six.patch (upstreamed)
  - support-pyyaml-6.patch (upstreamed)

OBS-URL: https://build.opensuse.org/request/show/1144548
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-multipart?expand=0&rev=12
This commit is contained in:
Dirk Mueller 2024-02-06 14:23:05 +00:00 committed by Git OBS Bridge
parent 66491301e2
commit 2bb87e95c8
7 changed files with 26 additions and 183 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f7bb5f611fc600d15fa47b3974c8aa16e93724513b49b5f95c81e6624c83fa43
size 32581

View File

@ -1,17 +0,0 @@
diff --git a/multipart/tests/test_multipart.py b/multipart/tests/test_multipart.py
index 5769905..7913cd2 100644
--- a/multipart/tests/test_multipart.py
+++ b/multipart/tests/test_multipart.py
@@ -16,7 +16,10 @@
from io import BytesIO
from six import binary_type, text_type
-from mock import MagicMock, Mock, patch
+try:
+ from unittest.mock import MagicMock, Mock, patch
+except ImportError:
+ from mock import MagicMock, Mock, patch
from ..multipart import *

View File

@ -1,139 +0,0 @@
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
Index: python-multipart-0.0.5/setup.py
===================================================================
--- python-multipart-0.0.5.orig/setup.py
+++ python-multipart-0.0.5/setup.py
@@ -25,7 +25,6 @@ setup(name='python-multipart',
platforms='any',
zip_safe=False,
install_requires=[
- 'six>=1.4.0',
],
tests_require=[
'pytest',

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Tue Feb 6 11:19:14 UTC 2024 - pgajdos@suse.com
- version update to 0.0.7
0.0.7 (2024-02-03)
* Refactor header option parser to use the standard library instead of a custom RegEx #75.
[bsc#1219610] CVE-2024-24762
0.0.6 (2023-02-27)
* Migrate package installation to pyproject.toml (PEP 621) #54.
* Use yaml.safe_load instead of yaml.load #46.
* Add support for Python 3.11, drop EOL 3.6 #51.
* Add support for Python 3.8-3.10, drop EOL 2.7-3.5 #42.
* QuerystringParser: don't raise an AttributeError in __repr__ #30.
- deleted patches
- python-python-multipart-no-mock.patch (upstreamed)
- python-python-multipart-no-six.patch (upstreamed)
- support-pyyaml-6.patch (upstreamed)
-------------------------------------------------------------------
Tue Jun 13 08:53:42 UTC 2023 - ecsos <ecsos@opensuse.org>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-python-multipart
#
# 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,20 +18,14 @@
%{?sle15_python_module_pythons}
Name: python-python-multipart
Version: 0.0.5
Version: 0.0.7
Release: 0
License: Apache-2.0
Summary: Python streaming multipart parser
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
Source: https://files.pythonhosted.org/packages/source/p/python-multipart/python_multipart-%{version}.tar.gz
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: python-rpm-macros
# SECTION test requirements
@ -47,7 +41,7 @@ BuildArch: noarch
A streaming multipart parser for Python.
%prep
%autosetup -p1 -n python-multipart-%{version}
%autosetup -p1 -n python_multipart-%{version}
%build
%pyproject_wheel

BIN
python_multipart-0.0.7.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,13 +0,0 @@
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
@@ -709,7 +709,7 @@ for f in os.listdir(http_tests_dir):
test_data = f.read()
with open(yaml_file, 'rb') as f:
- yaml_data = yaml.load(f)
+ yaml_data = yaml.safe_load(f)
http_tests.append({
'name': fname,