forked from pool/python-ZConfig
Accepting request 905798 from devel:languages:python
- Update to 3.6.0
* Added support for Python 3.8, 3.9 and 3.10. This primarily
involves avoiding the new-in-3.8 validation of the format
string when using the ‘safe-template’ format style, since
that’s not supported in the Python standard library.
* Added ZConfig.pygments module containing a lexer compatible
with the pygments library. Made discoverable via an entry
point; use zconfig as the highlight language for code-block
directives in Sphinx documents.
- Drop patch python-38-support.patch that was integrated upstream.
OBS-URL: https://build.opensuse.org/request/show/905798
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-ZConfig?expand=0&rev=8
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a094e492ac31025f5b5a58b32a7c7f03e2e2899c8beb4c1601ea00653bf3ea68
|
||||
size 127317
|
||||
3
ZConfig-3.6.0.tar.gz
Normal file
3
ZConfig-3.6.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a28e95a0ae335795747eccad35b2cb708f37d44c7f325e2acb201e98330b16e5
|
||||
size 134559
|
||||
@@ -1,163 +0,0 @@
|
||||
From f0c2990d35ac3c924ecc8be4a5c71c8e4abbd0e5 Mon Sep 17 00:00:00 2001
|
||||
From: Fred Drake <fred.drake@keepertech.com>
|
||||
Date: Tue, 17 Sep 2019 19:25:20 -0400
|
||||
Subject: [PATCH 1/4] update to tolerate logging.Formatter validation
|
||||
|
||||
- required to work with Python 3.8
|
||||
- closes issue #69
|
||||
---
|
||||
ZConfig/components/logger/formatter.py | 11 +++++++-
|
||||
.../components/logger/tests/test_formatter.py | 28 ++++++++++++++-----
|
||||
2 files changed, 31 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/ZConfig/components/logger/formatter.py b/ZConfig/components/logger/formatter.py
|
||||
index 512f5da..6cf464e 100644
|
||||
--- a/ZConfig/components/logger/formatter.py
|
||||
+++ b/ZConfig/components/logger/formatter.py
|
||||
@@ -248,8 +248,17 @@ def __call__(self):
|
||||
else:
|
||||
# A formatter class that supports style, but our style is
|
||||
# non-standard, so we reach under the covers a bit.
|
||||
+ #
|
||||
+ # Python 3.8 adds a validate option, defaulting to True,
|
||||
+ # which cases the format string to be checked. Since
|
||||
+ # safe-template is not a standard style, we want to
|
||||
+ # suppress this.
|
||||
+ #
|
||||
+ kwargs = dict()
|
||||
+ if sys.version_info >= (3, 8):
|
||||
+ kwargs['validate'] = False
|
||||
formatter = self.factory(self.format, self.dateformat,
|
||||
- style='$')
|
||||
+ style='$', **kwargs)
|
||||
assert formatter._style._fmt == self.format
|
||||
formatter._style = stylist
|
||||
else:
|
||||
diff --git a/ZConfig/components/logger/tests/test_formatter.py b/ZConfig/components/logger/tests/test_formatter.py
|
||||
index 81c7235..3a04a5f 100644
|
||||
--- a/ZConfig/components/logger/tests/test_formatter.py
|
||||
+++ b/ZConfig/components/logger/tests/test_formatter.py
|
||||
@@ -25,6 +25,17 @@
|
||||
import ZConfig.components.logger.tests.support
|
||||
|
||||
|
||||
+# In Python 3.8, a KeyError raised by string interpolation is re-written
|
||||
+# into a ValueError reporting a reference to an undefined field. We're
|
||||
+# not masking the exception, but we want to check for the right one in
|
||||
+# the tests below (without catching anything else).
|
||||
+#
|
||||
+if sys.version_info >= (3, 8):
|
||||
+ MissingFieldError = ValueError
|
||||
+else:
|
||||
+ MissingFieldError = KeyError
|
||||
+
|
||||
+
|
||||
class LogFormatStyleTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@@ -314,7 +325,10 @@ class CustomFormatterFactoryWithoutStyleParamTestCase(
|
||||
class StylelessFormatter(logging.Formatter):
|
||||
|
||||
def __init__(self, fmt=None, datefmt=None):
|
||||
- logging.Formatter.__init__(self, fmt=fmt, datefmt=datefmt)
|
||||
+ kwargs = dict()
|
||||
+ if sys.version_info >= (3, 8):
|
||||
+ kwargs['validate'] = False
|
||||
+ logging.Formatter.__init__(self, fmt=fmt, datefmt=datefmt, **kwargs)
|
||||
|
||||
|
||||
def styleless_formatter(fmt=None, datefmt=None):
|
||||
@@ -552,9 +566,9 @@ def test_classic_arbitrary_field_missing(self):
|
||||
arbitrary_fields=True)
|
||||
|
||||
# The formatter still breaks when it references an undefined field:
|
||||
- with self.assertRaises(KeyError) as cm:
|
||||
+ with self.assertRaises(MissingFieldError) as cm:
|
||||
formatter.format(self.record)
|
||||
- self.assertEqual(str(cm.exception), "'undefined_field'")
|
||||
+ self.assertIn("'undefined_field'", str(cm.exception))
|
||||
|
||||
def test_classic_arbitrary_field_present(self):
|
||||
formatter = self.get_formatter(
|
||||
@@ -574,9 +588,9 @@ def test_format_arbitrary_field_missing(self):
|
||||
arbitrary_fields=True)
|
||||
|
||||
# The formatter still breaks when it references an undefined field:
|
||||
- with self.assertRaises(KeyError) as cm:
|
||||
+ with self.assertRaises(MissingFieldError) as cm:
|
||||
formatter.format(self.record)
|
||||
- self.assertEqual(str(cm.exception), "'undefined_field'")
|
||||
+ self.assertIn("'undefined_field'", str(cm.exception))
|
||||
|
||||
def test_format_arbitrary_field_present(self):
|
||||
formatter = self.get_formatter(
|
||||
@@ -596,9 +610,9 @@ def test_template_arbitrary_field_missing(self):
|
||||
arbitrary_fields=True)
|
||||
|
||||
# The formatter still breaks when it references an undefined field:
|
||||
- with self.assertRaises(KeyError) as cm:
|
||||
+ with self.assertRaises(MissingFieldError) as cm:
|
||||
formatter.format(self.record)
|
||||
- self.assertEqual(str(cm.exception), "'undefined_field'")
|
||||
+ self.assertIn("'undefined_field'", str(cm.exception))
|
||||
|
||||
def test_template_arbitrary_field_present(self):
|
||||
formatter = self.get_formatter(
|
||||
|
||||
From 42a09a17048fee4c6b880ea3fc215f6abe5b51eb Mon Sep 17 00:00:00 2001
|
||||
From: Fred Drake <fred.drake@keepertech.com>
|
||||
Date: Tue, 17 Sep 2019 19:43:27 -0400
|
||||
Subject: [PATCH 2/4] add python 3.8 to tox, travis configs
|
||||
|
||||
---
|
||||
.travis.yml | 1 +
|
||||
tox.ini | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.travis.yml b/.travis.yml
|
||||
index 9dd3331..f46558a 100644
|
||||
--- a/.travis.yml
|
||||
+++ b/.travis.yml
|
||||
@@ -7,6 +7,7 @@ python:
|
||||
- 3.5
|
||||
- 3.6
|
||||
- 3.7
|
||||
+ - 3.8-dev
|
||||
- pypy
|
||||
- pypy3
|
||||
|
||||
diff --git a/tox.ini b/tox.ini
|
||||
index 7a9860b..4c7f8cd 100644
|
||||
--- a/tox.ini
|
||||
+++ b/tox.ini
|
||||
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
-envlist = py27,py34,py35,py36,py37,pypy,coverage-report
|
||||
+envlist = py27,py34,py35,py36,py37,py38,pypy,coverage-report
|
||||
skip_missing_interpreters = true
|
||||
|
||||
[testenv]
|
||||
|
||||
From 61accf2c5d64f23ecaef4b4f7a13207dd4b3fa29 Mon Sep 17 00:00:00 2001
|
||||
From: Fred Drake <fred.drake@keepertech.com>
|
||||
Date: Wed, 18 Sep 2019 08:35:38 -0700
|
||||
Subject: [PATCH 3/4] fix typo in comment (ZConfig.components.logger.formatter)
|
||||
|
||||
Co-Authored-By: Jason Madden <jamadden@gmail.com>
|
||||
---
|
||||
ZConfig/components/logger/formatter.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ZConfig/components/logger/formatter.py b/ZConfig/components/logger/formatter.py
|
||||
index 6cf464e..009630d 100644
|
||||
--- a/ZConfig/components/logger/formatter.py
|
||||
+++ b/ZConfig/components/logger/formatter.py
|
||||
@@ -250,7 +250,7 @@ def __call__(self):
|
||||
# non-standard, so we reach under the covers a bit.
|
||||
#
|
||||
# Python 3.8 adds a validate option, defaulting to True,
|
||||
- # which cases the format string to be checked. Since
|
||||
+ # which causes the format string to be checked. Since
|
||||
# safe-template is not a standard style, we want to
|
||||
# suppress this.
|
||||
#
|
||||
@@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Jul 11 19:18:44 UTC 2021 - Jason Craig <os@jacraig.com>
|
||||
|
||||
- Update to 3.6.0
|
||||
* Added support for Python 3.8, 3.9 and 3.10. This primarily
|
||||
involves avoiding the new-in-3.8 validation of the format
|
||||
string when using the ‘safe-template’ format style, since
|
||||
that’s not supported in the Python standard library.
|
||||
* Added ZConfig.pygments module containing a lexer compatible
|
||||
with the pygments library. Made discoverable via an entry
|
||||
point; use zconfig as the highlight language for code-block
|
||||
directives in Sphinx documents.
|
||||
- Drop patch python-38-support.patch that was integrated upstream.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 25 01:54:32 UTC 2019 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-ZConfig
|
||||
#
|
||||
# Copyright (c) 2019 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -18,15 +18,13 @@
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-ZConfig
|
||||
Version: 3.5.0
|
||||
Version: 3.6.0
|
||||
Release: 0
|
||||
Summary: Structured Configuration Library
|
||||
License: ZPL-2.1
|
||||
Group: Development/Libraries/Python
|
||||
URL: https://github.com/zopefoundation/ZConfig
|
||||
Source: https://files.pythonhosted.org/packages/source/Z/ZConfig/ZConfig-%{version}.tar.gz
|
||||
# UPSTREAM PATCH (partial): gh#zopefoundation/ZConfig#70
|
||||
Patch0: python-38-support.patch
|
||||
# Testing requirements:
|
||||
BuildRequires: %{python_module docutils}
|
||||
BuildRequires: %{python_module manuel}
|
||||
@@ -36,7 +34,7 @@ BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-setuptools
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
@@ -66,7 +64,6 @@ This package contains documentation files for %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q -n ZConfig-%{version}
|
||||
%autopatch -p1
|
||||
rm -rf ZConfig.egg-info
|
||||
rm doc/make.bat
|
||||
# test works only in git repo
|
||||
|
||||
Reference in New Issue
Block a user