File python-PasteScript.spec of Package python-PasteScript

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

# Namespace package issues break tests on Factory
%if 0%{?suse_version} > 1320
%bcond_with tests
%else
%bcond_without tests
%endif

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name:           python-PasteScript
Version:        2.0.2
Release:        0
Url:            http://pythonpaste.org/script/
Summary:        A pluggable command-line frontend to setup package file layouts
License:        MIT
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/source/P/PasteScript/PasteScript-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module six}
BuildRequires:  %{python_module Paste >= 1.3}
BuildRequires:  %{python_module PasteDeploy}
%if %{with tests}
# Test requirements
BuildRequires:  %{python_module nose >= 0.11}
BuildRequires:  python-Cheetah
BuildRequires:  python-unittest2
%endif
Requires:       python-Paste >= 1.3
Requires:       python-PasteDeploy
Requires:       python-setuptools
Requires:       python-six
%ifpython2
Recommends:     python-Cheetah
Provides:       %{oldpython}-pastescript = %{version}
Obsoletes:      %{oldpython}-pastescript < %{version}
%endif
Requires(post): update-alternatives
Requires(preun): update-alternatives
BuildArch:      noarch
%python_subpackages

%description
This is a pluggable command-line tool. It includes some built-in features:

  * Create file layouts for packages.
  * Serving up web applications, with configuration based on paste.deploy

%prep
%setup -q -n PasteScript-%{version}
mv docs/_build docs/html # Proper name for HTML docs
sed -i "1d" tests/test_logging_config.py # Fix non-executable script

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_expand rm -rf %{buildroot}%{$python_sitelib}/tests # Remove wrongly installed tests

# Prepare for update-alternatives usage
%python_clone -a %{buildroot}%{_bindir}/paster

%if %{with tests}
%check
%python_expand nosetests-%{$python_bin_suffix} -v tests/
%endif

%post
%python_install_alternative paster

%preun
%python_uninstall_alternative paster

%files %{python_files}
%defattr(-,root,root,-)
%doc README.rst docs/license.txt docs/news.txt
%doc docs/html/
%python_alternative %{_bindir}/paster
%{python_sitelib}/PasteScript-%{version}-py*.egg-info
%{python_sitelib}/PasteScript-%{version}-py*-nspkg.pth
%{python_sitelib}/paste/script/

%changelog
openSUSE Build Service is sponsored by