%global pypi_name netdiff
%global sum Python library for parsing network topology data and detect changes
# Python 3 only for Fedora for now.
%if 0%{?fedora} > 12
%global with_python3 1
%endif
%if 0%{?fedora} > 23
%global python2_networkx 1
%endif
%if 0%{?el7}
%global old_python_prefix 1
%endif
%if 0%{?el7}
%global python_requests 1
%endif
Name: python-%{pypi_name}
Version: 0.4.7
Release: 2%{?dist}
Summary: %{sum}
License: MIT
URL: https://github.com/ninuxorg/netdiff
Source0: https://pypi.python.org/packages/source/n/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python2-libcnml
# python2-mock is missing, see https://bugzilla.redhat.com/show_bug.cgi?id=1301766
BuildRequires: python-mock
#python2-networkx's name is python-networkx in Fedora < 24
%if 0%{?python2_networkx}
BuildRequires: python2-networkx
%endif
%if 1%{?python2_networkx}
BuildRequires: python-networkx
%endif
%if 0%{?old_python_prefix}
BuildRequires: python-nose
%else
BuildRequires: python2-nose
%endif
%if 0%{?old_python_prefix}
BuildRequires: python-requests
%else
BuildRequires: python2-requests
%endif
BuildRequires: python2-responses
# python2-six is missing, see https://bugzilla.redhat.com/show_bug.cgi?id=1342037
BuildRequires: python-six
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-libcnml
BuildRequires: python3-mock
BuildRequires: python3-networkx
BuildRequires: python3-nose
BuildRequires: python3-requests
BuildRequires: python3-responses
BuildRequires: python3-six
%endif # if with_python3
%description
Netdiff is a simple Python library that provides utilities for
parsing network topology data of open source dynamic
routing protocols and detecting changes in these topologies.
%package -n python2-%{pypi_name}
Summary: %{sum}
%{?python_provide:%python_provide python2-%{pypi_name}}
Requires: python2-libcnml
# python2-mock is missing, see https://bugzilla.redhat.com/show_bug.cgi?id=1301766
Requires: python-mock
#python2-networkx's name is python-networkx in Fedora < 24
%if 0%{?python2_networkx}
Requires: python2-networkx
%endif
%if 1%{?python2_networkx}
Requires: python-networkx
%endif
%if 0%{?old_python_prefix}
Requires: python-nose
%else
Requires: python2-nose
%endif
%if 0%{?old_python_prefix}
Requires: python-requests
%else
Requires: python2-requests
%endif
# python2-six is missing, see https://bugzilla.redhat.com/show_bug.cgi?id=1342037
Requires: python-six
%description -n python2-%{pypi_name}
Netdiff is a simple Python library that provides utilities for
parsing network topology data of open source dynamic
routing protocols and detecting changes in these topologies.
%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary: %{sum}
%{?python_provide:%python_provide python3-%{pypi_name}}
Requires: python3-libcnml
Requires: python3-mock
Requires: python3-networkx
Requires: python3-nose
Requires: python3-requests
Requires: python3-six
%description -n python3-%{pypi_name}
Netdiff is a simple Python library that provides utilities for
parsing network topology data of open source dynamic
routing protocols and detecting changes in these topologies.
%endif # if with_python3
%prep
%setup -q -n %{pypi_name}-%{version}
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif # if with_python3
%install
%py2_install
%if 0%{?with_python3}
%py3_install
%endif # if with_python3
%check
%{__python2} setup.py test
%if 0%{?with_python3}
%{__python3} setup.py test
%endif # if with_python3
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.rst
%{python3_sitelib}/*
%endif # if with_python3
%changelog
* Thu Jun 02 2016 Germano Massullo <germano.massullo@gmail.com> - 0.4.7-2
- Fixed python-networkx prefix for Fedora > 23
* Fri Mar 04 2016 Germano Massullo <germano.massullo@gmail.com> - 0.4.7-1
- First commit on Fedora's Git