Blob Blame History Raw
%global modname DNS
%global distname py3dns

Name:               python3-py3dns
Version:            3.0.4
Release:            2%{?dist}
Summary:            Python3 DNS library

Group:              Development/Libraries
License:            Python
URL:                https://launchpad.net/py3dns/
Source0:            http://pypi.python.org/packages/source/p/%{distname}/%{distname}-%{version}.tar.gz

# At buildtime, py3dns tries to read in /etc/resolv.conf and crashes if it
# doesn't exist.  Our koji builders don't have that file.  This patch just
# avoids the crash if that file is absent.
Patch0:             python3-py3dns-handle-absent-resolv.patch

BuildArch:          noarch

BuildRequires:      python3-devel

%description
This Python 3 module provides a DNS API for looking up DNS entries from
within Python 3 modules and applications. This module is a simple,
lightweight implementation.


%prep
%setup -q -n %{distname}-%{version}
%patch0 -p1

# Remove bundled egg-info in case it exists
rm -rf %{distname}.egg-info

# Some files are latin-1 encoded but are incorrectly labelled as UTF-8 by
# upstream (see rhbz:620265)
#
# Convert them to actually be UTF-8, preserving the (now-correct) encoding
# declaration (preserving timestamps):
for file in DNS/Lib.py DNS/Type.py ; do
    iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
    touch -r $file $file.new && \
    mv $file.new $file
done

%build
%{__python3} setup.py build

%install
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}

# We cannot actually run the tests in koji because they require network access.
#%%check
#PYTHONPATH=$(pwd) %%{__python3} tests/test.py
#PYTHONPATH=$(pwd) %%{__python3} tests/test2.py
#PYTHONPATH=$(pwd) %%{__python3} tests/test4.py
##PYTHONPATH=$(pwd) %%{__python3} tests/test5.py somedomain.com
#PYTHONPATH=$(pwd) %%{__python3} tests/testPackers.py
#PYTHONPATH=$(pwd) %%{__python3} tests/testsrv.py

%files
%doc README.txt README-guido.txt LICENSE CREDITS.txt CHANGES
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{distname}-%{version}*

%changelog
* Tue Sep 24 2013 Ralph Bean <rbean@redhat.com> - 3.0.4-2
- Update with comments from review.

* Mon Sep 23 2013 Ralph Bean <rbean@redhat.com> - 3.0.4-1
- Initial package for Fedora