metal/python-inventoryclient/opensuse/python-inventoryclient.spec
Marcela Rosales b5f12793a1 Update openSUSE OBS artifacts to build MTCE packages
The openSUSE spec files needs to have the path of the source code in
the setup to have the package generation automated through _service
file in OBS.

Change-Id: I2b7c08d5772025c02821dfb9fc944fff0f5b6f90
Story: 2006508
Task: 36812
Signed-off-by: Marcela Rosales <marcela.a.rosales.jimenez@intel.com>
2019-10-01 11:07:10 -05:00

85 lines
2.8 KiB
RPMSpec

%global pypi_name inventoryclient
Name: python-inventoryclient
Version: 1.0.0
Release: 1
Summary: A python client library for Inventory
License: Apache-2.0
Group: base
URL: https://opendev.org/starlingx/metal
Source0: %{name}-%{version}.tar.gz
BuildRequires: git
BuildRequires: python-pbr >= 2.0.0
BuildRequires: python-setuptools
Requires: bash-completion
Requires: python-keystoneauth1 >= 3.1.0
Requires: python2-oslo.i18n >= 2.1.0
Requires: python2-oslo.utils >= 3.20.0
Requires: python2-pbr >= 2.0.0
Requires: python2-requests
Requires: python2-six >= 1.9.0
%if 0%{?suse_version}
BuildRequires: python-pip
%else
BuildRequires: python2-pip
%endif
%description
This package is a python client library for Inventory
%define local_bindir %{_bindir}/
%define local_etc_bash_completiond %{_sysconfdir}/bash_completion.d/
%define pythonroot %{_libdir}/python2.7/site-packages
%define debug_package %{nil}
%package sdk
Summary: SDK files for %{name}
%description sdk
This package contains SDK files for %{name} package.
%prep
%autosetup -n %{name}-%{version}/inventoryclient
# Remove bundled egg-info
rm -rf *.egg-info
%build
echo "Start build"
export PBR_VERSION=%{version}
python setup.py build
%install
echo "Start install"
export PBR_VERSION=%{version}
python setup.py install --root=%{buildroot} \
--install-lib=%{pythonroot} \
--prefix=%{_prefix} \
--install-data=%{_datadir} \
--single-version-externally-managed
install -d -m 755 %{buildroot}%{local_etc_bash_completiond}
install -p -D -m 664 tools/inventory.bash_completion %{buildroot}%{local_etc_bash_completiond}/inventory.bash_completion
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/pci_device_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/ethernetport_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/node_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/lldp_agent_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/common/options.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/cpu_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/memory_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/lldp_neighbour_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/port_shell.py
chmod a+x %{buildroot}/%{pythonroot}/inventoryclient/v1/host_shell.py
%files
%defattr(-,root,root,-)
%license LICENSE
%{local_bindir}/*
%config %{local_etc_bash_completiond}/*
%{pythonroot}/%{pypi_name}/*
%{pythonroot}/%{pypi_name}-%{version}*.egg-info
%dir %{pythonroot}/inventoryclient
%changelog