File openstack-horizon-plugin-heat-ui.spec of Package openstack-horizon-plugin-heat-ui

#
# spec file for package openstack-horizon-plugin-heat-ui
#
# Copyright (c) 2020 SUSE LLC
#
# 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-heat-ui
Version:        4.1.0~dev5
Release:        0
Summary:        Horizon plugin for heat
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/heat-dashboard
Source0:        heat-dashboard-master.tar.gz
BuildRequires:  fdupes
BuildRequires:  openstack-dashboard
BuildRequires:  openstack-macros
BuildRequires:  python3-XStatic-Angular-UUID
BuildRequires:  python3-XStatic-Angular-Vis
BuildRequires:  python3-XStatic-FileSaver
BuildRequires:  python3-XStatic-JS-Yaml
BuildRequires:  python3-XStatic-Json2yaml
BuildRequires:  python3-heatclient
BuildRequires:  python3-mock
BuildRequires:  python3-pbr
Requires:       python-horizon-plugin-heat-ui = %{version}
BuildArch:      noarch

%description
Heat dashboard is a horizon plugin for Heat.

%package -n     python-horizon-plugin-heat-ui
Summary:        Horizon plugin for heat - Python Module
Group:          Development/Languages/Python
Requires:       python3-XStatic-Angular-UUID
Requires:       python3-XStatic-Angular-Vis
Requires:       python3-XStatic-FileSaver
Requires:       python3-XStatic-JS-Yaml
Requires:       python3-XStatic-Json2yaml
Requires:       python3-heatclient
Requires:       python3-pbr

%description -n python-horizon-plugin-heat-ui
OpenStack Heat plugin for Horizon.

This package contains the core Python module of the heat-ui.

%package test
Summary:        Heat Management Plugin for Horizon - Testsuite
Group:          Development/Languages/Python
Requires:       python3-mock
Requires:       python3-testtools

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

%prep
%autosetup -p1 -n heat-dashboard-4.1.0.dev5
%py_req_cleanup

%build
%py3_build

%check
rm -r heat_dashboard/test/integration
PYTHONPATH=%{http_dashboard_dir} python3 manage.py test heat_dashboard.test --settings=heat_dashboard.test.settings --exclude-tag=integration

%install
%py3_install

install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/enabled/
cp -a heat_dashboard/enabled/*.py %{buildroot}%{http_dashboard_dir}/openstack_dashboard/enabled/
install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/local/local_settings.d/
cp -a heat_dashboard/local_settings.d/_1699_orchestration_settings.py \
     %{buildroot}%{http_dashboard_dir}/openstack_dashboard/local/local_settings.d/_1699_orchestration_settings.py
install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/conf/
cp -a heat_dashboard/conf/heat_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/local/local_settings.d/_1699_orchestration_settings.py*
%{http_dashboard_dir}/openstack_dashboard/conf/heat_policy.json

%files -n python-horizon-plugin-heat-ui
%doc README.rst
%license LICENSE
%{python3_sitelib}/heat_dashboard/
%{python3_sitelib}/heat_dashboard-*.egg-info
%exclude %{python3_sitelib}/heat_dashboard/test*

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

%changelog