Python 2.6, EPEL5, EPEL6

This commit is contained in:
Jeffrey C. Ollie 2013-07-08 01:19:02 -05:00
parent 6df45c3662
commit 1e172ddb31

View File

@ -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 %if 0%{?fedora} > 12
%global with_python3 1 %global with_python3 1
%else %undefine py3dir
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %global py3dir %{_builddir}/dnspython/dnspython3-%{version}
%global py3unpack -a 2
%endif %endif
Name: python-dns Name: python-dns
Version: 1.11.0 Version: 1.11.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: DNS toolkit for Python Summary: DNS toolkit for Python
Group: Development/Languages Group: Development/Languages
@ -14,9 +30,14 @@ License: MIT
URL: http://www.dnspython.org/ URL: http://www.dnspython.org/
Source0: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz Source0: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz
Source1: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz.asc 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 Source2: http://www.dnspython.org/kits3/%{version}/dnspython3-%{version}.tar.gz
Source3: http://www.dnspython.org/kits3/%{version}/dnspython3-%{version}.tar.gz.asc 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 BuildArch: noarch
@ -24,6 +45,16 @@ BuildRequires: python2-devel
# for tests # for tests
BuildRequires: python-crypto 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} %if 0%{?with_python3}
BuildRequires: python3-devel BuildRequires: python3-devel
# for tests # 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 class, and return an answer set. The low level classes allow direct
manipulation of DNS zones, messages, names, and records. 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} %if 0%{?with_python3}
%package -n python3-dns %package -n python3-dns
@ -53,8 +102,8 @@ Group: Development/Languages
Requires: python3-crypto Requires: python3-crypto
%description -n python3-dns %description -n python3-dns
dnspython3 is a DNS toolkit for Python 3. It supports almost all record dnspython3 is a DNS toolkit for Python 3. It supports almost all
types. It can be used for queries, zone transfers, and dynamic record types. It can be used for queries, zone transfers, and dynamic
updates. It supports TSIG authenticated messages and EDNS0. updates. It supports TSIG authenticated messages and EDNS0.
dnspython3 provides both high and low level access to DNS. The high 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 %endif
%prep %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 # strip executable permissions so that we don't pick up dependencies
# from documentation # from documentation
find dnspython-%{version}/examples -type f | xargs chmod a-x find %{py2dir}/examples -type f | xargs chmod a-x
find dnspython3-%{version}/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 %build
pushd dnspython-%{version} pushd %{py2dir}
%if 0%{?rhel} == 5
%{__python} -c 'import setuptools; execfile("setup.py")' build
%else
%{__python} setup.py build %{__python} setup.py build
%endif
popd popd
%if 0%{?with_python26}
pushd %{py26dir}
%{__python26} setup.py build
popd
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
pushd dnspython3-%{version} pushd %{py3dir}
%{__python3} setup.py build %{__python3} setup.py build
popd popd
%endif %endif
@ -85,30 +160,59 @@ popd
%install %install
rm -rf %{buildroot} 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} %{__python} setup.py install --skip-build --root %{buildroot}
%endif
popd popd
%if 0%{?with_python26}
pushd %{py26dir}
%{__python26} setup.py install --skip-build --root %{buildroot}
popd
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
pushd dnspython3-%{version} pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot} %{__python3} setup.py install --skip-build --root %{buildroot}
popd popd
%endif %endif
%check %check
pushd dnspython-%{version}/tests pushd %{py2dir}/tests
# skip one test because it queries the network # 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 for py in *.py
do do
%if 0%{?rhel} == 5
if [ $py != resolver.py -a $py != dnssec.py -a $py != grange.py ]
%else
if [ $py != resolver.py ] if [ $py != resolver.py ]
%endif
then then
PYTHONPATH=%{buildroot}%{python_sitelib} %{__python} $py PYTHONPATH=%{buildroot}%{python_sitelib} %{__python} $py
fi fi
done done
popd 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} %if 0%{?with_python3}
pushd dnspython3-%{version}/tests pushd %{py3dir}/tests
# skip one test because it queries the network # skip one test because it queries the network
for py in *.py for py in *.py
do do
@ -130,6 +234,15 @@ rm -rf %{buildroot}
%{python_sitelib}/*egg-info %{python_sitelib}/*egg-info
%{python_sitelib}/dns %{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} %if 0%{?with_python3}
%files -n python3-dns %files -n python3-dns
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -140,6 +253,9 @@ rm -rf %{buildroot}
%endif %endif
%changelog %changelog
* Sun Jul 7 2013 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.11.0-2
- Integrate Python 2.6 packaging, EPEL5, EPEL6 support
* Sun Jul 7 2013 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.11.0-1 * Sun Jul 7 2013 Jeffrey C. Ollie <jeff@ocjtech.us> - 1.11.0-1
- New since 1.10.0: - New since 1.10.0:
- -