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