File openstack-horizon-plugin-neutron-fwaas-ui.spec of Package openstack-horizon-plugin-neutron-fwaas-ui

#
# spec file for package openstack-horizon-plugin-neutron-fwaas-ui
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%if 0%{?rhel} || 0%{?fedora}
%global http_dashboard_dir %{_datarootdir}/openstack-dashboard
%else
%global http_dashboard_dir /srv/www/openstack-dashboard
%endif
Name:           openstack-horizon-plugin-neutron-fwaas-ui
Version:        2.2.0~dev15
Release:        0
Summary:        Neutron FWaaS management plugin for Horizon
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/neutron-fwaas-dashboard
Source0:        neutron-fwaas-dashboard-master.tar.gz
BuildRequires:  fdupes
BuildRequires:  gettext
BuildRequires:  openstack-dashboard
BuildRequires:  openstack-macros
BuildRequires:  python3-ddt
BuildRequires:  python3-django-nose
BuildRequires:  python3-mock
BuildRequires:  python3-mox3
BuildRequires:  python3-openstackdocstheme
BuildRequires:  python3-pbr
BuildRequires:  python3-python-subunit
BuildRequires:  python3-reno
BuildRequires:  python3-testscenarios
BuildRequires:  python3-testtools
Requires:       python3-horizon-plugin-neutron-fwaas-ui = %{version}
BuildArch:      noarch

%description
OpenStack Neutron FWaaS management plugin for Horizon.

%package -n    python3-horizon-plugin-neutron-fwaas-ui
Summary:        Neutron FWaaS Management Plugin for Horizon - Python module
Group:          Development/Languages/Python
Requires:       python3-Django
Requires:       python3-neutronclient
Requires:       python3-pbr

%description -n python3-horizon-plugin-neutron-fwaas-ui
OpenStack Neutron FWaaS management plugin for Horizon.

This package contains the core Python module of the neutron-fwaas-ui.

%package test
Summary:        Neutron FWaaS Management Plugin for Horizon - Testsuite
Group:          Development/Languages/Python
Requires:       python3-ddt
Requires:       python3-django-nose
Requires:       python3-mock
Requires:       python3-mox3
Requires:       python3-openstackdocstheme
Requires:       python3-python-subunit
Requires:       python3-reno
Requires:       python3-testscenarios
Requires:       python3-testtools

%description test
OpenStack Neutron FWaaS management plugin for Horizon.
It is used to verify the functionality of the Neutron FWaaS UI Plugin.

%prep
%autosetup -n neutron-fwaas-dashboard-2.2.0.dev15
%py_req_cleanup

%build
%{py3_build}
pushd neutron_fwaas_dashboard
PYTHONPATH=%{http_dashboard_dir} python3 ../manage.py compilemessages
popd

%check
# Depends on Selenium integration tests, we just want unit tests
rm -rf neutron_fwaas_dashboard/test/integration
PYTHONPATH=%{http_dashboard_dir} python3 manage.py test neutron_fwaas_dashboard \
    --settings=neutron_fwaas_dashboard.test.settings \
    --exclude-tag integration

%install
%{py3_install}

install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/enabled/
cp -a neutron_fwaas_dashboard/enabled/*.py %{buildroot}%{http_dashboard_dir}/openstack_dashboard/enabled/
install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/conf/
cp -a etc/neutron-fwaas-policy.json %{buildroot}%{http_dashboard_dir}/openstack_dashboard/conf/

%fdupes %{buildroot}%{python3_sitelib}
%fdupes %{buildroot}%{http_dashboard_dir}

%post
su %{apache_user} -s /bin/sh -c "python3 %{http_dashboard_dir}/manage.py collectstatic --noinput --clear > /dev/null"

%postun
su %{apache_user} -s /bin/sh -c "python3 %{http_dashboard_dir}/manage.py collectstatic --noinput --clear > /dev/null"

%files
%doc ChangeLog CONTRIBUTING.rst README.rst
%license LICENSE
%{http_dashboard_dir}/openstack_dashboard/enabled/*.py*
%{http_dashboard_dir}/openstack_dashboard/conf/neutron-fwaas-policy.json

%files -n python3-horizon-plugin-neutron-fwaas-ui
%doc README.rst
%license LICENSE
%{python3_sitelib}/neutron_fwaas_dashboard/
%{python3_sitelib}/neutron_fwaas_dashboard-*.egg-info
%exclude %{python3_sitelib}/neutron_fwaas_dashboard/test*

%files test
%{python3_sitelib}/neutron_fwaas_dashboard/test*

%changelog