From 548c1e69cc40b2bf19330a69ad22c51d6a14388c9cda03bc552a3aeff3f8c82d Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 28 Feb 2020 17:46:34 +0000 Subject: [PATCH] - Add PR292-Python38.patch to fix Python 3.8 incompatibilities (gh#jsonpickle/jsonpickle#281). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jsonpickle?expand=0&rev=16 --- PR292-Python38.patch | 41 +++++++++++++++++++++++++++++++++++++++ jsonpickle-1.2.tar.gz | 3 --- jsonpickle-1.3.tar.gz | 3 +++ python-jsonpickle.changes | 6 ++++++ python-jsonpickle.spec | 13 ++++++++----- 5 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 PR292-Python38.patch delete mode 100644 jsonpickle-1.2.tar.gz create mode 100644 jsonpickle-1.3.tar.gz diff --git a/PR292-Python38.patch b/PR292-Python38.patch new file mode 100644 index 0000000..f100765 --- /dev/null +++ b/PR292-Python38.patch @@ -0,0 +1,41 @@ +--- a/jsonpickle/handlers.py ++++ b/jsonpickle/handlers.py +@@ -10,7 +10,9 @@ A handler can be bound to other types by + from __future__ import absolute_import, division, unicode_literals + import copy + import datetime ++import io + import re ++import sys + import threading + import uuid + +@@ -254,3 +256,18 @@ class LockHandler(BaseHandler): + + _lock = threading.Lock() + LockHandler.handles(_lock.__class__) ++ ++ ++class TextIOHandler(BaseHandler): ++ """Serialize file descriptors as None because we cannot roundtrip""" ++ ++ def flatten(self, obj, data): ++ return None ++ ++ def restore(self, data): ++ """Restore should never get called because flatten() returns None""" ++ raise AssertionError('Restoring IO.TextIOHandler is not supported') ++ ++ ++if sys.version_info >= (3, 8): ++ TextIOHandler.handles(io.TextIOWrapper) +--- a/requirements-dev.txt ++++ b/requirements-dev.txt +@@ -12,5 +12,5 @@ pytest + pytest-cov + simplejson + sqlalchemy +-ujson +-yajl; sys_platform != 'win32' ++ujson; python_version < '3.8' ++yajl; sys_platform != 'win32' and python_version < '3.8' diff --git a/jsonpickle-1.2.tar.gz b/jsonpickle-1.2.tar.gz deleted file mode 100644 index c47a03d..0000000 --- a/jsonpickle-1.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d3e922d781b1d0096df2dad89a2e1f47177d7969b596aea806a9d91b4626b29b -size 74693 diff --git a/jsonpickle-1.3.tar.gz b/jsonpickle-1.3.tar.gz new file mode 100644 index 0000000..fb68fcb --- /dev/null +++ b/jsonpickle-1.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71bca2b80ae28af4e3f86629ef247100af7f97032b5ca8d791c1f8725b411d95 +size 76571 diff --git a/python-jsonpickle.changes b/python-jsonpickle.changes index 3610c5f..df6fa67 100644 --- a/python-jsonpickle.changes +++ b/python-jsonpickle.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Feb 28 18:31:13 CET 2020 - Matej Cepl + +- Add PR292-Python38.patch to fix Python 3.8 incompatibilities + (gh#jsonpickle/jsonpickle#281). + ------------------------------------------------------------------- Thu Dec 5 18:13:07 CET 2019 - Matej Cepl diff --git a/python-jsonpickle.spec b/python-jsonpickle.spec index 1573871..654c663 100644 --- a/python-jsonpickle.spec +++ b/python-jsonpickle.spec @@ -1,7 +1,7 @@ # # spec file for package python-jsonpickle # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,18 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define modname jsonpickle Name: python-jsonpickle -Version: 1.2 +Version: 1.3 Release: 0 Summary: Python library for serializing any arbitrary object graph into JSON License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/jsonpickle/jsonpickle Source: https://files.pythonhosted.org/packages/source/j/jsonpickle/jsonpickle-%{version}.tar.gz +# PATCH-FIX-UPSTREAM PR292-Python38.patch gh#jsonpickle/jsonpickle#281 mcepl@suse.com +# Fix Python 3.8 incompatibilities +Patch01: PR292-Python38.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -57,7 +61,7 @@ It can take almost any Python object and turn the object into JSON. Additionally, it can reconstitute the object back into Python. %prep -%setup -q -n jsonpickle-%{version} +%autosetup -p1 -n %{modname}-%{version} %build %python_build @@ -67,8 +71,7 @@ Additionally, it can reconstitute the object back into Python. %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# Exclusions because of gh#jsonpickle/jsonpickle#281 -%pytest -k 'not (test_thing_with_fd or test_list_with_fd or test_dict_with_fd)' +%pytest %files %{python_files} %doc README.rst docs/source/changelog.rst