forked from pool/python-Django
- Add patch to build with PyYAML >5:
* pyyaml5.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-Django?expand=0&rev=22
This commit is contained in:
parent
a2706e4981
commit
1c8273ad08
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Mar 23 16:31:46 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Add patch to build with PyYAML >5:
|
||||
* pyyaml5.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 12 09:24:53 UTC 2019 - Thomas Bechtold <tbechtold@suse.com>
|
||||
|
||||
|
@ -29,6 +29,7 @@ Source: https://www.djangoproject.com/m/releases/2.1/Django-%{version}.t
|
||||
Source1: https://www.djangoproject.com/m/pgp/Django-%{version}.checksum.txt#/Django-%{version}.tar.gz.asc
|
||||
Source2: %{name}.keyring
|
||||
Source99: python-Django-rpmlintrc
|
||||
Patch0: pyyaml5.patch
|
||||
BuildRequires: %{python_module Jinja2 >= 2.9.2}
|
||||
BuildRequires: %{python_module Pillow}
|
||||
BuildRequires: %{python_module PyYAML}
|
||||
@ -82,6 +83,7 @@ echo "`grep -e '^[0-9a-f]\{40\} Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-
|
||||
echo "`grep -e '^[0-9a-f]\{64\} Django-%{version}.tar.gz' %{SOURCE1} | cut -c1-64` %{SOURCE0}" | sha256sum -c
|
||||
|
||||
%setup -q -n Django-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
83
pyyaml5.patch
Normal file
83
pyyaml5.patch
Normal file
@ -0,0 +1,83 @@
|
||||
From a57c783dd4e6dc73847081221827a1902eede88b Mon Sep 17 00:00:00 2001
|
||||
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
||||
Date: Wed, 13 Mar 2019 20:06:47 +0100
|
||||
Subject: [PATCH] Fixed serializers tests for PyYAML 5.1+.
|
||||
|
||||
---
|
||||
tests/serializers/test_yaml.py | 4 +++-
|
||||
tests/timezones/tests.py | 12 ++++++------
|
||||
2 files changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tests/serializers/test_yaml.py b/tests/serializers/test_yaml.py
|
||||
index e876597e9d04..dbcbd57003f4 100644
|
||||
--- a/tests/serializers/test_yaml.py
|
||||
+++ b/tests/serializers/test_yaml.py
|
||||
@@ -115,7 +115,9 @@ class YamlSerializerTestCase(SerializersTestBase, TestCase):
|
||||
author: %(author_pk)s
|
||||
headline: Poker has no place on ESPN
|
||||
pub_date: 2006-06-16 11:00:00
|
||||
- categories: [%(first_category_pk)s, %(second_category_pk)s]
|
||||
+ categories:""" + (
|
||||
+ ' [%(first_category_pk)s, %(second_category_pk)s]' if yaml.__version__ < '5.1'
|
||||
+ else '\n - %(first_category_pk)s\n - %(second_category_pk)s') + """
|
||||
meta_data: []
|
||||
"""
|
||||
|
||||
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py
|
||||
index e54b011c0426..7a63bac67000 100644
|
||||
--- a/tests/timezones/tests.py
|
||||
+++ b/tests/timezones/tests.py
|
||||
@@ -643,7 +643,7 @@ def test_naive_datetime(self):
|
||||
self.assertEqual(obj.dt, dt)
|
||||
|
||||
if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer):
|
||||
- data = serializers.serialize('yaml', [Event(dt=dt)])
|
||||
+ data = serializers.serialize('yaml', [Event(dt=dt)], default_flow_style=None)
|
||||
self.assert_yaml_contains_datetime(data, "2011-09-01 13:20:30")
|
||||
obj = next(serializers.deserialize('yaml', data)).object
|
||||
self.assertEqual(obj.dt, dt)
|
||||
@@ -667,7 +667,7 @@ def test_naive_datetime_with_microsecond(self):
|
||||
self.assertEqual(obj.dt, dt)
|
||||
|
||||
if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer):
|
||||
- data = serializers.serialize('yaml', [Event(dt=dt)])
|
||||
+ data = serializers.serialize('yaml', [Event(dt=dt)], default_flow_style=None)
|
||||
self.assert_yaml_contains_datetime(data, "2011-09-01 13:20:30.405060")
|
||||
obj = next(serializers.deserialize('yaml', data)).object
|
||||
self.assertEqual(obj.dt, dt)
|
||||
@@ -691,7 +691,7 @@ def test_aware_datetime_with_microsecond(self):
|
||||
self.assertEqual(obj.dt, dt)
|
||||
|
||||
if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer):
|
||||
- data = serializers.serialize('yaml', [Event(dt=dt)])
|
||||
+ data = serializers.serialize('yaml', [Event(dt=dt)], default_flow_style=None)
|
||||
self.assert_yaml_contains_datetime(data, "2011-09-01 17:20:30.405060+07:00")
|
||||
obj = next(serializers.deserialize('yaml', data)).object
|
||||
self.assertEqual(obj.dt.replace(tzinfo=UTC), dt)
|
||||
@@ -715,7 +715,7 @@ def test_aware_datetime_in_utc(self):
|
||||
self.assertEqual(obj.dt, dt)
|
||||
|
||||
if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer):
|
||||
- data = serializers.serialize('yaml', [Event(dt=dt)])
|
||||
+ data = serializers.serialize('yaml', [Event(dt=dt)], default_flow_style=None)
|
||||
self.assert_yaml_contains_datetime(data, "2011-09-01 10:20:30+00:00")
|
||||
obj = next(serializers.deserialize('yaml', data)).object
|
||||
self.assertEqual(obj.dt.replace(tzinfo=UTC), dt)
|
||||
@@ -739,7 +739,7 @@ def test_aware_datetime_in_local_timezone(self):
|
||||
self.assertEqual(obj.dt, dt)
|
||||
|
||||
if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer):
|
||||
- data = serializers.serialize('yaml', [Event(dt=dt)])
|
||||
+ data = serializers.serialize('yaml', [Event(dt=dt)], default_flow_style=None)
|
||||
self.assert_yaml_contains_datetime(data, "2011-09-01 13:20:30+03:00")
|
||||
obj = next(serializers.deserialize('yaml', data)).object
|
||||
self.assertEqual(obj.dt.replace(tzinfo=UTC), dt)
|
||||
@@ -763,7 +763,7 @@ def test_aware_datetime_in_other_timezone(self):
|
||||
self.assertEqual(obj.dt, dt)
|
||||
|
||||
if not isinstance(serializers.get_serializer('yaml'), serializers.BadSerializer):
|
||||
- data = serializers.serialize('yaml', [Event(dt=dt)])
|
||||
+ data = serializers.serialize('yaml', [Event(dt=dt)], default_flow_style=None)
|
||||
self.assert_yaml_contains_datetime(data, "2011-09-01 17:20:30+07:00")
|
||||
obj = next(serializers.deserialize('yaml', data)).object
|
||||
self.assertEqual(obj.dt.replace(tzinfo=UTC), dt)
|
Loading…
Reference in New Issue
Block a user