%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %if 0%{?fedora} || 0%{?rhel} > 6 %global with_python3 1 %{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")} %endif %define srcname Markdown Name: python-markdown Version: 2.1.1 Release: 1%{?dist} Summary: Markdown implementation in Python Group: Development/Languages License: BSD URL: http://www.freewisdom.org/projects/python-markdown/ Source0: http://pypi.python.org/packages/source/M/%{srcname}/%{srcname}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: python-devel BuildRequires: python-nose %if 0%{?rhel} && 0%{?rhel} < 7 BuildRequires: python-elementtree Requires: python-elementtree %endif %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-nose # for converting before running the tests: BuildRequires: /usr/bin/2to3 %endif # with_python3 %description This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues. %if 0%{?with_python3} %package -n python3-markdown Summary: Markdown implementation in Python Group: Development/Languages %description -n python3-markdown This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues. %endif # with_python3 %prep %setup -q -n %{srcname}-%{version} # remove shebangs find markdown -type f -name '*.py' \ -exec sed -i -e '/^#!/{1D}' {} \; %if 0%{?with_python3} cp -a . %{py3dir} %endif # with_python3 %build %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif # with_python3 %install rm -rf %{buildroot} %{__python} setup.py install -O1 --skip-build --root %{buildroot} # rename binary mv %{buildroot}%{_bindir}/markdown_py{,-%{python_version}} %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root %{buildroot} popd # rename binary mv %{buildroot}%{_bindir}/markdown_py{,-%{python3_version}} %endif # with_python3 # 2.X binary is called by default for now ln -s markdown_py-%{python_version} %{buildroot}%{_bindir}/markdown_py %check ./run-tests.py %if 0%{?with_python3} pushd %{py3dir} 2to3 -d -w -n markdown tests run-tests.py > /dev/null ./run-tests.py popd %endif # with_python3 %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %doc build/docs/* %{python_sitelib}/* %{_bindir}/markdown_py %{_bindir}/markdown_py-%{python_version} %if 0%{?with_python3} %files -n python3-markdown %defattr(-,root,root,-) %doc build/docs/* %{python3_sitelib}/* %{_bindir}/markdown_py-%{python3_version} %endif # with_python3 %changelog * Wed Feb 8 2012 Thomas Moschny - 2.1.1-1 - Update to 2.1.1. * Sat Jan 14 2012 Fedora Release Engineering - 2.1.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Sat Dec 17 2011 Thomas Moschny - 2.1.0-1 - Update to 2.1.0. - Fix rhel conditional. - Binary has been renamed. - Build python3 subpackage. - Include documentation in HTML instead of Markdown format. - Run tests. * Wed Sep 07 2011 Jesse Keating - 2.0.3-4 - Set a version in the rhel macro * Tue Feb 08 2011 Fedora Release Engineering - 2.0.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Thu Jul 22 2010 David Malcolm - 2.0.3-2 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild * Thu Oct 8 2009 Thomas Moschny - 2.0.3-1 - Update to 2.0.3. * Thu Aug 27 2009 Thomas Moschny - 2.0.1-3 - Add requirement on python-elementtree, which was a separate package before Python 2.5. - Re-add changelog entries accidentally removed earlier. * Sun Jul 26 2009 Fedora Release Engineering - 2.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild * Sat Jul 11 2009 Thomas Moschny - 2.0.1-1 - Update to 2.0.1. - Upstream stripped .py of the cmdline script. * Sat Apr 25 2009 Thomas Moschny - 2.0-1 - Update to 2.0. - Adjusted source URL. - License changed to BSD only. - Upstream now provides a script to run markdown from the cmdline. * Thu Feb 26 2009 Fedora Release Engineering - 1.7-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild * Sat Nov 29 2008 Ignacio Vazquez-Abrams - 1.7-2 - Rebuild for Python 2.6 * Mon Aug 4 2008 Thomas Moschny - 1.7-1 - New package.