]>
Commit | Line | Data |
---|---|---|
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 | ||
7 | %define module markupsafe | |
8 | Summary: MarkupSafe - a XML/HTML/XHTML Markup safe string for Python 2 | |
9 | Summary(pl.UTF-8): MarkupSafe - łańcuch dla Pythona 2 bezpieczny pod kątem znaczników XML/HTML/XHTML | |
10 | Name: python-%{module} | |
11 | Version: 0.18 | |
12 | Release: 2 | |
13 | License: BSD | |
14 | Group: Development/Languages/Python | |
15 | Source0: https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-%{version}.tar.gz | |
16 | # Source0-md5: f8d252fd05371e51dec2fe9a36890687 | |
17 | URL: http://www.pocoo.org/ | |
18 | BuildRequires: rpm-pythonprov | |
19 | BuildRequires: rpmbuild(macros) >= 1.219 | |
20 | %if %{with python2} | |
21 | BuildRequires: python-devel | |
22 | BuildRequires: python-distribute | |
23 | %endif | |
24 | %if %{with python3} | |
25 | BuildRequires: python-2to3 | |
26 | BuildRequires: python3-devel | |
27 | BuildRequires: python3-distribute | |
28 | %endif | |
29 | Requires: python-modules | |
30 | Provides: python-MarkupSafe = %{version}-%{release} | |
31 | Obsoletes: python-MarkupSafe < 0.15-2 | |
32 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
33 | ||
34 | %description | |
35 | MarkupSafe implements a XML/HTML/XHTML Markup safe string for Python. | |
36 | ||
37 | %description -l pl.UTF-8 | |
38 | MarkupSafe to implementacja łańcucha znaków dla Pythona bezpiecznego | |
39 | pod kątem znaczników XML/HTML/XHTML. | |
40 | ||
41 | %package -n python3-markupsafe | |
42 | Summary: Implements a XML/HTML/XHTML Markup safe string for Python 3 | |
43 | Summary(pl.UTF-8): MarkupSafe - łańcuch dla Pythona 3 bezpieczny pod kątem znaczników XML/HTML/XHTML | |
44 | Group: Development/Languages | |
45 | Requires: python3-modules | |
46 | ||
47 | %description -n python3-markupsafe | |
48 | MarkupSafe implements a XML/HTML/XHTML Markup safe string for Python. | |
49 | ||
50 | %description -n python3-markupsafe -l pl.UTF-8 | |
51 | MarkupSafe to implementacja łańcucha znaków dla Pythona bezpiecznego | |
52 | pod kątem znaczników XML/HTML/XHTML. | |
53 | ||
54 | %prep | |
55 | %setup -qc | |
56 | mv MarkupSafe-%{version} py2 | |
57 | # for %doc | |
58 | cp -p py2/{AUTHORS,LICENSE,README.rst} . | |
59 | ||
60 | %if %{with python3} | |
61 | cp -a py2 py3 | |
62 | 2to3 --write --nobackups py3 | |
63 | %endif | |
64 | ||
65 | %build | |
66 | %if %{with python2} | |
67 | cd py3 | |
68 | # CFLAGS is only for arch packages - remove on noarch packages | |
69 | CC="%{__cc}" \ | |
70 | CFLAGS="%{rpmcflags}" \ | |
71 | %{__python} setup.py build | |
72 | %{?with_tests:%{__python} setup.py test} | |
73 | cd .. | |
74 | %endif | |
75 | ||
76 | %if %{with python3} | |
77 | cd py3 | |
78 | CC="%{__cc}" \ | |
79 | CFLAGS="%{rpmcflags}" \ | |
80 | %{__python3} setup.py build | |
81 | %{?with_tests:%{__python3} setup.py test} | |
82 | cd .. | |
83 | %endif | |
84 | ||
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | %if %{with python2} | |
88 | cd py2 | |
89 | %{__python} setup.py install \ | |
90 | --optimize=2 \ | |
91 | --root=$RPM_BUILD_ROOT | |
92 | ||
93 | # C code errantly gets installed | |
94 | %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/markupsafe/_speedups.c | |
95 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
96 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
97 | %py_postclean | |
98 | cd .. | |
99 | %endif | |
100 | ||
101 | %if %{with python3} | |
102 | cd py3 | |
103 | %{__python3} setup.py install \ | |
104 | --optimize=2 \ | |
105 | --root=$RPM_BUILD_ROOT | |
106 | ||
107 | ||
108 | # C code errantly gets installed | |
109 | %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/markupsafe/_speedups.c | |
110 | cd .. | |
111 | %endif | |
112 | ||
113 | %clean | |
114 | rm -rf $RPM_BUILD_ROOT | |
115 | ||
116 | %if %{with python2} | |
117 | %files | |
118 | %defattr(644,root,root,755) | |
119 | %doc AUTHORS LICENSE README.rst | |
120 | %dir %{py_sitedir}/markupsafe | |
121 | %{py_sitedir}/markupsafe/*.py[co] | |
122 | %attr(755,root,root) %{py_sitedir}/markupsafe/_speedups.so | |
123 | %{py_sitedir}/MarkupSafe-%{version}-py*.egg-info | |
124 | %endif | |
125 | ||
126 | %if %{with python3} | |
127 | %files -n python3-markupsafe | |
128 | %defattr(644,root,root,755) | |
129 | %doc AUTHORS LICENSE README.rst | |
130 | %dir %{py3_sitedir}/markupsafe | |
131 | %{py3_sitedir}/markupsafe/*.py | |
132 | %{py3_sitedir}/markupsafe/__pycache__ | |
133 | %attr(755,root,root) %{py3_sitedir}/markupsafe/_speedups.cpython-*.so | |
134 | %{py3_sitedir}/MarkupSafe-%{version}-py*.egg-info | |
135 | %endif |