Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%global pypi_name ryu

%global with_check 1

Name:           python-%{pypi_name}
Version:        4.27
Release:        2%{?dist}
Summary:        Component-based Software-defined Networking Framework

License:        Apache-2.0
Url:            https://osrg.github.io/ryu
Source:         https://pypi.io/packages/source/r/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%description
Ryu provides software components with well defined API that make it easy for developers to create new
network management and control applications.

%package -n     python2-%{pypi_name}
Summary:        Component-based Software-defined Networking Framework
%{?python_provide:%python_provide python2-%{pypi_name}}

Requires:  python2-eventlet
Requires:  python2-debtcollector
Requires:  python2-lxml
Requires:  python2-msgpack
Requires:  python2-netaddr
Requires:  python2-openvswitch
Requires:  python2-oslo-config
Requires:  python2-paramiko
Requires:  python2-routes
Requires:  python2-six
Requires:  python2-tinyrpc
Requires:  python2-webob
Requires:  python-%{pypi_name}-common = %{version}-%{release}

BuildRequires:  python2-devel
BuildRequires:  python2-debtcollector
BuildRequires:  python2-eventlet
BuildRequires:  python2-greenlet
BuildRequires:  python2-lxml
BuildRequires:  python2-msgpack
BuildRequires:  python2-openvswitch
BuildRequires:  python2-oslo-config
BuildRequires:  python2-paramiko
BuildRequires:  python2-repoze-lru
BuildRequires:  python2-routes
BuildRequires:  python2-sphinx
BuildRequires:  python2-tinyrpc
BuildRequires:  python2-setuptools
BuildRequires:  python2-webob

%if 0%{?with_check}
BuildRequires:  pylint
BuildRequires:  python2-coverage
BuildRequires:  python2-formencode
BuildRequires:  python2-nose
BuildRequires:  python2-mock
BuildRequires:  python2-pep8
BuildRequires:  python2-tinyrpc
%endif

%description -n python2-%{pypi_name}
Ryu provides software components with well defined API that make it easy for developers to create new
network management and control applications.

%if 0%{?with_python3}
%package -n     python3-%{pypi_name}
Summary:        Component-based Software-defined Networking Framework
%{?python_provide:%python_provide python3-%{pypi_name}}

Requires:  python3-eventlet
Requires:  python3-debtcollector
Requires:  python3-lxml
Requires:  python3-msgpack
Requires:  python3-netaddr
Requires:  python3-openvswitch
Requires:  python3-oslo-config
Requires:  python3-paramiko
Requires:  python3-routes
Requires:  python3-six
Requires:  python3-tinyrpc
Requires:  python3-webob
Requires:  python-%{pypi_name}-common = %{version}-%{release}

BuildRequires:  python3-devel
BuildRequires:  python3-debtcollector
BuildRequires:  python3-eventlet
BuildRequires:  python3-greenlet
BuildRequires:  python3-lxml
BuildRequires:  python3-msgpack
BuildRequires:  python3-openvswitch
BuildRequires:  python3-oslo-config
BuildRequires:  python3-paramiko
BuildRequires:  python3-repoze-lru
BuildRequires:  python3-routes
BuildRequires:  python3-sphinx
BuildRequires:  python3-setuptools
BuildRequires:  python3-tinyrpc
BuildRequires:  python3-webob

%if 0%{?with_check}
BuildRequires:  python3-coverage
BuildRequires:  python3-formencode
BuildRequires:  python3-mock
BuildRequires:  python3-nose
BuildRequires:  python3-pep8
%endif

%description -n python3-%{pypi_name}
Ryu provides software components with well defined API that make it easy for developers to create new
network management and control applications.

This is the Python 3 version.
%endif

%package -n python-%{pypi_name}-common
Summary:        Component-based Software-defined Networking Framework

%description -n python-%{pypi_name}-common
Ryu provides software components with well defined API that make it easy for developers to create new
network management and control applications.

This package contains common data between python 2 and 3 versions

%prep
%setup -q -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info
# drop deps in egginfo, let rpm handle them
rm tools/*-requires
rm tools/install_venv.py
# Remove non-working tests (internet connection needed)
rm -vf %{pypi_name}/tests/unit/test_requirements.py
# Remove pip usage (used only in test_requirements.py)
sed -i '/^from pip/d' ryu/utils.py

%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif

cd doc && make man

%install
%if 0%{?with_python3}
%py3_install
for bin in %{pypi_name}{,-manager}; do
    mv %{buildroot}%{_bindir}/$bin  %{buildroot}%{_bindir}/$bin-%{python3_version}
    ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin-3
done;
%endif

%py2_install
for bin in %{pypi_name}{,-manager}; do
    mv %{buildroot}%{_bindir}/$bin  %{buildroot}%{_bindir}/$bin-%{python2_version}
    ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin-2
    ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin
done;

install -d -m 755 %{buildroot}%{_sysconfdir}/%{pypi_name}
mv %{buildroot}%{_prefix}%{_sysconfdir}/%{pypi_name}/%{pypi_name}.conf %{buildroot}%{_sysconfdir}/%{pypi_name}/%{pypi_name}.conf

%if 0%{?with_check}
%check
%if 0%{?with_python3}
# Tests without virtualenv (N) and without PEP8 tests (P)
PYTHON=%{__python3} ./run_tests.sh -N -P
%endif
PYTHON=%{__python2} ./run_tests.sh -N -P
%endif

%files -n     python2-%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%{python2_sitelib}/%{pypi_name}
%{_bindir}/%{pypi_name}
%{_bindir}/%{pypi_name}-2
%{_bindir}/%{pypi_name}-%{python2_version}
%{_bindir}/%{pypi_name}-manager
%{_bindir}/%{pypi_name}-manager-2
%{_bindir}/%{pypi_name}-manager-%{python2_version}


%if 0%{?with_python3}
%files -n     python3-%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%{python3_sitelib}/%{pypi_name}
%{_bindir}/%{pypi_name}
%{_bindir}/%{pypi_name}-3
%{_bindir}/%{pypi_name}-%{python3_version}
%{_bindir}/%{pypi_name}-manager
%{_bindir}/%{pypi_name}-manager-3
%{_bindir}/%{pypi_name}-manager-%{python3_version}
%endif

%files -n     python-%{pypi_name}-common
%doc AUTHORS ChangeLog README.rst
%license LICENSE
%{_sysconfdir}/%{pypi_name}/%{pypi_name}.conf



%changelog
* Thu Aug 16 2018 Slawek Kaplonski <skaplons@redhat.com> 4.27-2
- Stop removing integration tests code before build, it requires docker to
  run properly but it shouldn't be run if docker is not available on build
  machine

* Tue Aug 07 2018 Slawek Kaplonski <skaplons@redhat.com> 4.27-1
- Update to 4.27

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.25-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jul 03 2018 Alan Pevec <alan.pevec@redhat.com> 4.25-1
- Update to 4.25

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 4.15-4
- Rebuilt for Python 3.7

* Mon Mar 26 2018 Iryna Shcherbina <ishcherb@redhat.com> - 4.15-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Alan Pevec <alan.pevec@redhat.com> 4.15-1
- Update to 4.15

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon May 29 2017 Lumír Balhar <lbalhar@redhat.com> - 4.13-2
- Tests enabled

* Mon May 29 2017 Alan Pevec <alan.pevec@redhat.com> 4.13-1
- Update to 4.13
- Add missing dependencies

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 4.3-5
- Rebuild for Python 3.6

* Wed Sep 07 2016 Arie Bregman <abregman@redhat.com> - 4.3-4
- Moved tests related lines to depend on with_check

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Fri Jul 01 2016 Matthias Runge <mrunge@redhat.com> - 4.3-2
- add python_provides for python2 package

* Thu Jun 23 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 4.3-1
- Upstream 4.3
- Enable python3 subpackage

* Thu Apr  7 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 3.30-1
- Upstream 3.30

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.26-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Nov 22 2015 Arie Bregman <abregman@redhat.com> - 3.26-1
- Initial package.