File python-smartypants.spec of Package python-smartypants

#
# spec file for package python-smartypants
#
# 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 https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-smartypants
Version:        2.0.1
Release:        0
Summary:        A smart-quotes plugin for SmartyPants
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/leohemsted/smartypants.py
Source0:        https://files.pythonhosted.org/packages/py2.py3/s/smartypants/smartypants-%{version}-py2.py3-none-any.whl
Source10:       https://raw.githubusercontent.com/leohemsted/smartypants.py/v%{version}/COPYING
BuildRequires:  %{python_module pip}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch

%python_subpackages

%description
This module encapsulates Chad Miller's SmartyPants module so that
it's available on PyPI. For more information, consult

* http://web.chad.org/projects/smartypants.py/
* http://daringfireball.net/projects/smartypants/

%prep
%setup -T -c -n smartypants-%{version}
cp %{SOURCE10} .

%build
# Not needed

%install
%{python_expand pip%{$python_bin_suffix} install --root %{buildroot} %{SOURCE0}
sed -i -e '/^#!\//, 1d' %{buildroot}%{$python_sitelib}/smartypants.py
$python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/smartypants.py
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/smartypants.py
%fdupes %{buildroot}%{$python_sitelib}
}

%python_clone -a %{buildroot}%{_bindir}/smartypants

%post
%python_install_alternative smartypants

%postun
%python_uninstall_alternative smartypants

%check
# todo

%files %{python_files}
%license COPYING
%python_alternative %{_bindir}/smartypants
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by