Contents of /trunk/include/pypi.sminc
Parent Directory | Revision Log
Revision 33627 -
(show annotations)
(download)
Thu Aug 10 15:08:29 2023 UTC (9 months ago) by niro
File size: 4856 byte(s)
Thu Aug 10 15:08:29 2023 UTC (9 months ago) by niro
File size: 4856 byte(s)
-make every python version configurable for which packages will be build
1 | # $Id$ |
2 | # Pypi functions |
3 | |
4 | # default to build modules for multiple python versions (atm python2 and python3) |
5 | : ${PYPI_MULTIPLE_PYTHON_VERSIONS=1} |
6 | # which python version should be enabled |
7 | : ${PYPI_ENABLED_PYTHON_VERSION2=0} |
8 | : ${PYPI_ENABLED_PYTHON_VERSION3=1} |
9 | |
10 | # needs python |
11 | sminclude python |
12 | |
13 | : ${SPLIT_PNAME="${PNAME}"} |
14 | : ${PYPI_MODULE="${PNAME}"} |
15 | : ${PYPI_ARCHIVE="gz"} |
16 | |
17 | # some sane defaults |
18 | : ${PCAT="dev-python"} |
19 | # always lower letters |
20 | : ${HOMEPAGE="http://pypi.python.org/pypi/${PYPI_MODULE}"} |
21 | |
22 | case ${PYPI_ARCHIVE} in |
23 | gz|bz2|xz) : ${SRCFILE="${PYPI_MODULE}-${PVER}.tar.${PYPI_ARCHIVE}"} ;; |
24 | *) : ${SRCFILE="${PYPI_MODULE}-${PVER}.${PYPI_ARCHIVE}"} ;; |
25 | esac |
26 | |
27 | : ${SRCDIR="${BUILDDIR}/${PYPI_MODULE}-${PVER}"} |
28 | |
29 | |
30 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
31 | then |
32 | SPLIT_PACKAGES="" |
33 | |
34 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
35 | then |
36 | sminclude python2 |
37 | SPLIT_PACKAGES+=" python2-${SPLIT_PNAME}" |
38 | |
39 | eval "split_info_python2-${SPLIT_PNAME}() |
40 | { |
41 | DEPEND=\"\${DEPEND} |
42 | \${PYTHON2_DEPEND} |
43 | >= dev-lang/python2-2.7\" |
44 | }" |
45 | fi |
46 | |
47 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
48 | then |
49 | sminclude python3 |
50 | SPLIT_PACKAGES+=" python3-${SPLIT_PNAME}" |
51 | |
52 | eval "split_info_python3-${SPLIT_PNAME}() |
53 | { |
54 | DEPEND=\"\${DEPEND} |
55 | \${PYTHON3_DEPEND} |
56 | >= dev-lang/python3-3.11\" |
57 | |
58 | SDEPEND=\"\${SDEPEND} |
59 | >= dev-python/python-flit-core-3.9 |
60 | >= dev-python/python-wheel-0.40\" |
61 | }" |
62 | fi |
63 | |
64 | else |
65 | DEPEND="${DEPEND} |
66 | >= dev-lang/python-3" |
67 | SDEPEND="${SDEPEND} |
68 | >= dev-python/python-flit-core-3.9 |
69 | >= dev-python/python-wheel-0.40" |
70 | fi |
71 | |
72 | SRC_URI=( |
73 | ${SRC_URI[*]} |
74 | https://pypi.io/packages/source/${PYPI_MODULE:0:1}/${PYPI_MODULE}/${SRCFILE} |
75 | #https://pypi.python.org/packages/source/${PYPI_MODULE:0:1}/${PYPI_MODULE}/${SRCFILE} |
76 | mirror://${PNAME}/${SRCFILE} |
77 | ) |
78 | |
79 | UP2SUBSTITUTE=".asc" |
80 | UP2DATE="updatecmd_pypi ${PYPI_MODULE} ${PYPI_ARCHIVE}" |
81 | |
82 | pypi_src_prepare() |
83 | { |
84 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
85 | then |
86 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
87 | then |
88 | python2_src_prepare || die |
89 | fi |
90 | |
91 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
92 | then |
93 | python3_src_prepare || die |
94 | fi |
95 | else |
96 | python_src_prepare || die |
97 | fi |
98 | } |
99 | |
100 | pypi_multilib_src_prepare() |
101 | { |
102 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
103 | then |
104 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
105 | then |
106 | python2_multilib_src_prepare || die |
107 | fi |
108 | |
109 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
110 | then |
111 | python3_multilib_src_prepare || die |
112 | fi |
113 | else |
114 | python_multilib_src_prepare || die |
115 | fi |
116 | } |
117 | |
118 | pypi_src_compile() |
119 | { |
120 | local configure_opts="$@" |
121 | |
122 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
123 | then |
124 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
125 | then |
126 | python2_src_compile ${configure_opts} || die |
127 | fi |
128 | |
129 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
130 | then |
131 | python3_src_compile ${configure_opts} || die |
132 | fi |
133 | else |
134 | python_src_compile ${configure_opts} || die |
135 | fi |
136 | } |
137 | |
138 | pypi_multilib_src_compile() |
139 | { |
140 | local configure_opts="$@" |
141 | |
142 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
143 | then |
144 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
145 | then |
146 | python2_multilib_src_compile ${configure_opts} || die |
147 | fi |
148 | |
149 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
150 | then |
151 | python3_multilib_src_compile ${configure_opts} || die |
152 | fi |
153 | else |
154 | python_multilib_src_compile ${configure_opts} || die |
155 | fi |
156 | } |
157 | |
158 | pypi_src_install() |
159 | { |
160 | python_src_install || die |
161 | } |
162 | |
163 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
164 | then |
165 | eval "pypi_src_install_python2-${SPLIT_PNAME}() |
166 | { |
167 | python2_src_install || die |
168 | }" |
169 | fi |
170 | |
171 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
172 | then |
173 | eval "pypi_src_install_python3-${SPLIT_PNAME}() |
174 | { |
175 | python3_src_install || die |
176 | }" |
177 | fi |
178 | |
179 | pypi_multilib_src_install() |
180 | { |
181 | python_multilib_src_install || die |
182 | } |
183 | |
184 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
185 | then |
186 | eval "pypi_multilib_src_install_python2-${SPLIT_PNAME}() |
187 | { |
188 | python2_multilib_src_install || die |
189 | }" |
190 | fi |
191 | |
192 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
193 | then |
194 | eval "pypi_multilib_src_install_python3-${SPLIT_PNAME}() |
195 | { |
196 | python3_multilib_src_install || die |
197 | }" |
198 | fi |
199 | |
200 | if [[ ${MULTILIB_BUILD} = true ]] |
201 | then |
202 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
203 | then |
204 | export_inherits pypi_multilib src_prepare src_compile |
205 | |
206 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
207 | then |
208 | export_inherits pypi_multilib src_install_python2-${SPLIT_PNAME} |
209 | fi |
210 | |
211 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
212 | then |
213 | export_inherits pypi_multilib src_install_python3-${SPLIT_PNAME} |
214 | fi |
215 | else |
216 | export_inherits pypi_multilib src_prepare src_compile src_install |
217 | fi |
218 | else |
219 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
220 | then |
221 | export_inherits pypi src_prepare src_compile |
222 | |
223 | if [[ ${PYPI_ENABLED_PYTHON_VERSION2} = 1 ]] |
224 | then |
225 | export_inherits pypi src_install_python2-${SPLIT_PNAME} |
226 | fi |
227 | |
228 | if [[ ${PYPI_ENABLED_PYTHON_VERSION3} = 1 ]] |
229 | then |
230 | export_inherits pypi src_install_python3-${SPLIT_PNAME} |
231 | fi |
232 | else |
233 | export_inherits pypi src_prepare src_compile src_install |
234 | fi |
235 | fi |