]> git.pld-linux.org Git - packages/python-markdown.git/blob - python-markdown.spec
- python 3.5 rebuild
[packages/python-markdown.git] / python-markdown.spec
1 # TODO
2 # - check py3 tests, are they ran?
3
4 # Conditional build:
5 %bcond_without  tests   # do not perform "make test"
6 %bcond_without  py3     # do not build python3 package
7
8 %define         module  markdown
9 Summary:        Markdown implementation in Python
10 Name:           python-%{module}
11 Version:        2.2.1
12 Release:        4
13 License:        BSD
14 Group:          Development/Languages/Python
15 Source0:        http://pypi.python.org/packages/source/M/Markdown/Markdown-%{version}.tar.gz
16 # Source0-md5:  9e002c8051fb346cae75060f3302048a
17 URL:            http://packages.python.org/Markdown/
18 BuildRequires:  python-devel
19 BuildRequires:  python-elementtree
20 BuildRequires:  python-nose
21 BuildRequires:  rpm-pythonprov
22 BuildRequires:  rpmbuild(macros) >= 1.219
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
30 Provides:       python-Markdown = %{version}-%{release}
31 Obsoletes:      python-Markdown = 2.2.1
32 BuildArch:      noarch
33 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
34
35 %description
36 This is a Python implementation of John Gruber's Markdown. It is
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.
48
49 %prep
50 # install does not support --build-base. so create two different trees
51 %setup -qc
52 mv Markdown-%{version} py2
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
63
64 %build
65 cd py2
66 %{__python} setup.py build
67
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
85 %install
86 rm -rf $RPM_BUILD_ROOT
87 # somewhy --build-base not supported in install
88 cd py2
89 %{__python} setup.py install \
90         --optimize=2 \
91         --skip-build \
92         --root $RPM_BUILD_ROOT
93
94 %py_postclean
95
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
113 %clean
114 rm -rf $RPM_BUILD_ROOT
115
116 %files
117 %defattr(644,root,root,755)
118 %doc py2/docs/*
119 %attr(755,root,root) %{_bindir}/markdown_py
120 %attr(755,root,root) %{_bindir}/markdown_py-%{py_ver}
121 %{py_sitescriptdir}/markdown
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
131 %endif
This page took 0.066697 seconds and 3 git commands to generate.