Blob Blame History Raw
%global upname mistune
%global with_python3 1

Name:           python-mistune
Version:        0.7.1
Release:        2%{?dist}
Summary:        Markdown parser for Python 

License:        BSD
URL:            https://github.com/lepture/mistune
Source0:        https://github.com/lepture/mistune/archive/v%{version}.tar.gz

BuildRequires:  Cython
BuildRequires:  python2-devel
BuildRequires:  python-nose
BuildRequires:  python-setuptools
%if 0%{?with_python3}
BuildRequires:  python3-Cython
BuildRequires:  python3-devel
BuildRequires:  python3-nose
BuildRequires:  python3-setuptools
%endif

%description
The fastest markdown parser in pure Python, inspired by marked.


%if 0%{?with_python3}
%package -n python3-%{upname}
Summary:        Markdown parser for Python

%description -n python3-%{upname}
The fastest markdown parser in pure Python, inspired by marked.
%endif

%prep
%setup -q -n %{upname}-%{version}
# Moved to source archive from github, doesn't contain egg-info
#rm -rf mistune.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'


%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python2} setup.py install --skip-build --root %{buildroot}
%{_fixperms} %{buildroot}/*


%check
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3

%{__python2} setup.py test

%files
%doc LICENSE README.rst
# For arch-specific packages: sitearch
%{python2_sitearch}/%{upname}.*
%{python2_sitearch}/%{upname}-%{version}-py?.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{upname}
%doc LICENSE README.rst
%{python3_sitearch}/%{upname}.*
%{python3_sitearch}/%{upname}-%{version}-py?.?.egg-info
%{python3_sitearch}/__pycache__/%{upname}*
%endif # with_python3

%changelog
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Wed Sep 23 2015 Christian Dersch <lupinix@fedoraproject.org> - 0.7.1-1
- new version

* Wed Jun 17 2015 Christian Dersch <lupinix@fedoraproject.org> - 0.6-1
- new upstream release

* Mon Apr 20 2015 Christian Dersch <lupinix@fedoraproject.org> - 0.5.1-1
- new upstream release (0.5.1)

* Fri Dec  5 2014 Christian Dersch <lupinix@fedoraproject.org> - 0.5-1
- new upstream release
- enabled tests

* Thu Dec  4 2014 Christian Dersch <lupinix@fedoraproject.org> - 0.4.1-2
- spec fixes

* Thu Dec  4 2014 Christian Dersch <lupinix@fedoraproject.org> - 0.4.1-1
- initial spec