Blob Blame History Raw
%global project_owner rtfd
%global github_name recommonmark
%global commit 7ca5247b342e755ce5294d43b5fef68afd90028e
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global sum docutils-compatibility bridge to CommonMark
%global desc A docutils-compatibility bridge to CommonMark.\
This allows you to write CommonMark inside of Docutils & Sphinx projects.\
Documentation is available on Read the Docs:

Name:           python-%{github_name}
Version:        0.4.0
Release:        4.git%{shortcommit}%{?dist}
Summary:        %{sum}

License:        MIT
URL:  {project_owner}/%{github_name}
BuildArch:      noarch


%package -n     python2-%{github_name}
BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python-docutils
BuildRequires:  python2-CommonMark
BuildRequires:  pytest
Requires:       python-docutils
Requires:       python2-CommonMark
Summary:        %{sum}
%{?python_provide:%python_provide python2-%{github_name}}

%description -n python2-%{github_name}

%package -n     python3-%{github_name}
Summary:        %{sum}
BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  python3-docutils
BuildRequires:  python3-CommonMark
BuildRequires:  python3-pytest
Requires:       python3-docutils
Requires:       python3-CommonMark
%{?python_provide:%python_provide python3-%{github_name}}

%description -n python3-%{github_name}

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

sed -i '1{\@^#!/usr/bin/env python@d}' recommonmark/


#  install python3 first to have unversinned binaries for python 3
pushd %{buildroot}%{_bindir}  # Enter buildroot bindir to ease symlink creation
for cm2bin in cm2*; do
    mv "${cm2bin}" "${cm2bin}-%{python3_version}"
    ln -s "${cm2bin}-%{python3_version}" "${cm2bin}-3"
popd  # Leave buildroot bindir

pushd %{buildroot}%{_bindir}  # Enter buildroot bindir to ease symlink creation
for cm2bin in cm2*; do
    # Ignore python3 binaries
    if [[ "${cm2bin}" != *-3* ]]; then
        ln -s "${cm2bin}" "${cm2bin}-%{python2_version}"
        ln -s "${cm2bin}-%{python2_version}" "${cm2bin}-2"
popd  # Leave buildroot bindir

PYTHONPATH=$(pwd) py.test-%{python3_version} .
PYTHONPATH=$(pwd) py.test-%{python2_version} .

%files -n python2-%{github_name}
%exclude %{_bindir}/cm2*-%{python3_version}
%exclude %{_bindir}/cm2*-3

%files -n python3-%{github_name}

* Mon Jan 18 2016 Julien Enselme <> - 0.4.0-4.git7ca5247
- Move unversionned binaries to python2 subpackage

* Sun Jan 17 2016 Julien Enselme <> - 0.4.0-3.git7ca5247
- Use tarball from github to have tests and LICENSE
- Add %%check section

* Sat Jan 16 2016 Julien Enselme <> - 0.4.0-2
- Remove separate source tag for license
- Add binary to python2 subpackage

* Sun Jan 10 2016 Julien Enselme <> - 0.4.0-1
- Update to 0.4.0

* Thu Dec 31 2015 Julien Enselme <> - 0.2.0-2
- Add missing dist tag

* Fri Dec 4 2015 Julien Enselme <> - 0.2.0-1
- Inital package