Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-localzone for
openSUSE:Factory checked in at 2021-01-19 16:02:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-localzone (Old)
and /work/SRC/openSUSE:Factory/.python-localzone.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-localzone"
Tue Jan 19 16:02:34 2021 rev:5 rq:864143 version:0.9.7
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-localzone/python-localzone.changes
2020-04-15 19:56:07.973646980 +0200
+++
/work/SRC/openSUSE:Factory/.python-localzone.new.28504/python-localzone.changes
2021-01-19 16:03:02.319456472 +0100
@@ -1,0 +2,7 @@
+Mon Jan 18 14:00:08 UTC 2021 - Benjamin Greiner <[email protected]>
+
+- Update to version 0.9.7
+ * Support dnspython 2.
+- Add localzone-dnspython-2.1.patch gh#ags-slc/localzone#3
+
+-------------------------------------------------------------------
Old:
----
v0.9.6.tar.gz
New:
----
localzone-0.9.7.tar.gz
localzone-dnspython-2.1.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-localzone.spec ++++++
--- /var/tmp/diff_new_pack.CkYGQd/_old 2021-01-19 16:03:03.175457759 +0100
+++ /var/tmp/diff_new_pack.CkYGQd/_new 2021-01-19 16:03:03.175457759 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-localzone
#
-# Copyright (c) 2020 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,13 +18,16 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-localzone
-Version: 0.9.6
+Version: 0.9.7
Release: 0
Summary: A library for managing DNS zones
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/ags-slc/localzone
-Source: https://github.com/ags-slc/localzone/archive/v%{version}.tar.gz
+# The PyPI sdist does not provide the tests
+Source:
https://github.com/ags-slc/localzone/archive/v%{version}.tar.gz#/localzone-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM localzone-dnspython-2.1.patch gh#ags-slc/localzone#3 --
support dnspython 2.1
+Patch0:
https://github.com/ags-slc/localzone/pull/3.patch#/localzone-dnspython-2.1.patch
BuildRequires: %{python_module dnspython}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
@@ -38,7 +41,7 @@
A simple library for managing DNS zones.
%prep
-%setup -q -n localzone-%{version}
+%autosetup -p1 -n localzone-%{version}
%build
%python_build
@@ -53,6 +56,7 @@
%files %{python_files}
%doc README.rst
%license LICENSE
-%{python_sitelib}/*
+%{python_sitelib}/localzone
+%{python_sitelib}/localzone-%{version}*-info
%changelog
++++++ localzone-dnspython-2.1.patch ++++++
>From c508257d6478e75a74a2fe0c9e770ef89c50eb41 Mon Sep 17 00:00:00 2001
From: Ben Greiner <[email protected]>
Date: Mon, 18 Jan 2021 19:05:03 +0100
Subject: [PATCH] add support for dnspython 2.1
---
localzone/context.py | 69 +++++++++++++++++++++++++++++--------------
tests/test_context.py | 5 +++-
tests/test_models.py | 3 +-
3 files changed, 53 insertions(+), 24 deletions(-)
diff --git a/localzone/context.py b/localzone/context.py
index 8da5048..7354c4a 100644
--- a/localzone/context.py
+++ b/localzone/context.py
@@ -13,6 +13,14 @@
import dns.rdataclass
import dns.tokenizer
import dns.zone
+try:
+ # The api for the zonefile reader was exposed in dnspython 2.1
+ from dns.zonefile import Reader
+ DNSPYTHON21 = True
+except ImportError:
+ from dns.zone import _MasterReader
+ DNSPYTHON21 = False
+
from .models import Zone
@@ -57,25 +65,42 @@ def load(filename, origin=None):
"""
with open(filename) as text:
tok = dns.tokenizer.Tokenizer(text, filename)
- reader = dns.zone._MasterReader(
- tok,
- origin=origin,
- rdclass=dns.rdataclass.IN,
- relativize=True,
- zone_factory=Zone,
- allow_include=True,
- check_origin=True,
- )
- reader.read()
-
- # TODO: remember that any method using the zone.filename property
should
- # have it passed as a parameter
- reader.zone._filename = filename
-
- # starting with dnspython v1.16.0, use default_ttl
- try:
- reader.zone._ttl = reader.default_ttl
- except AttributeError:
- reader.zone._ttl = reader.ttl
-
- return reader.zone
+ if DNSPYTHON21:
+ zone = Zone(
+ origin,
+ dns.rdataclass.IN,
+ relativize=True,
+ )
+ with zone.writer() as txn:
+ reader = Reader(
+ tok,
+ rdclass=dns.rdataclass.IN,
+ txn=txn,
+ allow_include=True,
+ )
+ reader.read()
+ else:
+ reader = _MasterReader(
+ tok,
+ origin=origin,
+ rdclass=dns.rdataclass.IN,
+ relativize=True,
+ zone_factory=Zone,
+ allow_include=True,
+ check_origin=True,
+ )
+ reader.read()
+ zone = reader.zone
+
+ # TODO: remember that any method using the zone.filename property should
+ # have it passed as a parameter
+ zone._filename = filename
+
+ # starting with dnspython v1.16.0, use default_ttl
+ try:
+ zone._ttl = reader.default_ttl
+ except AttributeError:
+ zone._ttl = reader.ttl
+
+ return zone
+
diff --git a/tests/test_context.py b/tests/test_context.py
index 2a32d00..baac084 100644
--- a/tests/test_context.py
+++ b/tests/test_context.py
@@ -1,6 +1,9 @@
import pytest
import localzone
-from dns.zone import UnknownOrigin
+try:
+ from dns.zonefile import UnknownOrigin
+except ImportError:
+ from dns.zone import UnknownOrigin
ZONEFILE = "tests/zonefiles/db.example.com"
ORIGIN = "example.com."
diff --git a/tests/test_models.py b/tests/test_models.py
index 9ba0c40..621f6c0 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -1,4 +1,5 @@
from dns.rdatatype import UnknownRdatatype
+from dns.exception import SyntaxError as DNSSyntaxError
import pytest
import localzone
@@ -77,7 +78,7 @@ def test_zone_add_record_unknown_type():
def test_zone_add_record_no_content():
with localzone.manage(ZONEFILE, ORIGIN) as z:
- with pytest.raises(AttributeError):
+ with pytest.raises((AttributeError, DNSSyntaxError)):
z.add_record("test", "txt", None)