14
0
forked from pool/python-py3dns

- Initial package, used by libravatar

- Add patches from Fedora to fix build:
  * python3-py3dns-handle-absent-resolv.patch
  * python3-py3dns-py3_friendly_warning.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-py3dns?expand=0&rev=1
This commit is contained in:
Tomáš Chvátal
2018-08-02 08:42:45 +00:00
committed by Git OBS Bridge
commit 1902e000b9
7 changed files with 147 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
py3dns-3.2.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e88c0648c4d38a880f08aeb05a6e5cb48b8ce2602d381caafc6c71698ee3c21
size 30482

7
python-py3dns.changes Normal file
View File

@@ -0,0 +1,7 @@
-------------------------------------------------------------------
Thu Aug 2 08:34:17 UTC 2018 - tchvatal@suse.com
- Initial package, used by libravatar
- Add patches from Fedora to fix build:
* python3-py3dns-handle-absent-resolv.patch
* python3-py3dns-py3_friendly_warning.patch

62
python-py3dns.spec Normal file
View File

@@ -0,0 +1,62 @@
#
# spec file for package python-py3dns
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-py3dns
Version: 3.2.0
Release: 0
Summary: Python module for DNS (Domain Name Service)
License: CNRI-Python
Group: Development/Languages/Python
URL: https://launchpad.net/py3dns
Source: https://files.pythonhosted.org/packages/source/p/py3dns/py3dns-%{version}.tar.gz
Patch0: python3-py3dns-handle-absent-resolv.patch
Patch1: python3-py3dns-py3_friendly_warning.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
This package contains a module (dnslib) that implements a DNS
(Domain Name Server) client, plus additional modules that define some
symbolic constants used by DNS (dnstype, dnsclass, dnsopcode).
%prep
%setup -q -n py3dns-%{version}
%autopatch -p1
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# Unable to run tests without resolv.conf and net
#%%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python test.py
%files %{python_files}
%license LICENSE
%doc README* CHANGES
%{python_sitelib}/*
%changelog

View File

@@ -0,0 +1,40 @@
From c95cb269a6f0cb57c1204c29bec30d40e41eb2ef Mon Sep 17 00:00:00 2001
From: Ralph Bean <rbean@redhat.com>
Date: Thu, 2 Feb 2017 12:19:00 -0500
Subject: [PATCH] Handle /etc/resolv.conf
---
DNS/Base.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/DNS/Base.py b/DNS/Base.py
index 4a70613..b5d97c8 100644
--- a/DNS/Base.py
+++ b/DNS/Base.py
@@ -11,7 +11,7 @@ Changes for Python3 port © 2011-14 Scott Kitterman <scott@kitterman.com>
Base functionality. Request and Response classes, that sort of thing.
"""
-import socket, string, types, time, select
+import socket, string, types, time, select, warnings
from . import Type,Class,Opcode
import asyncore
#
@@ -49,8 +49,12 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY,
def ParseResolvConf(resolv_path="/etc/resolv.conf"):
"parses the /etc/resolv.conf file and sets defaults for name servers"
- with open(resolv_path, 'r') as stream:
- return ParseResolvConfFromIterable(stream)
+ try:
+ with open(resolv_path, 'r') as stream:
+ return ParseResolvConfFromIterable(stream)
+ except FileNotFoundError as e:
+ warnings.warn(e)
+ return
def ParseResolvConfFromIterable(lines):
"parses a resolv.conf formatted stream and sets defaults for name servers"
--
2.9.3

View File

@@ -0,0 +1,11 @@
--- a/DNS/Base.py 2018-03-27 21:22:25.000000000 +0000
+++ b/DNS/Base.py 2018-03-27 21:21:57.000000000 +0000
@@ -53,7 +53,7 @@
with open(resolv_path, 'r') as stream:
return ParseResolvConfFromIterable(stream)
except FileNotFoundError as e:
- warnings.warn(e)
+ warnings.warn(str(e))
return
def ParseResolvConfFromIterable(lines):