%global pypi_name horizon-bsn
%global pypi_name_underscore horizon_bsn
%global rpm_name horizon-bsn
%global docpath doc/build/html
%global lib_dir %{buildroot}%{python2_sitelib}/%{pypi_name}/plugins/bigswitch

Name:           python-%{rpm_name}
Version:        9.42.4
Release:        1%{?dist}
Summary:        Big Switch Networks horizon plugin for OpenStack
License:        ASL 2.0
URL:            https://pypi.python.org/pypi/%{pypi_name}
Source0:        https://pypi.python.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

Requires:   pytz
Requires:   python-lockfile
Requires:   python-six
Requires:   python-pbr
Requires:   python-django
Requires:   python-django-horizon

BuildRequires: python-django
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-d2to1
BuildRequires: python-pbr
BuildRequires: python-lockfile
BuildRequires: python-eventlet
BuildRequires: python-six
BuildRequires: gettext
BuildRequires: python-oslo-sphinx >= 2.3.0
BuildRequires: python-netaddr
BuildRequires: python-kombu
BuildRequires: python-anyjson
BuildRequires: python-iso8601

%description
This package contains Big Switch
Networks horizon plugin

%prep
%setup -q -n %{pypi_name}-%{version}

%build
export PBR_VERSION=%{version}
export SKIP_PIP_INSTALL=1
%{__python2} setup.py build
%{__python2} setup.py build_sphinx
rm %{docpath}/.buildinfo

%install
%{__python2} setup.py install --skip-build --root %{buildroot}
mkdir -p %{lib_dir}/tests
for lib in %{lib_dir}/version.py %{lib_dir}/tests/test_server.py; do
    sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
    touch -r $lib $lib.new &&
    mv $lib.new $lib
done


%files
%license LICENSE
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name_underscore}
%{python2_sitelib}/%{pypi_name_underscore}-%{version}-py?.?.egg-info

%post

%preun

%postun

%changelog
* Fri Oct 20 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.42.4
- update build scripts to run in container instead of baremetal
* Fri Oct 20 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.42.3
- BCF-6592: add logical path to the output testpath on horizon
* Tue Jun 13 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.42.2
- OSP-36: missed a replacement for quicktest tenant get
* Mon Jun 05 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.42.1
- OSP-36: member user should be able to create reachability test
* Thu Apr 27 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.42.0
- match version to release 4.2
* Mon Apr 17 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.40.3
- BVS-4634: internationalize text
* Thu Mar 23 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.40.2
- OSP-26 check for presence of routers
- OSP-19 ensure policy is deleted in MLR case
* Thu Jan 19 2017 Aditya Vaja <wolverine.av@gmail.com> - 9.40.1
- OSP-6 handle MLR in horizon
* Thu Nov 17 2016 Aditya Vaja <wolverine.av@gmail.com> - 9.40.0
- initialize newton branch
