From 2cd4f437e5f733b85cce1982eb367ea2ac76b05a Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Thu, 2 Dec 2010 10:23:46 -0600 Subject: [PATCH] - Build Python 2.6 subpackage for EPEL 5 --- python-dns.spec | 83 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 5 deletions(-) diff --git a/python-dns.spec b/python-dns.spec index db6dedf..89b0103 100644 --- a/python-dns.spec +++ b/python-dns.spec @@ -1,8 +1,18 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%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 + +%if 0%{?rhel} == 5 +%global with_python26 1 +%{!?py26dir: %global py26dir %{_builddir}/python26-%{name}-%{version}-%{release}} +%{!?__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 + Name: python-dns Version: 1.9.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: DNS toolkit for Python Group: Development/Languages @@ -13,10 +23,15 @@ Source1: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.ta BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -%if 0%{?fedora} >= 8 -BuildRequires: python-setuptools-devel +BuildRequires: python-devel +%if 0%{?fedora} > 8 +BuildRequires: python-setuptools-devel %else -BuildRequires: python-setuptools +BuildRequires: python-setuptools +%endif + +%if 0%{?with_python26} +BuildRequires: python26-devel %endif %description @@ -29,6 +44,22 @@ 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 + +%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 + %prep %setup0 -q -n dnspython-%{version} @@ -36,13 +67,31 @@ manipulation of DNS zones, messages, names, and records. # from documentation find examples -type f | xargs chmod a-x +%if 0%{?with_python26} +rm -rf %{py26dir} +cp -a . %{py26dir} +find %{py26dir} -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python26}|' +%endif + %build CFLAGS="%{optflags}" %{__python} -c 'import setuptools; execfile("setup.py")' build +%if 0%{?with_python26} +pushd %{py26dir} +CFLAGS="%{optflags}" %{__python26} setup.py build +popd +%endif + %install rm -rf %{buildroot} %{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot} +%if 0%{?with_python26} +pushd %{py26dir} +CFLAGS="%{optflags}" %{__python26} setup.py install --skip-build --root %{buildroot} +popd +%endif + %check pushd tests # skip one test because it queries the network @@ -54,6 +103,18 @@ do fi done +%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 +%endif + %clean rm -rf %{buildroot} @@ -64,7 +125,19 @@ rm -rf %{buildroot} %{python_sitelib}/*egg-info %{python_sitelib}/dns +%if 0%{?with_python26} +%files -n python26-dns +%defattr(-,root,root,-) +%doc ChangeLog LICENSE README TODO examples + +%{python26_sitelib}/*egg-info +%{python26_sitelib}/dns +%endif + %changelog +* Thu Dec 2 2010 Jeffrey C. Ollie - 1.9.2-2 +- Build Python 2.6 subpackage for EPEL 5 + * Tue Nov 23 2010 Jeffrey C. Ollie - 1.9.2-1 - It's brown paper bag time :) The fix for the import problems was - actually bad, but didn't show up in testing because the test suite's