Blob Blame History Raw
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%global with_python3 1

Name:           python-iptools
Version:        0.6.1
Release:        4%{?dist}
Summary:        A few useful functions and objects for manipulating IP addresses in python

License:        BSD
URL:            https://github.com/bd808/%{name}
Source0:        https://github.com/bd808/%{name}/archive/v%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python-nose
BuildRequires:  python-setuptools
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-nose
BuildRequires:  python3-setuptools
%endif # if with_python3

%description
A few useful functions and objects for manipulating IPv4 and IPv6 addresses
in python. The project was inspired by a desire to be able to use CIDR address
notation to designate INTERNAL_IPS in a Django project's settings file.


%if 0%{?with_python3}
%package -n python3-iptools
Summary:        A few useful functions and objects for manipulating IP addresses in python 3
Group:          Applications/System

%description -n python3-iptools
A few useful functions and objects for manipulating IPv4 and IPv6 addresses
in python. The project was inspired by a desire to be able to use CIDR address
notation to designate INTERNAL_IPS in a Django project's settings file.
%endif # if with_python3


%prep
%setup -q
find -name .gitignore -delete

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3


%install
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

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


%check
%{__python} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3

 
%files
%doc AUTHORS CHANGES docs LICENSE README.md
%{python_sitelib}/*

%if 0%{?with_python3}
%files -n python3-iptools
%doc AUTHORS CHANGES docs LICENSE README.md
%{python3_sitelib}/*
%endif # with_python3


%changelog
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri May 02 2014 Orion Poplawski <orion@cora.nwra.com> - 0.6.1-3
- Rebuild for Python 3.4

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Apr 22 2013 Orion Poplawski <orion@cora.nwra.com> - 0.6.1-1
- Update to 0.6.1

* Fri Apr 19 2013 Orion Poplawski <orion@cora.nwra.com> - 0.6.0-4
- Remove install dir rm in %%install

* Fri Apr 19 2013 Orion Poplawski <orion@cora.nwra.com> - 0.6.0-3
- Cleanup macros

* Sun Apr 7 2013 Orion Poplawski <orion@cora.nwra.com> - 0.6.0-2
- Add BR python-setuptools
- Add %%check

* Sat Apr 6 2013 Orion Poplawski <orion@cora.nwra.com> - 0.6.0-1
- Initial Fedora package