[packages/python-Markdown] up to 2.2.1, add python3-markdown package

glen glen at pld-linux.org
Fri Jan 25 00:06:03 CET 2013


commit 4e2d3523d1d3aeed05dc46c294a0c332b204c05e
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Fri Jan 25 01:03:55 2013 +0200

    up to 2.2.1, add python3-markdown package
    
    using python-markdown [1] which i created mistakenly, did not notice
    this (python-Markdown) already existed.
    
    [1] http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg301477.html

 python-Markdown.spec | 112 +++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 99 insertions(+), 13 deletions(-)
---
diff --git a/python-Markdown.spec b/python-Markdown.spec
index 37e4574..daf9b6b 100644
--- a/python-Markdown.spec
+++ b/python-Markdown.spec
@@ -1,45 +1,131 @@
-%define 	module	Markdown
-Summary:	Python implementation of Markdown
-Name:		python-%{module}
-Version:	2.2.0
+# TODO
+# - check py3 tests, are they ran?
+# - rename to python-markdown (after current python-markdown) is trashed
+
+# Conditional build:
+%bcond_without	tests	# do not perform "make test"
+%bcond_without	py3	# do not build python3 package
+
+%define		srcname	Markdown
+Summary:	Markdown implementation in Python
+Name:		python-Markdown
+Version:	2.2.1
 Release:	1
 License:	BSD
 Group:		Development/Languages/Python
-Source0:	http://pypi.python.org/packages/source/M/Markdown/%{module}-%{version}.tar.gz
-# Source0-md5:	28dd4f54894b3af2615b08f50d2ce4bf
 URL:		http://packages.python.org/Markdown/
+Source0:	http://pypi.python.org/packages/source/M/%{srcname}/%{srcname}-%{version}.tar.gz
+# Source0-md5:	9e002c8051fb346cae75060f3302048a
+BuildRequires:	python-devel
+BuildRequires:	python-elementtree
+BuildRequires:	python-nose
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.219
-Requires:	python-modules >= 2.5
+%if %{with py3}
+BuildRequires:	python3-devel
+BuildRequires:	python3-nose
+# for converting before running the tests:
+BuildRequires:	python-2to3
+%endif
+Requires:	python-elementtree
+Obsoletes:	python-markdown = 2.2.1
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
 This is a Python implementation of John Gruber's Markdown. It is
-almost completely compliant with the reference implementation.
+almost completely compliant with the reference implementation, though
+there are a few known issues.
+
+%package -n python3-markdown
+Summary:	Markdown implementation in Python
+Group:		Development/Languages/Python
+
+%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.
 
 %prep
-%setup -q -n %{module}-%{version}
+# install does not support --build-base. so create two different trees
+%setup -qc
+mv %{srcname}-%{version} py2
+cd py2
+
+# remove shebangs
+find markdown -type f -name '*.py' -exec sed -i -e '/^#!/{1D}' {} ';'
+
+# fix line-ending
+sed -i 's/\r//' docs/release-2.2.0.txt
+
+cd ..
+cp -a py2 py3
 
 %build
+cd py2
 %{__python} setup.py build
 
+%if %{with py3}
+cd ../py3
+%{__python3} setup.py build
+%endif
+
+%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
+%endif
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
+# somewhy --build-base not supported in install
+cd py2
 %{__python} setup.py install \
 	--optimize=2 \
-	--root=$RPM_BUILD_ROOT
+	--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
+
+# rename binary
+mv $RPM_BUILD_ROOT%{_bindir}/markdown_py{,-%{py3_ver}}
+%endif
+
+# 2.X binary is called by default for now
+ln -s markdown_py-%{py_ver} $RPM_BUILD_ROOT%{_bindir}/markdown_py
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc docs
+%doc py2/docs/*
 %attr(755,root,root) %{_bindir}/markdown_py
+%attr(755,root,root) %{_bindir}/markdown_py-%{py_ver}
 %{py_sitescriptdir}/markdown
-%if "%{py_ver}" > "2.4"
-%{py_sitescriptdir}/*.egg-info
+%{py_sitescriptdir}/Markdown-%{version}-py*.egg-info
+
+%if %{with py3}
+%files -n python3-markdown
+%defattr(644,root,root,755)
+%doc py3/docs/*
+%attr(755,root,root) %{_bindir}/markdown_py-%{py3_ver}
+%{py3_sitescriptdir}/Markdown-%{version}-py*.egg-info
+%{py3_sitescriptdir}/markdown
 %endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-Markdown.git/commitdiff/4e2d3523d1d3aeed05dc46c294a0c332b204c05e



More information about the pld-cvs-commit mailing list