]>
Commit | Line | Data |
---|---|---|
21189e0f MK |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # don't build doc | |
4 | %bcond_with tests # do not perform "make test" | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | ||
9 | %define module flask | |
10 | Summary: A microframework based on Werkzeug, Jinja2 and good intentions | |
11 | Name: python-%{module} | |
12 | Version: 0.10.1 | |
0f227bd5 | 13 | Release: 2 |
21189e0f MK |
14 | License: BSD |
15 | Group: Development/Languages/Python | |
16 | # https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz | |
17 | Source0: http://pypi.python.org/packages/source/F/Flask/Flask-%{version}.tar.gz | |
18 | # Source0-md5: 378670fe456957eb3c27ddaef60b2b24 | |
19 | URL: http://flask.pocoo.org/ | |
20 | %if %{with python2} | |
21 | BuildRequires: python-devel | |
22 | BuildRequires: python-distribute | |
23 | BuildRequires: python-distribute | |
24 | BuildRequires: python-jinja2 >= 2.4 | |
25 | BuildRequires: python-werkzeug >= 0.6.1 | |
26 | BuildRequires: rpm-pythonprov | |
27 | BuildRequires: rpmbuild(macros) >= 1.219 | |
28 | ||
29 | %endif | |
30 | %if %{with python3} | |
31 | BuildRequires: python3-devel | |
32 | BuildRequires: python3-distribute | |
33 | BuildRequires: python3-jinja2 >= 2.4 | |
34 | BuildRequires: python3-modules | |
35 | BuildRequires: python3-werkzeug >= 0.6.1 | |
36 | %endif | |
37 | ||
38 | Requires: python-itsdangerous | |
39 | Requires: python-jinja2 >= 2.4 | |
40 | Requires: python-modules | |
41 | Requires: python-werkzeug >= 0.6.1 | |
42 | BuildArch: noarch | |
43 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
44 | ||
45 | %description | |
46 | Flask is a microframework for Python based on Werkzeug, Jinja 2 and | |
47 | good intentions. | |
48 | ||
49 | %package -n python3-%{module} | |
50 | Summary: - | |
51 | Summary(pl.UTF-8): - | |
52 | Group: Libraries/Python | |
53 | Requires: python3-itsdangerous | |
54 | Requires: python3-jinja2 >= 2.4 | |
55 | Requires: python3-modules | |
56 | Requires: python3-werkzeug >= 0.6.1 | |
57 | ||
58 | %description -n python3-%{module} | |
59 | Flask is a microframework for Python based on Werkzeug, Jinja 2 and | |
60 | good intentions. | |
61 | ||
62 | # %description -n python3-%{module} -l pl.UTF-8 | |
63 | ||
64 | ||
65 | %prep | |
66 | %setup -q -n Flask-%{version} | |
67 | ||
68 | %build | |
69 | %if %{with python2} | |
70 | # CC/CFLAGS is only for arch packages - remove on noarch packages | |
71 | CC="%{__cc}" \ | |
72 | CFLAGS="%{rpmcflags}" \ | |
73 | %{__python} setup.py build --build-base build-2 %{?with_tests:test} | |
74 | %endif | |
75 | ||
76 | %if %{with python3} | |
77 | # CC/CFLAGS is only for arch packages - remove on noarch packages | |
78 | CC="%{__cc}" \ | |
79 | CFLAGS="%{rpmcflags}" \ | |
80 | %{__python3} setup.py build --build-base build-3 %{?with_tests:test} | |
81 | %endif | |
82 | ||
83 | %install | |
84 | rm -rf $RPM_BUILD_ROOT | |
85 | ||
86 | %if %{with python2} | |
87 | %{__python} setup.py \ | |
88 | build --build-base build-2 \ | |
89 | install --skip-build \ | |
90 | --optimize=2 \ | |
91 | --root=$RPM_BUILD_ROOT | |
92 | ||
93 | %py_postclean | |
94 | %endif | |
95 | ||
96 | %if %{with python3} | |
97 | %{__python3} setup.py \ | |
98 | build --build-base build-3 \ | |
99 | install --skip-build \ | |
100 | --optimize=2 \ | |
101 | --root=$RPM_BUILD_ROOT | |
102 | %endif | |
103 | ||
104 | # in case there are examples provided | |
105 | %if %{with python2} | |
106 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
107 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
108 | %endif | |
109 | %if %{with python3} | |
110 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
111 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
112 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ | |
113 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
114 | %endif | |
115 | ||
116 | ||
117 | ||
118 | %clean | |
119 | rm -rf $RPM_BUILD_ROOT | |
120 | ||
121 | %if %{with python2} | |
122 | %files | |
123 | %defattr(644,root,root,755) | |
124 | %doc AUTHORS CHANGES README | |
125 | %{py_sitescriptdir}/%{module} | |
126 | %if "%{py_ver}" > "2.4" | |
127 | %{py_sitescriptdir}/Flask-*.egg-info | |
128 | %endif | |
129 | %{_examplesdir}/%{name}-%{version} | |
130 | %endif | |
131 | ||
132 | %if %{with python3} | |
133 | %files -n python3-%{module} | |
134 | %defattr(644,root,root,755) | |
135 | %doc AUTHORS CHANGES LICENSE | |
136 | %{py3_sitescriptdir}/%{module} | |
137 | %{py3_sitescriptdir}/Flask-%{version}-py*.egg-info | |
138 | %{_examplesdir}/python3-%{module}-%{version} | |
139 | %endif |