Blob Blame History Raw
%global project_owner rtfd
%global github_name recommonmark
%global commit dbed1c4d807275b2dba94ecc16e6d51c3ef94556
%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: http://recommonmark.readthedocs.org

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

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

%description
%{desc}


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

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


%package -n     python3-%{github_name}
Summary:        %{sum}
BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  python3-docutils
BuildRequires:  python3-CommonMark
BuildRequires:  python3-pytest
BuildRequires:  python3-sphinx
Requires:       python3-docutils
Requires:       python3-CommonMark
Requires:       python3-sphinx
%{?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

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


%build
%py2_build
%py3_build


%install
#  install python3 first to have unversioned binaries for python 3
%py3_install
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"
done
popd  # Leave buildroot bindir


%py2_install
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"
    fi
done
popd  # Leave buildroot bindir



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


%files -n python2-%{github_name}
%doc README.md
%license license.md
%{python2_sitelib}/%{github_name}-%{version}*-py%{python2_version}.egg-info/
%{python2_sitelib}/%{github_name}/
%exclude %{_bindir}/cm2*-%{python3_version}
%exclude %{_bindir}/cm2*-3
%{_bindir}/cm2*


%files -n python3-%{github_name}
%doc README.md
%license license.md
%{python3_sitelib}/%{github_name}-%{version}*-py%{python3_version}.egg-info/
%{python3_sitelib}/%{github_name}/
%{_bindir}/cm2*-3
%{_bindir}/cm2*-%{python3_version}


%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-14.gitdbed1c4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sat Jan 27 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.4.0-13.gitdbed1c4
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-12.gitdbed1c4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Wed Feb 22 2017 Julien Enselme <jujens@jujens.eu> - 0.4.0-11.gitdbed1c4
- Fix requires

* Wed Feb 22 2017 Julien Enselme <jujens@jujens.eu> - 0.4.0-10.gitdbed1c4
- Add support for CommonMark 0.7.0

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-9.git7ca5247
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.4.0-8.git7ca5247
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0-7.git7ca5247
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Jul 11 2016 Julien Enselme - 0.4.0-6.git7ca5247
- Fix typo in comment

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-5.git7ca5247
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

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

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

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

* Sun Jan 10 2016 Julien Enselme <jujens@jujens.eu> - 0.4.0-1
- Update to 0.4.0

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

* Fri Dec 4 2015 Julien Enselme <jujens@jujens.eu> - 0.2.0-1
- Inital package