]>
Commit | Line | Data |
---|---|---|
d1b3c515 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
a79f2bec | 7 | %define module MarkupSafe |
8 | Summary: Implements a XML/HTML/XHTML Markup safe string for Python | |
a79f2bec | 9 | Name: python-%{module} |
bcfd65ee | 10 | Version: 0.15 |
d1b3c515 | 11 | Release: 2 |
a79f2bec | 12 | License: BSD |
13 | Group: Development/Languages/Python | |
14 | Source0: http://pypi.python.org/packages/source/M/MarkupSafe/%{module}-%{version}.tar.gz | |
bcfd65ee | 15 | # Source0-md5: 4e7c4d965fe5e033fa2d7bb7746bb186 |
a79f2bec | 16 | URL: http://www.pocoo.org/ |
a79f2bec | 17 | BuildRequires: rpm-pythonprov |
a79f2bec | 18 | BuildRequires: rpmbuild(macros) >= 1.219 |
d1b3c515 ER |
19 | %if %{with python2} |
20 | BuildRequires: python-devel | |
21 | BuildRequires: python-distribute | |
22 | %endif | |
23 | %if %{with python3} | |
24 | BuildRequires: python-2to3 | |
25 | BuildRequires: python3-devel | |
26 | BuildRequires: python3-distribute | |
27 | %endif | |
933a582b | 28 | Requires: python-modules |
a79f2bec | 29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
30 | ||
31 | %description | |
32 | Implements a XML/HTML/XHTML Markup safe string for Python. | |
33 | ||
d1b3c515 ER |
34 | %package -n python3-markupsafe |
35 | Summary: Implements a XML/HTML/XHTML Markup safe string for Python | |
36 | Group: Development/Languages | |
37 | ||
38 | %description -n python3-markupsafe | |
39 | Implements a XML/HTML/XHTML Markup safe string for Python. | |
40 | ||
a79f2bec | 41 | %prep |
d1b3c515 ER |
42 | %setup -qc |
43 | mv %{module}-%{version} py2 | |
44 | # for %doc | |
45 | cp -p py2/{AUTHORS,LICENSE,README.rst} . | |
46 | ||
47 | %if %{with python3} | |
48 | cp -a py2 py3 | |
49 | 2to3 --write --nobackups py3 | |
50 | %endif | |
a79f2bec | 51 | |
52 | %build | |
d1b3c515 ER |
53 | %if %{with python2} |
54 | cd py3 | |
a79f2bec | 55 | # CFLAGS is only for arch packages - remove on noarch packages |
be775773 ER |
56 | CC="%{__cc}" \ |
57 | CFLAGS="%{rpmcflags}" \ | |
a79f2bec | 58 | %{__python} setup.py build |
d1b3c515 ER |
59 | %{?with_tests:%{__python} setup.py test} |
60 | cd .. | |
61 | %endif | |
62 | ||
63 | %if %{with python3} | |
64 | cd py3 | |
65 | CC="%{__cc}" \ | |
66 | CFLAGS="%{rpmcflags}" \ | |
67 | %{__python3} setup.py build | |
68 | %{?with_tests:%{__python3} setup.py test} | |
69 | cd .. | |
70 | %endif | |
a79f2bec | 71 | |
72 | %install | |
73 | rm -rf $RPM_BUILD_ROOT | |
d1b3c515 ER |
74 | %if %{with python2} |
75 | cd py2 | |
a79f2bec | 76 | %{__python} setup.py install \ |
77 | --optimize=2 \ | |
78 | --root=$RPM_BUILD_ROOT | |
79 | ||
d1b3c515 | 80 | # C code errantly gets installed |
be775773 | 81 | %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/markupsafe/_speedups.c |
a79f2bec | 82 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} |
83 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
84 | %py_postclean | |
d1b3c515 ER |
85 | cd .. |
86 | %endif | |
87 | ||
88 | %if %{with python3} | |
89 | cd py3 | |
90 | %{__python3} setup.py install \ | |
91 | --optimize=2 \ | |
92 | --root=$RPM_BUILD_ROOT | |
93 | ||
94 | ||
95 | # err the unversioned one is duplicate | |
96 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/MarkupSafe.egg-info | |
97 | ||
98 | # C code errantly gets installed | |
99 | %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/markupsafe/_speedups.c | |
100 | cd .. | |
101 | %endif | |
a79f2bec | 102 | |
103 | %clean | |
104 | rm -rf $RPM_BUILD_ROOT | |
105 | ||
d1b3c515 | 106 | %if %{with python2} |
a79f2bec | 107 | %files |
108 | %defattr(644,root,root,755) | |
d1b3c515 | 109 | %doc AUTHORS LICENSE README.rst |
933a582b | 110 | %dir %{py_sitedir}/markupsafe |
d1b3c515 | 111 | %{py_sitedir}/markupsafe/*.py[co] |
a79f2bec | 112 | %attr(755,root,root) %{py_sitedir}/markupsafe/*.so |
d1b3c515 ER |
113 | %{py_sitedir}/MarkupSafe-%{version}-py*.egg-info |
114 | %endif | |
115 | ||
116 | %if %{with python3} | |
117 | %files -n python3-markupsafe | |
118 | %defattr(644,root,root,755) | |
119 | %doc AUTHORS LICENSE README.rst | |
120 | %dir %{py3_sitedir}/markupsafe | |
121 | %{py3_sitedir}/markupsafe/*.py | |
122 | %{py3_sitedir}/markupsafe/__pycache__ | |
123 | %attr(755,root,root) %{py3_sitedir}/markupsafe/*.so | |
124 | %{py3_sitedir}/MarkupSafe-%{version}-py*.egg-info | |
a79f2bec | 125 | %endif |