File python-pycmd.spec of Package python-pycmd

#
# spec file for package python-pycmd
#
# Copyright (c) 2017 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/


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
# test scripts missing
%bcond_with     test
Name:           python-pycmd
Version:        1.2
Release:        0
License:        MIT
Summary:        Tools for managing/searching Python related files
Url:            https://pypi.python.org/pypi/pycmd/
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/source/p/pycmd/pycmd-%{version}.tar.gz
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
%if %{with test}
BuildRequires:  %{python_module py >= 1.4.9}
%endif
Requires:       python-py >= 1.4.9
BuildArch:      noarch
Requires(post):   update-alternatives
Requires(postun):  update-alternatives

%python_subpackages

%description
Pycmd is a collection of command line tools for helping with Python development.

%prep
%setup -q -n pycmd-%{version}
sed -i -e '/^#!\//, 1d' pycmd/*.py
sed -i -e '/^#! \//, 1d' pycmd/*.py

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%python_clone -a %{buildroot}%{_bindir}/py.cleanup
%python_clone -a %{buildroot}%{_bindir}/py.lookup
%python_clone -a %{buildroot}%{_bindir}/py.countloc
%python_clone -a %{buildroot}%{_bindir}/py.which
%python_clone -a %{buildroot}%{_bindir}/py.convert_unittest
%python_clone -a %{buildroot}%{_bindir}/py.svnwcrevert

%if %{with test}
%check
%python_exec setup.py test
%endif

%post
%{python_install_alternative py.cleanup py.lookup py.countloc py.which py.convert_unittest py.svnwcrevert}

%postun
%python_uninstall_alternative py.cleanup

%files %{python_files}
%defattr(-,root,root,-)
%doc CHANGELOG LICENSE README.txt
%python_alternative %{_bindir}/py.cleanup
%python_alternative %{_bindir}/py.lookup
%python_alternative %{_bindir}/py.countloc
%python_alternative %{_bindir}/py.which
%python_alternative %{_bindir}/py.convert_unittest
%python_alternative %{_bindir}/py.svnwcrevert
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by