Accepting request 784158 from devel:languages:python

- Add patch to fix build with new webcolors:
  * webcolors.patch

OBS-URL: https://build.opensuse.org/request/show/784158
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-jsonschema?expand=0&rev=24
This commit is contained in:
Dominique Leuenberger 2020-03-26 23:21:05 +00:00 committed by Git OBS Bridge
commit c2e9cc91e5
3 changed files with 50 additions and 3 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Mar 12 07:44:16 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to fix build with new webcolors:
* webcolors.patch
-------------------------------------------------------------------
Fri Nov 22 06:06:52 UTC 2019 - Arun Persaud <arun@gmx.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-jsonschema
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# 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
@ -19,14 +19,13 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without python2
Name: python-jsonschema
# v3 incompatibility with OpenStack raised upstream at
# https://github.com/Julian/jsonschema/issues/604
Version: 3.2.0
Release: 0
Summary: An implementation of JSON-Schema validation for Python
License: MIT
URL: https://github.com/Julian/jsonschema
Source: https://files.pythonhosted.org/packages/source/j/jsonschema/jsonschema-%{version}.tar.gz
Patch0: webcolors.patch
BuildRequires: %{python_module Twisted}
BuildRequires: %{python_module attrs >= 17.4.0}
BuildRequires: %{python_module idna}
@ -63,6 +62,7 @@ for Python (supporting 2.6+ including Python 3).
%prep
%setup -q -n jsonschema-%{version}
%patch0 -p1
%build
%python_build

41
webcolors.patch Normal file
View File

@ -0,0 +1,41 @@
From 0d192e192526252c30c16b3651c293bb5f21a99f Mon Sep 17 00:00:00 2001
From: Julian Berman <Julian@GrayVines.com>
Date: Fri, 21 Feb 2020 09:56:13 -0500
Subject: [PATCH] Sigh... but also drops Py2 compat.
---
jsonschema/_format.py | 11 ++++++++---
setup.cfg | 4 ++--
2 files changed, 10 insertions(+), 5 deletions(-)
Index: jsonschema-3.2.0/jsonschema/_format.py
===================================================================
--- jsonschema-3.2.0.orig/jsonschema/_format.py
+++ jsonschema-3.2.0/jsonschema/_format.py
@@ -342,10 +342,15 @@ def is_draft3_time(instance):
return datetime.datetime.strptime(instance, "%H:%M:%S")
-try:
+try: # webcolors>=1.11
+ from webcolors import CSS21_NAMES_TO_HEX
import webcolors
except ImportError:
- pass
+ try: # webcolors<1.11
+ from webcolors import css21_names_to_hex as CSS21_NAMES_TO_HEX
+ import webcolors
+ except ImportError:
+ pass
else:
def is_css_color_code(instance):
return webcolors.normalize_hex(instance)
@@ -354,7 +359,7 @@ else:
def is_css21_color(instance):
if (
not isinstance(instance, str_types) or
- instance.lower() in webcolors.css21_names_to_hex
+ instance.lower() in CSS21_NAMES_TO_HEX
):
return True
return is_css_color_code(instance)