File python-CommonMark.spec of Package python-CommonMark

#
# spec file for package python-CommonMark
#
# 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-%{**}}
%define oldpython python
Name:           python-CommonMark
Version:        0.7.5
Release:        0
Summary:        Python parser for the CommonMark Markdown spec
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://pypi.python.org/pypi/CommonMark
Source:         https://files.pythonhosted.org/packages/source/C/CommonMark/CommonMark-%{version}.tar.gz
BuildRequires:  %{python_module future}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-future
BuildArch:      noarch
%ifpython2
Obsoletes:      %{oldpython}-commonmark < %{version}
Provides:       %{oldpython}-commonmark = %{version}
%endif
%ifpython3
Provides:       python3-commonmark = %{version}
Obsoletes:      python3-commonmark < %{version}
%endif
%python_subpackages

%description
Pure Python port of jgm's stmd.js, a Markdown parser and renderer for the
CommonMark specification, using only native modules.

%package -n %{name}-doc
Summary:        Documentation for CommonMark
Group:          Documentation/HTML
Provides:       %{python_module CommonMark-doc = %{version}}

%description -n %{name}-doc
Documentation for Pure Python port of jgm's stmd.js, a Markdown parser and
renderer for the CommonMark specification, using only native modules.

%package -n cmark-python
Summary:        CommonMark parsing and rendering program in python
Group:          Development/Languages/Python
Requires:       python3-CommonMark = %{version}
Conflicts:      cmark

%description -n cmark-python
Pure Python port of jgm's stmd.js, a Markdown parser and renderer for the
CommonMark specification, using only native modules.

This package provides the "cmark" executable, to avoid conflicts with other
implementations.

%prep
%setup -q -n CommonMark-%{version}
chmod -x LICENSE
chmod -x README.rst
sed -i "s/\r//g" LICENSE
# find and remove unneeded shebangs
find CommonMark -name "*.py" | xargs sed -i '1 {/^#!/ d}'

%build
%python_build

%install
%python_install

%python_expand %fdupes %{buildroot}%{$python_sitelib}

# Test broken due to encoding issue
# %check
# export LANG=en_US.UTF-8
# export PYTHONPATH=%{buildroot}%{python_sitelib}
# python setup.py test

%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/CommonMark/
%{python_sitelib}/CommonMark-%{version}-py*.egg-info

%files -n %{name}-doc
%license LICENSE
%doc spec.txt

%files -n cmark-python
%license LICENSE
%doc spec.txt
%{_bindir}/cmark

%changelog
openSUSE Build Service is sponsored by