Blob Blame Raw
%global github_name m2r
%global commit 871d57941e74e29bb66ae6d65fa0517e6001f62a
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global desc M2R converts a markdown file including reST markups to a valid reST format.

Name:           python-%{github_name}
Version:        0.1.6
Release:        1.git%{shortcommit}%{?dist}
Summary:        Markdown to reStructuredText converter

License:        MIT
URL:            https://github.com/miyakogi/%{github_name}
Source0:        https://github.com/miyakogi/%{github_name}/archive/%{commit}/%{github_name}-%{commit}.tar.gz

BuildArch:      noarch


%description
%{desc}


%package -n python2-%{github_name}
BuildRequires:  python2-devel
BuildRequires:  python-docutils
BuildRequires:  python-mistune
BuildRequires:  python-pygments
BuildRequires:  python2-mock
Requires:       python-docutils
Requires:       python-mistune
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{github_name}}


%description -n python2-%{github_name}
%{desc}


%package -n python3-%{github_name}
BuildRequires:  python3-devel
BuildRequires:  python3-docutils
BuildRequires:  python3-mistune
BuildRequires:  python3-pygments
BuildRequires:  python3-mock
Requires:       python3-docutils
Requires:       python3-mistune
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{github_name}}


%description -n python3-%{github_name}
%{desc}


%prep
%setup -qn %{github_name}-%{commit}

# Remove upstream's egg-info
rm -rf %{github_name}.egg-info

# Remove shebang
sed -i '1{\@^#!/usr/bin/env python@d}' m2r.py


%build
%py2_build
%py3_build


%install
%py2_install
%py3_install


%check
PYTHONPATH=$(pwd) %{__python2} setup.py test -s tests
PYTHONPATH=$(pwd) %{__python3} setup.py test -s tests


%files -n python2-%{github_name}
%license LICENSE
%doc README.md
%{python2_sitelib}/%{github_name}.py{,c,o}
%{python2_sitelib}/%{github_name}-%{version}*-py%{python2_version}.egg-info
%exclude %{python2_sitelib}/tests


%files -n python3-%{github_name}
%license LICENSE
%doc README.md
%{_bindir}/m2r
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{github_name}.py
%{python3_sitelib}/%{github_name}-%{version}*-py%{python3_version}.egg-info
%exclude %{python3_sitelib}/tests


%changelog
* Wed May 31 2017 Nikola Forró <nforro@redhat.com> - 0.1.6-1.git871d579
- Update to 0.1.6
  resolves: #1457165

* Wed May 17 2017 Nikola Forró <nforro@redhat.com> - 0.1.5-2.git539a079
- Make image_link regex non-greedy

* Tue May 16 2017 Nikola Forró <nforro@redhat.com> - 0.1.5-1.git539a079
- Initial package