]>
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 | ||
a8646d2c | 7 | %define module markupsafe |
02f65cc7 JB |
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 | |
a79f2bec | 10 | Name: python-%{module} |
02f65cc7 | 11 | Version: 0.18 |
8034e6e3 | 12 | Release: 2 |
a79f2bec | 13 | License: BSD |
14 | Group: Development/Languages/Python | |
02f65cc7 JB |
15 | Source0: https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-%{version}.tar.gz |
16 | # Source0-md5: f8d252fd05371e51dec2fe9a36890687 | |
a79f2bec | 17 | URL: http://www.pocoo.org/ |
a79f2bec | 18 | BuildRequires: rpm-pythonprov |
a79f2bec | 19 | BuildRequires: rpmbuild(macros) >= 1.219 |
d1b3c515 ER |
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 | |
933a582b | 29 | Requires: python-modules |
a8646d2c ER |
30 | Provides: python-MarkupSafe = %{version}-%{release} |
31 | Obsoletes: python-MarkupSafe < 0.15-2 | |
a79f2bec | 32 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
33 | ||
34 | %description | |
02f65cc7 JB |
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. | |
a79f2bec | 40 | |
d1b3c515 | 41 | %package -n python3-markupsafe |
02f65cc7 JB |
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 | |
d1b3c515 | 44 | Group: Development/Languages |
02f65cc7 | 45 | Requires: python3-modules |
d1b3c515 ER |
46 | |
47 | %description -n python3-markupsafe | |
02f65cc7 JB |
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. | |
d1b3c515 | 53 | |
a79f2bec | 54 | %prep |
d1b3c515 | 55 | %setup -qc |
a8646d2c | 56 | mv MarkupSafe-%{version} py2 |
d1b3c515 ER |
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 | |
a79f2bec | 64 | |
65 | %build | |
d1b3c515 ER |
66 | %if %{with python2} |
67 | cd py3 | |
a79f2bec | 68 | # CFLAGS is only for arch packages - remove on noarch packages |
be775773 ER |
69 | CC="%{__cc}" \ |
70 | CFLAGS="%{rpmcflags}" \ | |
a79f2bec | 71 | %{__python} setup.py build |
d1b3c515 ER |
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 | |
a79f2bec | 84 | |
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
d1b3c515 ER |
87 | %if %{with python2} |
88 | cd py2 | |
a79f2bec | 89 | %{__python} setup.py install \ |
90 | --optimize=2 \ | |
91 | --root=$RPM_BUILD_ROOT | |
92 | ||
d1b3c515 | 93 | # C code errantly gets installed |
be775773 | 94 | %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/markupsafe/_speedups.c |
a79f2bec | 95 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} |
96 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
97 | %py_postclean | |
d1b3c515 ER |
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 | ||
d1b3c515 ER |
108 | # C code errantly gets installed |
109 | %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/markupsafe/_speedups.c | |
110 | cd .. | |
111 | %endif | |
a79f2bec | 112 | |
113 | %clean | |
114 | rm -rf $RPM_BUILD_ROOT | |
115 | ||
d1b3c515 | 116 | %if %{with python2} |
a79f2bec | 117 | %files |
118 | %defattr(644,root,root,755) | |
d1b3c515 | 119 | %doc AUTHORS LICENSE README.rst |
933a582b | 120 | %dir %{py_sitedir}/markupsafe |
d1b3c515 | 121 | %{py_sitedir}/markupsafe/*.py[co] |
02f65cc7 | 122 | %attr(755,root,root) %{py_sitedir}/markupsafe/_speedups.so |
d1b3c515 ER |
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__ | |
02f65cc7 | 133 | %attr(755,root,root) %{py3_sitedir}/markupsafe/_speedups.cpython-*.so |
d1b3c515 | 134 | %{py3_sitedir}/MarkupSafe-%{version}-py*.egg-info |
a79f2bec | 135 | %endif |