SPECS/python-netaddr/python-netaddr.spec
f379f5c4
 %{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
f45ca38c
 %{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
 
 Name:           python-netaddr
 Version:        0.7.19
2d879f6b
 Release:        3%{?dist}
f45ca38c
 Summary:        A network address manipulation library for Python
f379f5c4
 License:        BSD
f45ca38c
 Group:          Development/Languages/Python
f379f5c4
 Url:            https://files.pythonhosted.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz
f45ca38c
 Source0:        netaddr-%{version}.tar.gz
 %define sha1    netaddr=00e0ce7d7ebc1d6e7943e884aa51ccb7becdc9ea
 
 BuildRequires:  python2
 BuildRequires:  python2-libs
 BuildRequires:  python-setuptools
 
 Requires:       python2
 Requires:       python2-libs
 
 BuildArch:      noarch
 
 %description
 A network address manipulation library for Python
 
f379f5c4
 %package -n python3-netaddr
 Summary:        Python3-netaddr
 BuildRequires:  python3-devel
2d879f6b
 BuildRequires:  python3-libs
f379f5c4
 
 %description -n python3-netaddr
 Python 3 version.
 
f45ca38c
 %prep
 %setup -n netaddr-%{version}
f379f5c4
 rm -rf ../p3dir
 cp -a . ../p3dir
f45ca38c
 
 %build
f379f5c4
 python2 setup.py build
 pushd ../p3dir
 python3 setup.py build
 popd
f45ca38c
 
 %install
f379f5c4
 pushd ../p3dir
 python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
 mv %{buildroot}/%{_bindir}/netaddr %{buildroot}/%{_bindir}/netaddr3
 popd
 python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
 
f45ca38c
 %check
 easy_install py
f379f5c4
 python2 test_netadr.py
 pushd ../p3dir
 python3 test_netadr.py
 popd
f45ca38c
 
 %files
 %defattr(-,root,root,-)
f379f5c4
 %{python2_sitelib}/*
2d879f6b
 %{_bindir}/netaddr
f379f5c4
 
 %files -n python3-netaddr
 %defattr(-,root,root,-)
2d879f6b
 %{_bindir}/netaddr3
f379f5c4
 %{python3_sitelib}/*
f45ca38c
 
 %changelog
2d879f6b
 *   Thu Jun 01 2017 Dheeraj Shetty <dheerajs@vmware.com> 0.7.19-3
 -   Separate python2 and python3 bindings
f379f5c4
 *   Mon Mar 27 2017 XIaolin Li <xiaolinl@vmware.com> 0.7.19-2
 -   Added python3 package.
f45ca38c
 *   Fri Feb 03 2017 Vinay Kulkarni <kulkarniv@vmware.com> 0.7.19-1
 -   Initial version of python-netaddr package for Photon.