File python-Markdown.spec of Package python-Markdown

#
# spec file for package python-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:           python-Markdown
Version:        2.6.2
Release:        0
Summary:        Python implementation of Markdown
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://packages.python.org/Markdown/
Source:         http://pypi.python.org/packages/source/M/Markdown/Markdown-%{version}.tar.gz
BuildRequires:  python-PyYAML
BuildRequires:  python-devel
BuildRequires:  python-nose
BuildRequires:  python-xml
Requires:       python-xml
Requires(post):	update-alternatives
Requires(postun):	update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       python-markdown = %{version}
Obsoletes:      python-markdown < %{version}
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%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
python setup.py build

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

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

%if 0%{?suse_version} && 0%{?suse_version} > 1110
%check
python run-tests.py
%endif

%post
update-alternatives \
	--install %{_bindir}/markdown_py markdown_py %{_bindir}/markdown_py-%{py_ver} 20

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

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

%changelog
openSUSE Build Service is sponsored by