]> git.pld-linux.org Git - projects/template-specs.git/blob - python.spec
- due to our ftp infrastructure limitation append '-kernel' prefix to
[projects/template-specs.git] / python.spec
1 #
2 # Conditional build:
3 %bcond_without  tests   # do not perform "make test"
4 %bcond_without  python3 # CPython 3.x module
5
6 %define         module  template
7 Summary:        -
8 Summary(pl.UTF-8):      -
9 # Name must match the python module/package name (as in 'import' statement)
10 Name:           python-%{module}
11 Version:        _
12 Release:        0.1
13 License:        - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here)
14 Group:          Libraries/Python
15 Source0:        %{name}-%{version}.tar.gz
16 # Source0-md5:  -
17 URL:            -
18 # remove BR: python-devel for 'noarch' packages.
19 BuildRequires:  python-devel
20 BuildRequires:  python-distribute
21 BuildRequires:  rpm-pythonprov
22 # if py_postclean is used
23 BuildRequires:  rpmbuild(macros) >= 1.219
24 # when python3 present
25 BuildRequires:  sed >= 4.0
26 %if %{with python3}
27 BuildRequires:  python3-devel
28 BuildRequires:  python3-distribute
29 BuildRequires:  python3-modules
30 %endif
31 #Requires:              python-libs
32 Requires:               python-modules
33 #BuildArch:     noarch
34 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
36 %description
37
38 %description -l pl.UTF-8
39
40 %package apidoc
41 Summary:        %{module} API documentation
42 Summary(pl.UTF-8):      Dokumentacja API %{module}
43 Group:          Documentation
44
45 %description apidoc
46 API documentation for %{module}.
47
48 %description apidoc -l pl.UTF-8
49 Dokumentacja API %{module}.
50
51 %prep
52 %setup -q -n %{module}-%{version}
53
54 # fix #!/usr/bin/env python -> #!/usr/bin/python:
55 #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
56
57 %if %{with python3}
58 rm -rf build-3
59 set -- *
60 install -d build-3
61 cp -a "$@" build-3
62 find build-3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
63 %endif
64
65 %build
66 %if %{with python2}
67 %{__python} setup.py build --build-base build-2
68 %endif
69 %if %{with python3}
70 %{__python3} setup.py build --build-base build-3
71 %endif
72
73 # CC/CFLAGS is only for arch packages - remove on noarch packages
74 CC="%{__cc}" \
75 CFLAGS="%{rpmcflags}" \
76 %{__python} setup.py build
77 %{__python} setup.py \
78         build -b build-2
79
80 %{?with_tests:%{__python} setup.py test}
81
82 %if %{with python3}
83 %{__python3} setup.py \
84         build -b build-3
85
86 %if %{with tests}
87 %{__python3} setup.py test
88 %endif
89 %endif
90
91 %if %{with doc}
92 cd docs
93 %{__make} -j1 html
94 rm -rf _build/html/_sources
95 %endif
96
97 %install
98 rm -rf $RPM_BUILD_ROOT
99 %{__python} setup.py install \
100         --skip-build \
101         --optimize=2 \
102         --root=$RPM_BUILD_ROOT
103
104 %{__python} -- setup.py \
105         build -b build-2 \
106         install \
107         --root=$RPM_BUILD_ROOT \
108         --optimize=2
109
110 %if %{with python2}
111 %{__python} setup.py \
112         build --build-base build-2 \
113         install \
114         --root=$RPM_BUILD_ROOT \
115         --optimize=2
116
117 %py_postclean
118 %endif
119
120 %{__python3} -- setup.py \
121         build -b build-3 \
122         install \
123         --root=$RPM_BUILD_ROOT \
124         --optimize=2
125
126 %if %{with python3}
127 %{__python3} setup.py \
128         build --build-base build-3 \
129         install \
130         --root=$RPM_BUILD_ROOT \
131         --optimize=2
132 %endif
133
134 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
135 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
136
137 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
138 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
139 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
140 %py_postclean
141
142 %clean
143 rm -rf $RPM_BUILD_ROOT
144
145 %files
146 %defattr(644,root,root,755)
147 %doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
148 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
149 %{py_sitedir}/*.py[co]
150 %attr(755,root,root) %{py_sitedir}/*.so
151 %if "%{py_ver}" > "2.4"
152 %{py_sitedir}/TEMPLATE-*.egg-info
153 %endif
154 %{_examplesdir}/%{name}-%{version}
155
156 %if %{with python2}
157 %files
158 %defattr(644,root,root,755)
159 %doc AUTHORS CHANGES LICENSE
160 %{py_sitescriptdir}/%{module}
161 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
162 %endif
163
164 %if %{with python3}
165 %files -n python3-%{module}
166 %defattr(644,root,root,755)
167 %doc AUTHORS CHANGES LICENSE
168 %{py3_sitescriptdir}/%{module}
169 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
170 %endif
171
172 %if %{with doc}
173 %files apidoc
174 %defattr(644,root,root,755)
175 %doc docs/_build/html/*
176 %endif
This page took 0.045901 seconds and 4 git commands to generate.