]>
Commit | Line | Data |
---|---|---|
4e2d3523 ER |
1 | # TODO |
2 | # - check py3 tests, are they ran? | |
4e2d3523 ER |
3 | |
4 | # Conditional build: | |
5 | %bcond_without tests # do not perform "make test" | |
6 | %bcond_without py3 # do not build python3 package | |
7 | ||
4ceaf0fc | 8 | %define module markdown |
4e2d3523 | 9 | Summary: Markdown implementation in Python |
4ceaf0fc | 10 | Name: python-%{module} |
4e2d3523 | 11 | Version: 2.2.1 |
4052415c | 12 | Release: 3 |
a974dd9e AF |
13 | License: BSD |
14 | Group: Development/Languages/Python | |
4ceaf0fc | 15 | Source0: http://pypi.python.org/packages/source/M/Markdown/Markdown-%{version}.tar.gz |
4e2d3523 | 16 | # Source0-md5: 9e002c8051fb346cae75060f3302048a |
4ceaf0fc | 17 | URL: http://packages.python.org/Markdown/ |
4e2d3523 ER |
18 | BuildRequires: python-devel |
19 | BuildRequires: python-elementtree | |
20 | BuildRequires: python-nose | |
a974dd9e AF |
21 | BuildRequires: rpm-pythonprov |
22 | BuildRequires: rpmbuild(macros) >= 1.219 | |
4e2d3523 ER |
23 | %if %{with py3} |
24 | BuildRequires: python3-devel | |
25 | BuildRequires: python3-nose | |
26 | # for converting before running the tests: | |
27 | BuildRequires: python-2to3 | |
28 | %endif | |
29 | Requires: python-elementtree | |
4ceaf0fc ER |
30 | Provides: python-Markdown = %{version}-%{release} |
31 | Obsoletes: python-Markdown = 2.2.1 | |
a974dd9e AF |
32 | BuildArch: noarch |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
34 | ||
35 | %description | |
8ae41e2f | 36 | This is a Python implementation of John Gruber's Markdown. It is |
4e2d3523 ER |
37 | almost completely compliant with the reference implementation, though |
38 | there are a few known issues. | |
39 | ||
40 | %package -n python3-markdown | |
41 | Summary: Markdown implementation in Python | |
42 | Group: Development/Languages/Python | |
43 | ||
44 | %description -n python3-markdown | |
45 | This is a Python implementation of John Gruber's Markdown. It is | |
46 | almost completely compliant with the reference implementation, though | |
47 | there are a few known issues. | |
a974dd9e AF |
48 | |
49 | %prep | |
4e2d3523 ER |
50 | # install does not support --build-base. so create two different trees |
51 | %setup -qc | |
4ceaf0fc | 52 | mv Markdown-%{version} py2 |
4e2d3523 ER |
53 | cd py2 |
54 | ||
55 | # remove shebangs | |
56 | find markdown -type f -name '*.py' -exec sed -i -e '/^#!/{1D}' {} ';' | |
57 | ||
58 | # fix line-ending | |
59 | sed -i 's/\r//' docs/release-2.2.0.txt | |
60 | ||
61 | cd .. | |
62 | cp -a py2 py3 | |
a974dd9e AF |
63 | |
64 | %build | |
4e2d3523 | 65 | cd py2 |
a974dd9e AF |
66 | %{__python} setup.py build |
67 | ||
4e2d3523 ER |
68 | %if %{with py3} |
69 | cd ../py3 | |
70 | %{__python3} setup.py build | |
71 | %endif | |
72 | ||
73 | %if %{with tests} | |
74 | cd ../py2 | |
75 | ./run-tests.py | |
76 | ||
77 | %if %{with py3} | |
78 | cd ../py3 | |
79 | 2to3 -d -w -n markdown tests run-tests.py > /dev/null | |
80 | # FIXME: run-tests.py shebang points to python2, is that correct? | |
81 | ./run-tests.py | |
82 | %endif | |
83 | %endif | |
84 | ||
a974dd9e AF |
85 | %install |
86 | rm -rf $RPM_BUILD_ROOT | |
4e2d3523 ER |
87 | # somewhy --build-base not supported in install |
88 | cd py2 | |
a974dd9e AF |
89 | %{__python} setup.py install \ |
90 | --optimize=2 \ | |
4e2d3523 ER |
91 | --skip-build \ |
92 | --root $RPM_BUILD_ROOT | |
a974dd9e AF |
93 | |
94 | %py_postclean | |
95 | ||
4e2d3523 ER |
96 | # rename binary |
97 | mv $RPM_BUILD_ROOT%{_bindir}/markdown_py{,-%{py_ver}} | |
98 | ||
99 | %if %{with py3} | |
100 | cd ../py3 | |
101 | %{__python3} setup.py install \ | |
102 | --optimize=2 \ | |
103 | --skip-build \ | |
104 | --root $RPM_BUILD_ROOT | |
105 | ||
106 | # rename binary | |
107 | mv $RPM_BUILD_ROOT%{_bindir}/markdown_py{,-%{py3_ver}} | |
108 | %endif | |
109 | ||
110 | # 2.X binary is called by default for now | |
111 | ln -s markdown_py-%{py_ver} $RPM_BUILD_ROOT%{_bindir}/markdown_py | |
112 | ||
a974dd9e AF |
113 | %clean |
114 | rm -rf $RPM_BUILD_ROOT | |
115 | ||
116 | %files | |
117 | %defattr(644,root,root,755) | |
4e2d3523 | 118 | %doc py2/docs/* |
8ae41e2f | 119 | %attr(755,root,root) %{_bindir}/markdown_py |
4e2d3523 | 120 | %attr(755,root,root) %{_bindir}/markdown_py-%{py_ver} |
a974dd9e | 121 | %{py_sitescriptdir}/markdown |
4e2d3523 ER |
122 | %{py_sitescriptdir}/Markdown-%{version}-py*.egg-info |
123 | ||
124 | %if %{with py3} | |
125 | %files -n python3-markdown | |
126 | %defattr(644,root,root,755) | |
127 | %doc py3/docs/* | |
128 | %attr(755,root,root) %{_bindir}/markdown_py-%{py3_ver} | |
129 | %{py3_sitescriptdir}/Markdown-%{version}-py*.egg-info | |
130 | %{py3_sitescriptdir}/markdown | |
a974dd9e | 131 | %endif |