File spacecmd.spec of Package spacecmd.7141

#
# spec file for package spacecmd
#
# Copyright (c) 2018 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 http://bugs.opensuse.org/
#


%if ! (0%{?fedora} || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%if 0%{?fedora}
%{!?pylint_check: %global pylint_check 1}
%endif

Name:           spacecmd
Version:        2.7.8.10
Release:        0
Summary:        Command-line interface to Spacewalk and Red Hat Satellite servers
License:        GPL-3.0+
Group:          Applications/System

Url:            https://github.com/spacewalkproject/spacewalk/wiki/spacecmd
Source:         spacecmd-git-0.e74de0d.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if ((!0%{?suse_version}) || (0%{?suse_version} >= 1120))
BuildArch:      noarch
%endif

%if 0%{?pylint_check}
BuildRequires:  spacewalk-pylint
%endif
BuildRequires:  python
BuildRequires:  python-devel
BuildRequires:  python-simplejson
BuildRequires:  rpm-python
%if 0%{?rhel} == 5
BuildRequires:  python-json
%endif

%if 0%{?rhel} == 5
Requires:       python-simplejson
%endif
Requires:       file
Requires:       python

%if 0%{?suse_version}
BuildRequires:  python-xml
Requires:       python-simplejson
Requires:       python-xml
%endif

%description
spacecmd is a command-line interface to Spacewalk and Red Hat Satellite servers

%prep
%setup -q -n spacecmd-git-0.e74de0d

%build
# nothing to build

%install
%{__rm} -rf %{buildroot}

%{__mkdir_p} %{buildroot}/%{_bindir}
%{__install} -p -m0755 src/bin/spacecmd %{buildroot}/%{_bindir}/

%{__mkdir_p} %{buildroot}/%{_sysconfdir}
touch %{buildroot}/%{_sysconfdir}/spacecmd.conf

%{__mkdir_p} %{buildroot}/%{_sysconfdir}/bash_completion.d
%{__install} -p -m0644 src/misc/spacecmd-bash-completion %{buildroot}/%{_sysconfdir}/bash_completion.d/spacecmd

%{__mkdir_p} %{buildroot}/%{python_sitelib}/spacecmd
%{__install} -p -m0644 src/lib/*.py %{buildroot}/%{python_sitelib}/spacecmd/

%{__mkdir_p} %{buildroot}/%{_mandir}/man1
%{__gzip} -c src/doc/spacecmd.1 > %{buildroot}/%{_mandir}/man1/spacecmd.1.gz

touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%{__chmod} 0644 %{buildroot}/%{python_sitelib}/spacecmd/__init__.py

%clean
%{__rm} -rf %{buildroot}

%check
%if 0%{?pylint_check}
PYTHONPATH=$RPM_BUILD_ROOT%{python_sitelib} \
	spacewalk-pylint $RPM_BUILD_ROOT%{python_sitelib}/spacecmd
%endif

%files
%defattr(-,root,root)
%{_bindir}/spacecmd
%{python_sitelib}/spacecmd/
%ghost %config %{_sysconfdir}/spacecmd.conf
%dir %{_sysconfdir}/bash_completion.d
%{_sysconfdir}/bash_completion.d/spacecmd
%doc src/doc/README src/doc/COPYING
%doc %{_mandir}/man1/spacecmd.1.gz

%changelog
openSUSE Build Service is sponsored by