File python3-recommonmark.spec of Package python-recommonmark.34100
#
# spec file for package python-recommonmark
#
# Copyright (c) 2019 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/
#
%define oldpython python
Name: python3-recommonmark
Version: 0.5.0
Release: 0
Summary: Python docutils-compatibility bridge to CommonMark
License: MIT
Group: Development/Languages/Python
URL: https://github.com/rtfd/recommonmark
Source0: https://files.pythonhosted.org/packages/source/r/recommonmark/recommonmark-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/rtfd/recommonmark/master/license.md
BuildRequires: python3-setuptools
BuildRequires: fdupes
BuildRequires: python-rpm-macros
# SECTION tests
#BuildRequires: python3-CommonMark >= 0.7.3
#BuildRequires: python3-Sphinx >= 1.3.1
#BuildRequires: python3-docutils >= 0.11
# /SECTION tests
Requires: python3-CommonMark >= 0.7.3
Requires: python3-Sphinx >= 1.3.1
Requires: python3-docutils >= 0.11
Requires(post): update-alternatives
Requires(preun): update-alternatives
Provides: python3-reCommonMark = %{version}
Obsoletes: python3-reCommonMark < %{version}
BuildArch: noarch
%ifpython2
Obsoletes: %{oldpython}-reCommonMark < %{version}
Provides: %{oldpython}-reCommonMark = %{version}
%endif
%description
A python docutils-compatibility bridge to CommonMark.
This allows you to write CommonMark inside of Docutils & Sphinx projects.
Documentation is available on Read the Docs:
http://recommonmark.readthedocs.org
%prep
%setup -q -n recommonmark-%{version}
# Remove upstream's egg-info
rm -rf %{pypi_name}.egg-info
#Add missing license and readme
cp -a %{SOURCE1} .
# find and remove unneeded shebangs
find recommonmark -name "*.py" | xargs sed -i '1 {/^#!/ d}'
sed -i 's/from commonmark import Parser/from CommonMark import Parser/' recommonmark/parser.py
%build
%python3_build
%install
%python3_install
%fdupes %{buildroot}%{python3_sitelib}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for exe in cm2html cm2latex cm2man cm2pseudoxml cm2xetex cm2xml ; do
cp %{buildroot}%{_bindir}/${exe} %{buildroot}%{_bindir}/${exe}-3.6
sed -ri '1s@#!.*python.*@#!%{_bindir}/python3.6@' %{buildroot}%{_bindir}/${exe}-3.6
ln -s -f %{_sysconfdir}/alternatives/${exe} %{buildroot}%{_bindir}/${exe}
done
%post
update-alternatives --install \
%{_bindir}/cm2html cm2html %{_bindir}/cm2html-3.6 36 \
--slave %{_bindir}/cm2latex cm2latex %{_bindir}/cm2latex-3.6 \
--slave %{_bindir}/cm2man cm2man %{_bindir}/cm2man-3.6 \
--slave %{_bindir}/cm2pseudoxml cm2pseudoxml %{_bindir}/cm2pseudoxml-3.6 \
--slave %{_bindir}/cm2xetex cm2xetex %{_bindir}/cm2xetex-3.6 \
--slave %{_bindir}/cm2xml cm2xml %{_bindir}/cm2xml-3.6
update-alternatives --auto cm2html
%preun
update-alternatives --remove cm2html %{_bindir}/cm2html-3.6
%files
%license license.md
%ghost %{_sysconfdir}/alternatives/cm2html
%ghost %{_sysconfdir}/alternatives/cm2latex
%ghost %{_sysconfdir}/alternatives/cm2man
%ghost %{_sysconfdir}/alternatives/cm2pseudoxml
%ghost %{_sysconfdir}/alternatives/cm2xetex
%ghost %{_sysconfdir}/alternatives/cm2xml
%ghost %{_bindir}/cm2html
%ghost %{_bindir}/cm2latex
%ghost %{_bindir}/cm2man
%ghost %{_bindir}/cm2pseudoxml
%ghost %{_bindir}/cm2xetex
%ghost %{_bindir}/cm2xml
%{_bindir}/cm2html-3.6
%{_bindir}/cm2latex-3.6
%{_bindir}/cm2man-3.6
%{_bindir}/cm2pseudoxml-3.6
%{_bindir}/cm2xetex-3.6
%{_bindir}/cm2xml-3.6
%{python3_sitelib}/recommonmark/
%{python3_sitelib}/recommonmark-%{version}*-info
%doc README.md
%changelog