From 1e172ddb31d33ad6261fef5a03ede0fbc30c3d36 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Mon, 8 Jul 2013 01:19:02 -0500 Subject: [PATCH] Python 2.6, EPEL5, EPEL6 --- python-dns.spec | 146 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 131 insertions(+), 15 deletions(-) diff --git a/python-dns.spec b/python-dns.spec index d9d938a..6e811d3 100644 --- a/python-dns.spec +++ b/python-dns.spec @@ -1,12 +1,28 @@ +%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%endif + +%undefine py2dir +%global py2dir %{_builddir}/dnspython/dnspython-%{version} + +%if 0%{?rhel} == 5 +%global with_python26 1 +%undefine py26dir +%global py26dir %{_builddir}/dnspython/dnspython26-%{version} +%{!?__python26: %global __python26 /usr/bin/python26} +%{!?python26_sitelib: %global python26_sitelib %(%{__python26} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%endif + %if 0%{?fedora} > 12 %global with_python3 1 -%else -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} +%undefine py3dir +%global py3dir %{_builddir}/dnspython/dnspython3-%{version} +%global py3unpack -a 2 %endif Name: python-dns Version: 1.11.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: DNS toolkit for Python Group: Development/Languages @@ -14,9 +30,14 @@ License: MIT URL: http://www.dnspython.org/ Source0: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz Source1: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz.asc +%if 0%{?with_python3} Source2: http://www.dnspython.org/kits3/%{version}/dnspython3-%{version}.tar.gz Source3: http://www.dnspython.org/kits3/%{version}/dnspython3-%{version}.tar.gz.asc -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +%endif +%if 0%{?rhel} == 5 +Patch0: 0001-Don-t-fail-on-older-python-versions-because-of-hashe.patch +%endif +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildArch: noarch @@ -24,6 +45,16 @@ BuildRequires: python2-devel # for tests BuildRequires: python-crypto +%if 0%{?rhel} == 5 +BuildRequires: python-setuptools +%endif + +%if 0%{?with_python26} +BuildRequires: python26-devel +# for tests +BuildRequires: python26-crypto +%endif + %if 0%{?with_python3} BuildRequires: python3-devel # for tests @@ -43,6 +74,24 @@ level classes perform queries for data of a given name, type, and class, and return an answer set. The low level classes allow direct manipulation of DNS zones, messages, names, and records. +%if 0%{?with_python26} +%package -n python26-dns +Summary: DNS toolkit for Python 2.6 +Group: Development/Languages + +# for DNSSEC support +Requires: python26-crypto + +%description -n python26-dns +dnspython is a DNS toolkit for Python. It supports almost all record +types. It can be used for queries, zone transfers, and dynamic +updates. It supports TSIG authenticated messages and EDNS0. + +dnspython provides both high and low level access to DNS. The high +level classes perform queries for data of a given name, type, and +class, and return an answer set. The low level classes allow direct +manipulation of DNS zones, messages, names, and records. +%endif %if 0%{?with_python3} %package -n python3-dns @@ -53,8 +102,8 @@ Group: Development/Languages Requires: python3-crypto %description -n python3-dns -dnspython3 is a DNS toolkit for Python 3. It supports almost all record -types. It can be used for queries, zone transfers, and dynamic +dnspython3 is a DNS toolkit for Python 3. It supports almost all +record types. It can be used for queries, zone transfers, and dynamic updates. It supports TSIG authenticated messages and EDNS0. dnspython3 provides both high and low level access to DNS. The high @@ -64,20 +113,46 @@ manipulation of DNS zones, messages, names, and records. %endif %prep -%setup -q -T -c -n dnspython-%{version} -a 0 -a 2 +%setup -q -T -c -n dnspython -a 0 %{?py3unpack:%{py3unpack}} # strip executable permissions so that we don't pick up dependencies # from documentation -find dnspython-%{version}/examples -type f | xargs chmod a-x -find dnspython3-%{version}/examples -type f | xargs chmod a-x +find %{py2dir}/examples -type f | xargs chmod a-x +%if 0%{?with_python3} +find %{py3dir}/examples -type f | xargs chmod a-x +%endif + +%if 0%{?with_python26} +pushd %{py2dir} +rm -rf %{py26dir} +cp -a . %{py26dir} +find %{py26dir} -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python26}|' +popd +%endif + +%if 0%{?rhel} == 5 +pushd %{py2dir} +%patch0 -p1 +popd +%endif %build -pushd dnspython-%{version} +pushd %{py2dir} +%if 0%{?rhel} == 5 +%{__python} -c 'import setuptools; execfile("setup.py")' build +%else %{__python} setup.py build +%endif popd +%if 0%{?with_python26} +pushd %{py26dir} +%{__python26} setup.py build +popd +%endif + %if 0%{?with_python3} -pushd dnspython3-%{version} +pushd %{py3dir} %{__python3} setup.py build popd %endif @@ -85,30 +160,59 @@ popd %install rm -rf %{buildroot} -pushd dnspython-%{version} +pushd %{py2dir} +%if 0%{?rhel} == 5 +%{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot} +%else %{__python} setup.py install --skip-build --root %{buildroot} +%endif popd +%if 0%{?with_python26} +pushd %{py26dir} +%{__python26} setup.py install --skip-build --root %{buildroot} +popd +%endif + %if 0%{?with_python3} -pushd dnspython3-%{version} +pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} popd %endif %check -pushd dnspython-%{version}/tests +pushd %{py2dir}/tests # skip one test because it queries the network +# dnssec tests fail in RHEL5 Python 2.4 due to the +# lack of some hashes for py in *.py do +%if 0%{?rhel} == 5 + if [ $py != resolver.py -a $py != dnssec.py -a $py != grange.py ] +%else if [ $py != resolver.py ] +%endif then PYTHONPATH=%{buildroot}%{python_sitelib} %{__python} $py fi done popd +%if 0%{?with_python26} +pushd %{py26dir}/tests +# skip one test because it queries the network +for py in *.py +do + if [ $py != resolver.py ] + then + PYTHONPATH=%{buildroot}%{python26_sitelib} %{__python26} $py + fi +done +popd +%endif + %if 0%{?with_python3} -pushd dnspython3-%{version}/tests +pushd %{py3dir}/tests # skip one test because it queries the network for py in *.py do @@ -130,6 +234,15 @@ rm -rf %{buildroot} %{python_sitelib}/*egg-info %{python_sitelib}/dns +%if 0%{?with_python26} +%files -n python26-dns +%defattr(-,root,root,-) +%doc dnspython26-%{version}/{ChangeLog,LICENSE,README,examples} + +%{python26_sitelib}/*egg-info +%{python26_sitelib}/dns +%endif + %if 0%{?with_python3} %files -n python3-dns %defattr(-,root,root,-) @@ -140,6 +253,9 @@ rm -rf %{buildroot} %endif %changelog +* Sun Jul 7 2013 Jeffrey C. Ollie - 1.11.0-2 +- Integrate Python 2.6 packaging, EPEL5, EPEL6 support + * Sun Jul 7 2013 Jeffrey C. Ollie - 1.11.0-1 - New since 1.10.0: -