15
0

- Update to 21.0.0:

* Fix OMD.addlist when the added list is empty
  * Add funcutils.noop, satisfying PEP 559
  * Support lists for iterutils.bucketize
  * Python 3.9 test fixes for OMD (PEP 584, see #271)
  * Make typeutils.make_sentinel more pickleable
  * jsonutils.reverse_iter_lines now works on Py3 and Windows 
- Drop boltons-pr271-py39-frozendict.patch:
  * Included upstream.
- Add patch fix-ecoutil-imports.patch:
  * Support Python 3.10.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-boltons?expand=0&rev=18
This commit is contained in:
2021-12-13 00:06:07 +00:00
committed by Git OBS Bridge
parent df6ea864b0
commit ebd4c43268
6 changed files with 138 additions and 69 deletions

View File

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

3
boltons-21.0.0.tar.gz Normal file
View File

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

View File

@@ -1,62 +0,0 @@
From d9c2af2319339924092f7e503c9ebb6079956006 Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Wed, 18 Nov 2020 13:12:49 +0000
Subject: [PATCH] Fix Python 3.9 compatibility for FrozenDict due to PEP 584
implementation.
---
boltons/dictutils.py | 2 +-
tests/test_dictutils.py | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/boltons/dictutils.py b/boltons/dictutils.py
index ce5884c..8d1a4e7 100644
--- a/boltons/dictutils.py
+++ b/boltons/dictutils.py
@@ -1076,7 +1076,7 @@ def _raise_frozen_typeerror(self, *a, **kw):
"raises a TypeError, because FrozenDicts are immutable"
raise TypeError('%s object is immutable' % self.__class__.__name__)
- __setitem__ = __delitem__ = update = _raise_frozen_typeerror
+ __ior__ = __setitem__ = __delitem__ = update = _raise_frozen_typeerror
setdefault = pop = popitem = clear = _raise_frozen_typeerror
del _raise_frozen_typeerror
diff --git a/tests/test_dictutils.py b/tests/test_dictutils.py
index b6873a8..6eac812 100644
--- a/tests/test_dictutils.py
+++ b/tests/test_dictutils.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
+import sys
import pytest
from boltons.dictutils import OMD, OneToOne, ManyToMany, FrozenDict, subdict, FrozenHashError
@@ -432,6 +433,15 @@ def test_frozendict():
return
+@pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9 or higher")
+def test_frozendict_ior():
+ data = {'a': 'A', 'b': 'B'}
+ fd = FrozenDict(data)
+
+ with pytest.raises(TypeError, match=".*FrozenDict.*immutable.*"):
+ fd |= fd
+
+
def test_frozendict_api():
# all the read-only methods that are fine
through_methods = ['__class__',
@@ -452,8 +462,10 @@ def test_frozendict_api():
'__lt__',
'__ne__',
'__new__',
+ '__or__',
'__reduce__',
'__reversed__',
+ '__ror__',
'__setattr__',
'__sizeof__',
'__str__',

117
fix-ecoutil-imports.patch Normal file
View File

@@ -0,0 +1,117 @@
From 270e974975984f662f998c8f6eb0ebebd964de82 Mon Sep 17 00:00:00 2001
From: Mahmoud Hashemi <mahmoud@hatnote.com>
Date: Sun, 10 Oct 2021 23:26:24 -0700
Subject: [PATCH] address ecoutils import issue, fixes #294
---
boltons/ecoutils.py | 87 +++++++++++++++++++++++----------------------
1 file changed, 44 insertions(+), 43 deletions(-)
diff --git a/boltons/ecoutils.py b/boltons/ecoutils.py
index 0ccad70..91b9412 100644
--- a/boltons/ecoutils.py
+++ b/boltons/ecoutils.py
@@ -354,38 +354,53 @@ def get_profile(**kwargs):
return ret
-_real_safe_repr = pprint._safe_repr
-
-
-def _fake_json_dumps(val, indent=2):
- # never do this. this is a hack for Python 2.4. Python 2.5 added
- # the json module for a reason.
- def _fake_safe_repr(*a, **kw):
- res, is_read, is_rec = _real_safe_repr(*a, **kw)
- if res == 'None':
- res = 'null'
- if res == 'True':
- res = 'true'
- if res == 'False':
- res = 'false'
- if not (res.startswith("'") or res.startswith("u'")):
- res = res
- else:
- if res.startswith('u'):
- res = res[1:]
+try:
+ import json
+
+ def dumps(val, indent):
+ if indent:
+ return json.dumps(val, sort_keys=True, indent=indent)
+ return json.dumps(val, sort_keys=True)
+
+except ImportError:
+ _real_safe_repr = pprint._safe_repr
+
+ def _fake_json_dumps(val, indent=2):
+ # never do this. this is a hack for Python 2.4. Python 2.5 added
+ # the json module for a reason.
+ def _fake_safe_repr(*a, **kw):
+ res, is_read, is_rec = _real_safe_repr(*a, **kw)
+ if res == 'None':
+ res = 'null'
+ if res == 'True':
+ res = 'true'
+ if res == 'False':
+ res = 'false'
+ if not (res.startswith("'") or res.startswith("u'")):
+ res = res
+ else:
+ if res.startswith('u'):
+ res = res[1:]
- contents = res[1:-1]
- contents = contents.replace('"', '').replace(r'\"', '')
- res = '"' + contents + '"'
- return res, is_read, is_rec
+ contents = res[1:-1]
+ contents = contents.replace('"', '').replace(r'\"', '')
+ res = '"' + contents + '"'
+ return res, is_read, is_rec
- pprint._safe_repr = _fake_safe_repr
- try:
- ret = pprint.pformat(val, indent=indent)
- finally:
- pprint._safe_repr = _real_safe_repr
+ pprint._safe_repr = _fake_safe_repr
+ try:
+ ret = pprint.pformat(val, indent=indent)
+ finally:
+ pprint._safe_repr = _real_safe_repr
+
+ return ret
+
+ def dumps(val, indent):
+ ret = _fake_json_dumps(val, indent=indent)
+ if not indent:
+ ret = re.sub(r'\n\s*', ' ', ret)
+ return ret
- return ret
def get_profile_json(indent=False):
@@ -393,20 +408,6 @@ def get_profile_json(indent=False):
indent = 2
else:
indent = 0
- try:
- import json
-
- def dumps(val, indent):
- if indent:
- return json.dumps(val, sort_keys=True, indent=indent)
- return json.dumps(val, sort_keys=True)
-
- except ImportError:
- def dumps(val, indent):
- ret = _fake_json_dumps(val, indent=indent)
- if not indent:
- ret = re.sub(r'\n\s*', ' ', ret)
- return ret
data_dict = get_profile()
return dumps(data_dict, indent)

View File

@@ -1,3 +1,18 @@
-------------------------------------------------------------------
Mon Dec 13 00:04:19 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 21.0.0:
* Fix OMD.addlist when the added list is empty
* Add funcutils.noop, satisfying PEP 559
* Support lists for iterutils.bucketize
* Python 3.9 test fixes for OMD (PEP 584, see #271)
* Make typeutils.make_sentinel more pickleable
* jsonutils.reverse_iter_lines now works on Py3 and Windows
- Drop boltons-pr271-py39-frozendict.patch:
* Included upstream.
- Add patch fix-ecoutil-imports.patch:
* Support Python 3.10.
-------------------------------------------------------------------
Fri Mar 19 19:53:55 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@@ -18,15 +18,14 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-boltons
Version: 20.2.1
Version: 21.0.0
Release: 0
Summary: The "Boltons" utility package for Python
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/mahmoud/boltons
Source: https://github.com/mahmoud/boltons/archive/%{version}.tar.gz#/boltons-%{version}.tar.gz
# PATCH-FIX-UPSTREAM boltons-pr271-py39-frozendict.patch -- gh#mahmoud/boltons#271, gh#mahmoud/boltons#283
Patch0: boltons-pr271-py39-frozendict.patch
# PATCH-FIX-UPSTREAM Support Python 3.10 gh#mahmoud/boltons#270e974975984f662f998c8f6eb0ebebd964de82
Patch0: fix-ecoutil-imports.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes