File python3-Markdown.spec of Package python3-Markdown

#
# spec file for package python3-Markdown
#
# Copyright (c) 2015 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/
#


Name:           python3-Markdown
Version:        2.6.2
Release:        0
Summary:        Python implementation of Markdown
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://pypi.python.org/pypi/Markdown/
Source:         http://pypi.python.org/packages/source/M/Markdown/Markdown-%{version}.tar.gz
BuildRequires:  python3-PyYAML
BuildRequires:  python3-devel
BuildRequires:  python3-nose
BuildRequires:  python3-xml
Requires:       python3-xml
Requires(post):	update-alternatives
Requires(postun):	update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
This is a Python implementation of John Gruber's [Markdown][].
It is almost completely compliant with the reference implementation,
though there are a few known issues. See [Features][] for information
on what exactly is supported and what is not. Additional features are
supported by the [Available Extensions][].

%prep
%setup -q -n Markdown-%{version}
# Fix encoding
find . -type f -not -name py.png -print0 | xargs -0 sed -i "s|\r$||"

%build
python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}

# update-alternatives
mv %{buildroot}%{_bindir}/markdown_py %{buildroot}%{_bindir}/markdown_py-%{py3_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/markdown_py
ln -sf %{_sysconfdir}/alternatives/markdown_py %{buildroot}%{_bindir}/markdown_py

%check
python3 run-tests.py

%post
update-alternatives \
	--install %{_bindir}/markdown_py markdown_py %{_bindir}/markdown_py-%{py3_ver} 30

%postun
if [ $1 -eq 0 ] ; then
	update-alternatives --remove markdown_py %{_bindir}/markdown_py-%{py3_ver}
fi

%files
%defattr(-,root,root,-)
%doc LICENSE.md README.md docs/*
%ghost %{_sysconfdir}/alternatives/markdown_py
%{_bindir}/markdown_py
%{_bindir}/markdown_py-%{py3_ver}
%{python3_sitelib}/Markdown-%{version}-py%{py3_ver}.egg-info
%{python3_sitelib}/markdown

%changelog
openSUSE Build Service is sponsored by