-# TODO
-# - check py3 tests, are they ran?
-
+#
# Conditional build:
-%bcond_without tests # do not perform "make test"
-%bcond_without py3 # do not build python3 package
+%bcond_without tests # unit tests
+%bcond_without python2 # python2 package
+%bcond_without python3 # python3 package
%define module markdown
-Summary: Markdown implementation in Python
+Summary: Markdown implementation in Python 2
+Summary(pl.UTF-8): Implementacja formatu Markdown w Pythonie 2
Name: python-%{module}
-Version: 2.2.1
-Release: 3
+Version: 2.6.11
+Release: 2
License: BSD
Group: Development/Languages/Python
-Source0: http://pypi.python.org/packages/source/M/Markdown/Markdown-%{version}.tar.gz
-# Source0-md5: 9e002c8051fb346cae75060f3302048a
-URL: http://packages.python.org/Markdown/
+#Source0Download: https://pypi.org/simple/markdown/
+Source0: https://files.pythonhosted.org/packages/source/M/Markdown/Markdown-%{version}.tar.gz
+# Source0-md5: a67c1b2914f7d74eeede2ebe0fdae470
+Patch0: %{name}-yaml.patch
+URL: https://pypi.org/project/markdown/
BuildRequires: python-devel
BuildRequires: python-elementtree
+%if %{with tests}
+BuildRequires: python-PyYAML
BuildRequires: python-nose
-BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.219
-%if %{with py3}
-BuildRequires: python3-devel
+%endif
+%if %{with python3}
+BuildRequires: python3-devel >= 1:3.2
+%if %{with tests}
+BuildRequires: python3-PyYAML
BuildRequires: python3-nose
-# for converting before running the tests:
-BuildRequires: python-2to3
%endif
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
Requires: python-elementtree
Provides: python-Markdown = %{version}-%{release}
-Obsoletes: python-Markdown = 2.2.1
+Obsoletes: python-Markdown < 2.3
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-This is a Python implementation of John Gruber's Markdown. It is
+This is a Python 2 implementation of John Gruber's Markdown. It is
almost completely compliant with the reference implementation, though
there are a few known issues.
+%description -l pl.UTF-8
+Ten pakiet zawiera implementację formatu Markdown Johna Grubera w
+Pythonie 2. Jest prawie całkowicie zgodna z implementacją wzorcową,
+choć jest kilka znanych problemów.
+
%package -n python3-markdown
-Summary: Markdown implementation in Python
+Summary: Markdown implementation in Python 3
+Summary(pl.UTF-8): Implementacja formatu Markdown w Pythonie 3
Group: Development/Languages/Python
%description -n python3-markdown
-This is a Python implementation of John Gruber's Markdown. It is
+This is a Python 3 implementation of John Gruber's Markdown. It is
almost completely compliant with the reference implementation, though
there are a few known issues.
-%prep
-# install does not support --build-base. so create two different trees
-%setup -qc
-mv Markdown-%{version} py2
-cd py2
-
-# remove shebangs
-find markdown -type f -name '*.py' -exec sed -i -e '/^#!/{1D}' {} ';'
+%description -n python3-markdown -l pl.UTF-8
+Ten pakiet zawiera implementację formatu Markdown Johna Grubera w
+Pythonie 3. Jest prawie całkowicie zgodna z implementacją wzorcową,
+choć jest kilka znanych problemów.
-# fix line-ending
-sed -i 's/\r//' docs/release-2.2.0.txt
-
-cd ..
-cp -a py2 py3
+%prep
+%setup -q -n Markdown-%{version}
+%patch0 -p1
%build
-cd py2
-%{__python} setup.py build
+%if %{with python2}
+%py_build
-%if %{with py3}
-cd ../py3
-%{__python3} setup.py build
+%if %{with tests}
+%{__python} ./run-tests.py
%endif
+%endif
+
+%if %{with python3}
+%py3_build
%if %{with tests}
-cd ../py2
-./run-tests.py
-
-%if %{with py3}
-cd ../py3
-2to3 -d -w -n markdown tests run-tests.py > /dev/null
-# FIXME: run-tests.py shebang points to python2, is that correct?
-./run-tests.py
+%{__python3} ./run-tests.py
%endif
%endif
%install
rm -rf $RPM_BUILD_ROOT
-# somewhy --build-base not supported in install
-cd py2
-%{__python} setup.py install \
- --optimize=2 \
- --skip-build \
- --root $RPM_BUILD_ROOT
-
-%py_postclean
-
-# rename binary
-mv $RPM_BUILD_ROOT%{_bindir}/markdown_py{,-%{py_ver}}
-
-%if %{with py3}
-cd ../py3
-%{__python3} setup.py install \
- --optimize=2 \
- --skip-build \
- --root $RPM_BUILD_ROOT
+%if %{with python3}
+%py3_install
# rename binary
-mv $RPM_BUILD_ROOT%{_bindir}/markdown_py{,-%{py3_ver}}
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/markdown_py{,-%{py3_ver}}
%endif
+%if %{with python2}
+%py_install
+%py_postclean
+# rename binary
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/markdown_py{,-%{py_ver}}
# 2.X binary is called by default for now
ln -s markdown_py-%{py_ver} $RPM_BUILD_ROOT%{_bindir}/markdown_py
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc py2/docs/*
+%doc LICENSE.md README.md docs/{change_log,extensions,authors.md,cli.md,favicon.ico,index.md,py.png,reference.md}
%attr(755,root,root) %{_bindir}/markdown_py
%attr(755,root,root) %{_bindir}/markdown_py-%{py_ver}
%{py_sitescriptdir}/markdown
%{py_sitescriptdir}/Markdown-%{version}-py*.egg-info
+%endif
-%if %{with py3}
+%if %{with python3}
%files -n python3-markdown
%defattr(644,root,root,755)
-%doc py3/docs/*
+%doc LICENSE.md README.md docs/{change_log,extensions,authors.md,cli.md,favicon.ico,index.md,py.png,reference.md}
%attr(755,root,root) %{_bindir}/markdown_py-%{py3_ver}
-%{py3_sitescriptdir}/Markdown-%{version}-py*.egg-info
%{py3_sitescriptdir}/markdown
+%{py3_sitescriptdir}/Markdown-%{version}-py*.egg-info
%endif