Lines 6-12
Link Here
|
6 |
# |
6 |
# |
7 |
# Feature: python |
7 |
# Feature: python |
8 |
# Usage: USES=python or USES=python:args |
8 |
# Usage: USES=python or USES=python:args |
9 |
# Valid ARGS: <version>, build, run, test |
9 |
# Valid ARGS: <version>, <implementation>, build, run, test |
10 |
# |
10 |
# |
11 |
# version If your port requires only some set of Python versions, you |
11 |
# version If your port requires only some set of Python versions, you |
12 |
# can set this to [min]-[max] or min+ or -max or as an |
12 |
# can set this to [min]-[max] or min+ or -max or as an |
Lines 22-27
Link Here
|
22 |
# USES=python # Use the set default Python |
22 |
# USES=python # Use the set default Python |
23 |
# # version |
23 |
# # version |
24 |
# |
24 |
# |
|
|
25 |
# implementation If your port requires a specific Python implementation, you |
26 |
# can specify this: |
27 |
# |
28 |
# USES=python:cpython # lang/python |
29 |
# USES=python:pypy # lang/pypy |
30 |
# |
25 |
# build Indicates that Python is needed at build time and adds |
31 |
# build Indicates that Python is needed at build time and adds |
26 |
# it to BUILD_DEPENDS. |
32 |
# it to BUILD_DEPENDS. |
27 |
# run Indicates that Python is needed at run time and adds |
33 |
# run Indicates that Python is needed at run time and adds |
Lines 36-42
Link Here
|
36 |
# Variables, which can be set by a user: |
42 |
# Variables, which can be set by a user: |
37 |
# |
43 |
# |
38 |
# PYTHON_VERSION - The chosen Python interpreter including the version, |
44 |
# PYTHON_VERSION - The chosen Python interpreter including the version, |
39 |
# e.g. python2.7, python3.3, etc. This allows the user |
45 |
# e.g. cpython2.7, pypy3.3, etc. This allows the user |
40 |
# to override the currently chosen default version and |
46 |
# to override the currently chosen default version and |
41 |
# to install the port for a specific Python version. |
47 |
# to install the port for a specific Python version. |
42 |
# It must not be set by a port. |
48 |
# It must not be set by a port. |
Lines 92-98
Link Here
|
92 |
# |
98 |
# |
93 |
# PYTHON_CMD - Python's command line file name, including the |
99 |
# PYTHON_CMD - Python's command line file name, including the |
94 |
# version number (used for dependencies). |
100 |
# version number (used for dependencies). |
95 |
# default: ${PYTHONBASE}/bin/${PYTHON_VERSION} |
101 |
# default: |
|
|
102 |
# cpython: ${PYTHONBASE}/bin/python${PYTHON_VER} |
103 |
# pypy: ${LOCALBASE}/bin/pypy${PYTHON_MAJOR_VER:S/2//} |
104 |
# |
105 |
# PYTHON_LIB - Python's library file name (used to link against) |
106 |
# default: |
107 |
# cpython: ${PYTHONBASE}/lib/libpython${PYTHON_VER}${PYTHON_ABIVER}.so |
108 |
# pypy: ${PYTHON_LIBDIR}/libpypy-c.so |
96 |
# |
109 |
# |
97 |
# PYSETUP - Name of the setup script used by the distutils |
110 |
# PYSETUP - Name of the setup script used by the distutils |
98 |
# package. |
111 |
# package. |
Lines 128-134
Link Here
|
128 |
# |
141 |
# |
129 |
# PYDISTUTILS_INSTALLARGS |
142 |
# PYDISTUTILS_INSTALLARGS |
130 |
# - Arguments to install with distutils. |
143 |
# - Arguments to install with distutils. |
131 |
# default: -c -O1 --prefix=${PREFIX} --single-version-externally-managed --root=${STAGEDIR} |
144 |
# default: -c -O1 --prefix=${PYTHONPREFIX} --single-version-externally-managed --root=${STAGEDIR} |
132 |
# |
145 |
# |
133 |
# PYDISTUTILS_EGGINFO |
146 |
# PYDISTUTILS_EGGINFO |
134 |
# - Canonical name for egg-info. |
147 |
# - Canonical name for egg-info. |
Lines 137-143
Link Here
|
137 |
# The following variables can be read by ports and must not be modified: |
150 |
# The following variables can be read by ports and must not be modified: |
138 |
# |
151 |
# |
139 |
# PYTHONBASE - The installation prefix of the chosen Python |
152 |
# PYTHONBASE - The installation prefix of the chosen Python |
140 |
# interpreter, e.g. /usr/local |
153 |
# interpreter |
|
|
154 |
# default: |
155 |
# cpython: ${LOCALBASE} |
156 |
# pypy: ${LOCALBASE}/pypy-${PYPY_VER} |
141 |
# |
157 |
# |
142 |
# PYTHON_PORTVERSION |
158 |
# PYTHON_PORTVERSION |
143 |
# - Version number suitable for ${PORTVERSION}. |
159 |
# - Version number suitable for ${PORTVERSION}. |
Lines 161-182
Link Here
|
161 |
# interpreter, e.g. md |
177 |
# interpreter, e.g. md |
162 |
# |
178 |
# |
163 |
# PYTHON_INCLUDEDIR - Location of the Python include files. |
179 |
# PYTHON_INCLUDEDIR - Location of the Python include files. |
164 |
# default: ${PYTHONBASE}/include/${PYTHON_VERSION} |
180 |
# default: |
|
|
181 |
# cpython: ${PYTHONBASE}/include/python${PYTHON_VER} |
182 |
# pypy: ${PYTHONBASE}/include |
165 |
# |
183 |
# |
166 |
# PYTHON_LIBDIR - Base of the python library tree |
184 |
# PYTHON_LIBDIR - Base of the python library tree |
167 |
# default: ${PYTHONBASE}/lib/${PYTHON_VERSION} |
185 |
# default: |
|
|
186 |
# cpython: ${PYTHONBASE}/lib/python${PYTHON_VER} |
187 |
# pypy: ${PYTHONBASE}/bin |
168 |
# |
188 |
# |
169 |
# PYTHON_SITELIBDIR - Location of the site-packages tree. Don't change, |
189 |
# PYTHON_SITELIBDIR - Location of the site-packages tree. Don't change, |
170 |
# unless you know what you do. |
190 |
# unless you know what you do. |
171 |
# default: ${PYTHON_LIBDIR}/site-packages |
191 |
# default: |
|
|
192 |
# cpython: ${PYTHON_LIBDIR}/site-packages |
193 |
# pypy: ${PYTHONBASE}/site-packages |
172 |
# |
194 |
# |
173 |
# There are PREFIX-clean variants of the PYTHON_*DIR variables above. |
195 |
# There are PREFIX-clean variants of the PYTHON_*DIR variables above. |
174 |
# They are meant to be used by ports instead of the above variables, so the |
196 |
# They are meant to be used by ports instead of the above variables, so the |
175 |
# ports respect ${PREFIX} (unless USE_PYTHON=pythonprefix is specified). |
197 |
# ports respect ${PREFIX} (unless USE_PYTHON=pythonprefix is specified). |
176 |
# |
198 |
# |
177 |
# PYTHONPREFIX_INCLUDEDIR default: ${PREFIX}/include/${PYTHON_VERSION} |
199 |
# PYTHONPREFIX_INCLUDEDIR |
178 |
# PYTHONPREFIX_LIBDIR default: ${PREFIX}/lib/${PYTHON_VERSION} |
200 |
# PYTHONPREFIX_LIBDIR |
179 |
# PYTHONPREFIX_SITELIBDIR default: ${PYTHONPREFIX_LIBDIR}/site-packages |
201 |
# PYTHONPREFIX_SITELIBDIR |
180 |
# |
202 |
# |
181 |
# PYTHON_PLATFORM - Python's idea of the OS release. |
203 |
# PYTHON_PLATFORM - Python's idea of the OS release. |
182 |
# This is faked with ${OPSYS} and ${OSREL} until we |
204 |
# This is faked with ${OPSYS} and ${OSREL} until we |
Lines 188-194
Link Here
|
188 |
# packages for different Python versions. |
210 |
# packages for different Python versions. |
189 |
# default: py${PYTHON_SUFFIX}- |
211 |
# default: py${PYTHON_SUFFIX}- |
190 |
# |
212 |
# |
191 |
# Using USES=python.mk also will add some useful entries to PLIST_SUB: |
213 |
# Using USES=python also will add some useful entries to PLIST_SUB: |
192 |
# |
214 |
# |
193 |
# PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR:S;${PREFIX}/;;} |
215 |
# PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR:S;${PREFIX}/;;} |
194 |
# PYTHON_LIBDIR=${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;} |
216 |
# PYTHON_LIBDIR=${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;} |
Lines 219-232
Link Here
|
219 |
.if !defined(_INCLUDE_USES_PYTHON_MK) |
241 |
.if !defined(_INCLUDE_USES_PYTHON_MK) |
220 |
_INCLUDE_USES_PYTHON_MK= yes |
242 |
_INCLUDE_USES_PYTHON_MK= yes |
221 |
|
243 |
|
222 |
# What Python version and what Python interpreters are currently supported? |
|
|
223 |
# When adding a version, please keep the comment in |
224 |
# Mk/bsd.default-versions.mk in sync. |
225 |
_PYTHON_VERSIONS= 2.7 3.5 3.4 3.3 # preferred first |
226 |
_PYTHON_PORTBRANCH= 2.7 # ${_PYTHON_VERSIONS:[1]} |
227 |
_PYTHON_BASECMD= ${LOCALBASE}/bin/python |
228 |
_PYTHON_RELPORTDIR= lang/python |
229 |
|
230 |
# Make each individual feature available as _PYTHON_FEATURE_<FEATURENAME> |
244 |
# Make each individual feature available as _PYTHON_FEATURE_<FEATURENAME> |
231 |
.for var in ${USE_PYTHON} |
245 |
.for var in ${USE_PYTHON} |
232 |
_PYTHON_FEATURE_${var:tu}= yes |
246 |
_PYTHON_FEATURE_${var:tu}= yes |
Lines 250-255
_PYTHON_ARGS:= ${_PYTHON_ARGS:Nrun}
Link Here
|
250 |
_PYTHON_TEST_DEP= yes |
264 |
_PYTHON_TEST_DEP= yes |
251 |
_PYTHON_ARGS:= ${_PYTHON_ARGS:Ntest} |
265 |
_PYTHON_ARGS:= ${_PYTHON_ARGS:Ntest} |
252 |
.endif |
266 |
.endif |
|
|
267 |
.undef _PYTHON_IMPL |
268 |
.for impl in cpython pypy |
269 |
. if ${_PYTHON_ARGS:M${impl}} |
270 |
_PYTHON_IMPL+= ${impl} |
271 |
_PYTHON_ARGS:= ${_PYTHON_ARGS:N${impl}} |
272 |
. endif |
273 |
.endfor |
253 |
|
274 |
|
254 |
# The port does not specify a build, run or test dependency, assume all are |
275 |
# The port does not specify a build, run or test dependency, assume all are |
255 |
# required. |
276 |
# required. |
Lines 260-265
_PYTHON_RUN_DEP= yes
Link Here
|
260 |
_PYTHON_TEST_DEP= yes |
281 |
_PYTHON_TEST_DEP= yes |
261 |
.endif |
282 |
.endif |
262 |
|
283 |
|
|
|
284 |
.for var in PYTHON_DEFAULT_VERSION PYTHON2_DEFAULT_VERSION PYTHON3_DEFAULT_VERSION PYTHON_DEFAULT PYTHON2_DEFAULT PYTHON3_DEFAULT _PYTHON_DEFAULT_VERSION |
285 |
. if defined(${var}) |
286 |
cleanvar:= ${${var}} |
287 |
. if ${cleanvar:C/^([a-z]*).*/\1/} == "" |
288 |
cleanvar:= cpython${cleanvar} |
289 |
. endif |
290 |
cleanvar:= ${cleanvar:S/^python/cpython/} |
291 |
. if ${cleanvar} != ${${var}} |
292 |
WARNING+= "Converting ${var}=${${var}} to ${var}=${cleanvar}" |
293 |
${var}:= ${cleanvar} |
294 |
. endif |
295 |
. endif |
296 |
.endfor |
297 |
|
263 |
.if defined(PYTHON_DEFAULT_VERSION) |
298 |
.if defined(PYTHON_DEFAULT_VERSION) |
264 |
WARNING+= "PYTHON_DEFAULT_VERSION is defined, consider using DEFAULT_VERSIONS=python=${PYTHON_DEFAULT_VERSION:S/^python//} instead" |
299 |
WARNING+= "PYTHON_DEFAULT_VERSION is defined, consider using DEFAULT_VERSIONS=python=${PYTHON_DEFAULT_VERSION:S/^python//} instead" |
265 |
.endif |
300 |
.endif |
Lines 271-311
WARNING+= "PYTHON3_DEFAULT_VERSION is defined, consider using DEFAULT_VERSIONS=p
Link Here
|
271 |
.endif |
306 |
.endif |
272 |
|
307 |
|
273 |
.if exists(${LOCALBASE}/bin/python) |
308 |
.if exists(${LOCALBASE}/bin/python) |
274 |
.if !defined(_PYTHON_DEFAULT_VERSION) |
309 |
. if !defined(_PYTHON_DEFAULT_VERSION) |
275 |
_PYTHON_DEFAULT_VERSION!= (${LOCALBASE}/bin/python -c \ |
310 |
_PYTHON_DEFAULT_VERSION!= (${LOCALBASE}/bin/python -c \ |
276 |
'import sys; print("%d.%d" % sys.version_info[:2])' 2> /dev/null \ |
311 |
'import platform, sys; print("%s%d.%d" % ((platform.python_implementation().lower(),) + sys.version_info[:2]))' 2> /dev/null \ |
277 |
|| ${ECHO_CMD} ${_PYTHON_PORTBRANCH}) | ${TAIL} -1 |
312 |
|| ${ECHO_CMD} ${PYTHON_DEFAULT}) | ${TAIL} -1 |
278 |
.endif |
313 |
. endif |
279 |
_EXPORTED_VARS+= _PYTHON_DEFAULT_VERSION |
314 |
_EXPORTED_VARS+= _PYTHON_DEFAULT_VERSION |
280 |
.if defined(PYTHON_DEFAULT) && (${PYTHON_DEFAULT} != ${_PYTHON_DEFAULT_VERSION}) |
315 |
. if defined(PYTHON_DEFAULT) && (${PYTHON_DEFAULT} != ${_PYTHON_DEFAULT_VERSION}) |
281 |
WARNING+= "Your requested default python version ${PYTHON_DEFAULT} is different from the installed default python interpreter version ${_PYTHON_DEFAULT_VERSION}" |
316 |
WARNING+= "Your requested default python version ${PYTHON_DEFAULT} is different from the installed default python interpreter version ${_PYTHON_DEFAULT_VERSION}" |
282 |
.endif |
317 |
. endif |
283 |
PYTHON_DEFAULT_VERSION= python${_PYTHON_DEFAULT_VERSION} |
318 |
PYTHON_DEFAULT_VERSION= ${_PYTHON_DEFAULT_VERSION} |
284 |
.else |
319 |
.else |
285 |
PYTHON_DEFAULT_VERSION= python${PYTHON_DEFAULT} |
320 |
PYTHON_DEFAULT_VERSION= ${PYTHON_DEFAULT} |
286 |
.endif # exists(${LOCALBASE}/bin/python) |
321 |
.endif # exists(${LOCALBASE}/bin/python) |
287 |
|
322 |
|
288 |
# Is only a meta-port version defined? |
323 |
# Is only a meta-port version defined? |
289 |
.if ${PYTHON_DEFAULT_VERSION} == "python2" |
324 |
.if ${PYTHON_DEFAULT_VERSION:C/^[a-z]+//} == "2" |
290 |
PYTHON2_DEFAULT_VERSION?= python${PYTHON2_DEFAULT} |
325 |
PYTHON2_DEFAULT_VERSION?= ${PYTHON2_DEFAULT} |
291 |
.elif ${PYTHON_DEFAULT_VERSION:R} == "python2" |
326 |
.elif ${PYTHON_DEFAULT_VERSION:R:C/^[a-z]+//} == "2" |
292 |
PYTHON2_DEFAULT_VERSION= ${PYTHON_DEFAULT_VERSION} |
327 |
PYTHON2_DEFAULT_VERSION= ${PYTHON_DEFAULT_VERSION} |
293 |
.else |
328 |
.else |
294 |
PYTHON2_DEFAULT_VERSION?= python${PYTHON2_DEFAULT} |
329 |
PYTHON2_DEFAULT_VERSION?= ${PYTHON2_DEFAULT} |
295 |
.endif |
330 |
.endif |
296 |
.if ${PYTHON_DEFAULT_VERSION} == "python3" |
331 |
.if ${PYTHON_DEFAULT_VERSION:C/^[a-z]+//} == "3" |
297 |
PYTHON3_DEFAULT_VERSION?= python${PYTHON3_DEFAULT} |
332 |
PYTHON3_DEFAULT_VERSION?= ${PYTHON3_DEFAULT} |
298 |
.elif ${PYTHON_DEFAULT_VERSION:R} == "python3" |
333 |
.elif ${PYTHON_DEFAULT_VERSION:R:C/^[a-z]+//} == "3" |
299 |
PYTHON3_DEFAULT_VERSION= ${PYTHON_DEFAULT_VERSION} |
334 |
PYTHON3_DEFAULT_VERSION= ${PYTHON_DEFAULT_VERSION} |
300 |
.else |
335 |
.else |
301 |
PYTHON3_DEFAULT_VERSION?= python${PYTHON3_DEFAULT} |
336 |
PYTHON3_DEFAULT_VERSION?= ${PYTHON3_DEFAULT} |
302 |
.endif |
337 |
.endif |
303 |
|
338 |
|
304 |
.if ${_PYTHON_ARGS} == "2" |
339 |
.if ${_PYTHON_ARGS} == "2" |
305 |
_PYTHON_ARGS= ${PYTHON2_DEFAULT_VERSION:S/^python//} |
340 |
_PYTHON_ARGS= ${PYTHON2_DEFAULT_VERSION:C/^[a-z]+//} |
306 |
_WANTS_META_PORT= 2 |
341 |
_WANTS_META_PORT= 2 |
307 |
.elif ${_PYTHON_ARGS} == "3" |
342 |
.elif ${_PYTHON_ARGS} == "3" |
308 |
_PYTHON_ARGS= ${PYTHON3_DEFAULT_VERSION:S/^python//} |
343 |
_PYTHON_ARGS= ${PYTHON3_DEFAULT_VERSION:C/^[a-z]+//} |
309 |
_WANTS_META_PORT= 3 |
344 |
_WANTS_META_PORT= 3 |
310 |
.endif # ${_PYTHON_ARGS} == "2" |
345 |
.endif # ${_PYTHON_ARGS} == "2" |
311 |
|
346 |
|
Lines 325-335
_WANTS_META_PORT= 3
Link Here
|
325 |
# that maintainers know what they are doing and assume PYTHON_VERSION to be a |
360 |
# that maintainers know what they are doing and assume PYTHON_VERSION to be a |
326 |
# hint. Just warn maintainers, if the versions do not match |
361 |
# hint. Just warn maintainers, if the versions do not match |
327 |
# (_PYTHON_VERSION_NONSUPPORTED). |
362 |
# (_PYTHON_VERSION_NONSUPPORTED). |
328 |
_PYTHON_VERSION:= ${PYTHON_VERSION:S/^python//} |
363 |
_PYTHON_VERSION:= ${PYTHON_VERSION:C/^[a-z]+//} |
|
|
364 |
_PYTHON_VERSION_IMPL= ${PYTHON_VERSION:C/^([a-z]+).*/\1/} |
365 |
. if defined(_PYTHON_IMPL) && ${_PYTHON_IMPL} != ${_PYTHON_VERSION_IMPL} |
366 |
IGNORE?= "needs Python implementation ${_PYTHON_VERSION_IMPL}. But a port depending on this one specified ${_PYTHON_IMPL}" |
367 |
. else |
368 |
_PYTHON_IMPL= ${_PYTHON_VERSION_IMPL} |
369 |
. endif |
329 |
.else |
370 |
.else |
330 |
_PYTHON_VERSION:= ${PYTHON_DEFAULT_VERSION:S/^python//} |
371 |
_PYTHON_VERSION:= ${PYTHON_DEFAULT_VERSION:C/^[a-z]+//} |
|
|
372 |
_PYTHON_IMPL?= ${PYTHON_DEFAULT_VERSION:C/^([a-z]+).*/\1/} |
331 |
.endif # defined(PYTHON_VERSION) |
373 |
.endif # defined(PYTHON_VERSION) |
332 |
|
374 |
|
|
|
375 |
.if ${_PYTHON_IMPL} == cpython |
376 |
_PYTHON_BINNAME= python |
377 |
_PYTHON_SHORTNAME= py |
378 |
_PYTHON_VERSIONS= 2.7 3.5 3.4 3.3 # preferred first |
379 |
|
380 |
PYTHON_PORTSDIR= lang/python${PYTHON_SUFFIX} |
381 |
PYTHON_CMD?= ${LOCALBASE}/bin/python${PYTHON_VER} |
382 |
PYTHON_LIB= ${PYTHONBASE}/lib/libpython${_PYTHON_VERSION}${PYTHON_ABIVER}.so |
383 |
|
384 |
PYTHON_INCLUDEDIR= ${PYTHONBASE}/include/python${_PYTHON_VERSION}${PYTHON_ABIVER} |
385 |
PYTHON_LIBDIR= ${PYTHONBASE}/lib/python${_PYTHON_VERSION} |
386 |
PYTHON_SITELIBDIR= ${PYTHON_LIBDIR}/site-packages |
387 |
.elif ${_PYTHON_IMPL} == pypy |
388 |
_PYTHON_BINNAME= pypy |
389 |
_PYTHON_SHORTNAME= pypy |
390 |
_PYTHON_VERSIONS= 2.7 3.3 # preferred first |
391 |
|
392 |
PYTHON_PORTSDIR= lang/pypy${PYTHON_SUFFIX:C/(.).*/\1/:S/2//} |
393 |
PYTHON_CMD?= ${LOCALBASE}/bin/pypy${PYTHON_SUFFIX:C/(.).*/\1/:S/2//} |
394 |
PYTHON_LIB= ${PYTHON_LIBDIR}/libpypy-c.so |
395 |
|
396 |
PYTHON_INCLUDEDIR= ${PYTHONBASE}/include |
397 |
PYTHON_LIBDIR= ${PYTHONBASE}/bin |
398 |
PYTHON_SITELIBDIR= ${PYTHONBASE}/site-packages |
399 |
.else |
400 |
IGNORE?= "needs an unsupported implementation '${_PYTHON_IMPL}' of Python (supported implementations: cpython, pypy)" |
401 |
.endif # ${_PYTHON_IMPL} |
402 |
|
333 |
# Validate Python version whether it meets the version restriction. |
403 |
# Validate Python version whether it meets the version restriction. |
334 |
_PYTHON_VERSION_CHECK:= ${_PYTHON_ARGS:C/^([1-9]\.[0-9])$/\1-\1/} |
404 |
_PYTHON_VERSION_CHECK:= ${_PYTHON_ARGS:C/^([1-9]\.[0-9])$/\1-\1/} |
335 |
_PYTHON_VERSION_MINIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/([1-9]\.[0-9])[-+].*/\1/} |
405 |
_PYTHON_VERSION_MINIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/([1-9]\.[0-9])[-+].*/\1/} |
Lines 342-376
_PYTHON_VERSION_MAXIMUM:= ${_PYTHON_VERSION_MAXIMUM_TMP:M[1-9].[0-9]}
Link Here
|
342 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MINIMUM} at least |
412 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MINIMUM} at least |
343 |
.elif !empty(_PYTHON_VERSION_MAXIMUM) && (${_PYTHON_VERSION} > ${_PYTHON_VERSION_MAXIMUM}) |
413 |
.elif !empty(_PYTHON_VERSION_MAXIMUM) && (${_PYTHON_VERSION} > ${_PYTHON_VERSION_MAXIMUM}) |
344 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MAXIMUM} at most |
414 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MAXIMUM} at most |
|
|
415 |
.else |
416 |
. undef _PYTHON_VERSION_SUPPORTED |
417 |
. for supported_ver in ${_PYTHON_VERSIONS} |
418 |
. if ${_PYTHON_VERSION} == ${supported_ver} |
419 |
_PYTHON_VERSION_SUPPORTED= yes |
420 |
. endif |
421 |
. endfor |
422 |
. if !defined(_PYTHON_VERSION_SUPPORTED) |
423 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSIONS} (unsupported) |
424 |
. endif |
425 |
. undef _PYTHON_VERSION_SUPPORTED |
345 |
.endif |
426 |
.endif |
346 |
|
427 |
|
347 |
# If we have an unsupported version of Python, try another. |
428 |
# If we have an unsupported version of Python, try another. |
348 |
.if defined(_PYTHON_VERSION_NONSUPPORTED) |
429 |
.if defined(_PYTHON_VERSION_NONSUPPORTED) |
349 |
.if defined(PYTHON_VERSION) || defined(PYTHON_CMD) |
430 |
. if defined(PYTHON_VERSION) || defined(PYTHON_CMD) |
350 |
_PV:= ${_PYTHON_VERSION} # preserve the specified python version |
431 |
_PV:= ${_PYTHON_VERSION} # preserve the specified python version |
351 |
WARNING+= "needs Python ${_PYTHON_VERSION_NONSUPPORTED}. But a port depending on this one specified ${_PV}" |
432 |
WARNING+= "needs Python ${_PYTHON_VERSION_NONSUPPORTED}. But a port depending on this one specified ${_PV}" |
352 |
.endif # defined(PYTHON_VERSION) || defined(PYTHON_CMD) |
433 |
. endif # defined(PYTHON_VERSION) || defined(PYTHON_CMD) |
353 |
.undef _PYTHON_VERSION |
434 |
. undef _PYTHON_VERSION |
354 |
.for ver in ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} ${_PYTHON_VERSIONS} |
435 |
. for ver in ${PYTHON_DEFAULT:C/^[a-z]+//} ${PYTHON2_DEFAULT:C/^[a-z]+//} ${PYTHON3_DEFAULT:C/^[a-z]+//} ${_PYTHON_VERSIONS} |
355 |
__VER= ${ver} |
436 |
. if !defined(_PYTHON_VERSION) && \ |
356 |
.if !defined(_PYTHON_VERSION) && \ |
|
|
357 |
!(!empty(_PYTHON_VERSION_MINIMUM) && ( \ |
437 |
!(!empty(_PYTHON_VERSION_MINIMUM) && ( \ |
358 |
${__VER} < ${_PYTHON_VERSION_MINIMUM})) && \ |
438 |
${_PYTHON_VERSION_MINIMUM} > ${ver})) && \ |
359 |
!(!empty(_PYTHON_VERSION_MAXIMUM) && ( \ |
439 |
!(!empty(_PYTHON_VERSION_MAXIMUM) && ( \ |
360 |
${__VER} > ${_PYTHON_VERSION_MAXIMUM})) |
440 |
${_PYTHON_VERSION_MAXIMUM} < ${ver} )) |
361 |
_PYTHON_VERSION= ${ver} |
441 |
_ver= ${ver} |
362 |
.endif |
442 |
. for supported_ver in ${_PYTHON_VERSIONS} |
363 |
.endfor |
443 |
. if !defined(_PYTHON_VERSION) && ${_ver} == ${supported_ver} |
364 |
.if !defined(_PYTHON_VERSION) |
444 |
_PYTHON_VERSION:= ${ver} |
365 |
IGNORE= needs an unsupported version of Python |
445 |
. endif |
366 |
.endif |
446 |
. endfor |
|
|
447 |
. endif |
448 |
. endfor |
449 |
. if !defined(_PYTHON_VERSION) |
450 |
IGNORE?= "needs an unsupported version of Python" |
451 |
. endif |
367 |
.endif # defined(_PYTHON_VERSION_NONSUPPORTED) |
452 |
.endif # defined(_PYTHON_VERSION_NONSUPPORTED) |
368 |
|
453 |
|
369 |
# Pass PYTHON_VERSION down the dependency chain. This ensures that |
454 |
# Pass PYTHON_VERSION down the dependency chain. This ensures that |
370 |
# port A -> B -> C all will use the same python version and do not |
455 |
# port A -> B -> C all will use the same python version and do not |
371 |
# try to find a different one, if the passed version fits into |
456 |
# try to find a different one, if the passed version fits into |
372 |
# the supported version range. |
457 |
# the supported version range. |
373 |
PYTHON_VERSION?= python${_PYTHON_VERSION} |
458 |
PYTHON_VERSION?= ${_PYTHON_IMPL}${_PYTHON_VERSION} |
374 |
.if !defined(PYTHON_NO_DEPENDS) |
459 |
.if !defined(PYTHON_NO_DEPENDS) |
375 |
DEPENDS_ARGS+= PYTHON_VERSION=${PYTHON_VERSION} |
460 |
DEPENDS_ARGS+= PYTHON_VERSION=${PYTHON_VERSION} |
376 |
.endif |
461 |
.endif |
Lines 378-387
DEPENDS_ARGS+= PYTHON_VERSION=${PYTHON_VERSION}
Link Here
|
378 |
# NOTE: |
463 |
# NOTE: |
379 |
# |
464 |
# |
380 |
# PYTHON_VERSION will hold whatever is passed down the dependency chain. |
465 |
# PYTHON_VERSION will hold whatever is passed down the dependency chain. |
381 |
# If a user runs `make PYTHON_VERSION=python3.3, PYTHON_VERSION will be |
466 |
# If a user runs `make PYTHON_VERSION=cpython3.3, PYTHON_VERSION will be |
382 |
# set to 'python3.3'. A port however may require a different version, |
467 |
# set to 'cpython3.3'. A port however may require a different version, |
383 |
# which is stored (above) in _PYTHON_VERSION. |
468 |
# which is stored (above) in _PYTHON_VERSION. |
384 |
# Every python bit below hence should use python${_PYTHON_VERSION}, since |
469 |
# Every python bit below hence should use ${_PYTHON_IMPL}${_PYTHON_VERSION}, since |
385 |
# this is the value, the _port_ requires |
470 |
# this is the value, the _port_ requires |
386 |
# |
471 |
# |
387 |
|
472 |
|
Lines 391-399
PYTHON_SUFFIX= ${_PYTHON_VERSION:S/.//g}
Link Here
|
391 |
PYTHON_MAJOR_VER= ${PYTHON_VER:R} |
476 |
PYTHON_MAJOR_VER= ${PYTHON_VER:R} |
392 |
PYTHON_REL= # empty |
477 |
PYTHON_REL= # empty |
393 |
PYTHON_ABIVER= # empty |
478 |
PYTHON_ABIVER= # empty |
394 |
PYTHON_PORTSDIR= ${_PYTHON_RELPORTDIR}${PYTHON_SUFFIX} |
479 |
|
395 |
# Protect partial checkouts from Mk/Scripts/functions.sh:export_ports_env(). |
480 |
# Protect partial checkouts from Mk/Scripts/functions.sh:export_ports_env(). |
396 |
.if !defined(_PORTS_ENV_CHECK) || exists(${PORTSDIR}/${PYTHON_PORTSDIR}) |
481 |
.if (!defined(_PORTS_ENV_CHECK) || exists(${PORTSDIR}/${PYTHON_PORTSDIR}/Makefile.version)) && defined(PYTHON_PORTSDIR) |
397 |
.include "${PORTSDIR}/${PYTHON_PORTSDIR}/Makefile.version" |
482 |
.include "${PORTSDIR}/${PYTHON_PORTSDIR}/Makefile.version" |
398 |
.endif |
483 |
.endif |
399 |
# Create a 4 integer version string, prefixing 0 to the last token if |
484 |
# Create a 4 integer version string, prefixing 0 to the last token if |
Lines 403-409
PYTHON_PORTSDIR= ${_PYTHON_RELPORTDIR}${PYTHON_SUFFIX}
Link Here
|
403 |
PYTHON_REL= ${PYTHON_PORTVERSION:C/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/:C/\.([0-9]+)$/.0\1/:C/\.0?([0-9][0-9])$/.\1/:S/.//g} |
488 |
PYTHON_REL= ${PYTHON_PORTVERSION:C/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/:C/\.([0-9]+)$/.0\1/:C/\.0?([0-9][0-9])$/.\1/:S/.//g} |
404 |
|
489 |
|
405 |
# Might be overridden by calling ports |
490 |
# Might be overridden by calling ports |
406 |
PYTHON_CMD?= ${_PYTHON_BASECMD}${_PYTHON_VERSION} |
|
|
407 |
.if ${PYTHON_VER} != 2.7 |
491 |
.if ${PYTHON_VER} != 2.7 |
408 |
.if exists(${PYTHON_CMD}-config) |
492 |
.if exists(${PYTHON_CMD}-config) |
409 |
PYTHON_ABIVER!= ${PYTHON_CMD}-config --abiflags |
493 |
PYTHON_ABIVER!= ${PYTHON_CMD}-config --abiflags |
Lines 419-434
PYTHONBASE!= (${PYTHON_CMD} -c 'import sys; print(sys.prefix)' \
Link Here
|
419 |
.endif |
503 |
.endif |
420 |
_EXPORTED_VARS+= PYTHONBASE |
504 |
_EXPORTED_VARS+= PYTHONBASE |
421 |
|
505 |
|
422 |
PYTHON_INCLUDEDIR= ${PYTHONBASE}/include/python${_PYTHON_VERSION}${PYTHON_ABIVER} |
|
|
423 |
PYTHON_LIBDIR= ${PYTHONBASE}/lib/python${_PYTHON_VERSION} |
424 |
PYTHON_PLATFORM= ${OPSYS:tl}${OSREL:C/\.[0-9.]*//} |
506 |
PYTHON_PLATFORM= ${OPSYS:tl}${OSREL:C/\.[0-9.]*//} |
425 |
PYTHON_SITELIBDIR= ${PYTHON_LIBDIR}/site-packages |
507 |
PYTHON_PKGNAMEPREFIX= ${_PYTHON_SHORTNAME}${PYTHON_SUFFIX}- |
426 |
PYTHON_PKGNAMEPREFIX= py${PYTHON_SUFFIX}- |
508 |
PYTHON_PKGNAMESUFFIX= -${_PYTHON_SHORTNAME}${PYTHON_SUFFIX} |
427 |
PYTHON_PKGNAMESUFFIX= -py${PYTHON_SUFFIX} |
|
|
428 |
|
509 |
|
429 |
PYTHONPREFIX_INCLUDEDIR= ${PYTHON_INCLUDEDIR:S;${PYTHONBASE};${PREFIX};} |
510 |
PYTHONPREFIX= ${PYTHONBASE:S;${LOCALBASE};${PREFIX};} |
430 |
PYTHONPREFIX_LIBDIR= ${PYTHON_LIBDIR:S;${PYTHONBASE};${PREFIX};} |
511 |
PYTHONPREFIX_INCLUDEDIR= ${PYTHON_INCLUDEDIR:S;${LOCALBASE};${PREFIX};} |
431 |
PYTHONPREFIX_SITELIBDIR= ${PYTHON_SITELIBDIR:S;${PYTHONBASE};${PREFIX};} |
512 |
PYTHONPREFIX_LIBDIR= ${PYTHON_LIBDIR:S;${LOCALBASE};${PREFIX};} |
|
|
513 |
PYTHONPREFIX_SITELIBDIR= ${PYTHON_SITELIBDIR:S;${LOCALBASE};${PREFIX};} |
432 |
|
514 |
|
433 |
# Used for recording the installed files. |
515 |
# Used for recording the installed files. |
434 |
_PYTHONPKGLIST= ${WRKDIR}/.PLIST.pymodtmp |
516 |
_PYTHONPKGLIST= ${WRKDIR}/.PLIST.pymodtmp |
Lines 469-476
UNIQUE_FIND_SUFFIX_FILES= \
Link Here
|
469 |
_CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX} |
551 |
_CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX} |
470 |
.if defined(_PYTHON_FEATURE_DISTUTILS) && \ |
552 |
.if defined(_PYTHON_FEATURE_DISTUTILS) && \ |
471 |
${_CURRENTPORT:S/${PYTHON_SUFFIX}$//} != ${PYTHON_PKGNAMEPREFIX}setuptools |
553 |
${_CURRENTPORT:S/${PYTHON_SUFFIX}$//} != ${PYTHON_PKGNAMEPREFIX}setuptools |
472 |
BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools${PYTHON_SUFFIX}>0:devel/py-setuptools${PYTHON_SUFFIX} |
554 |
BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools${PYTHON_SUFFIX}>0:devel/${_PYTHON_SHORTNAME}-setuptools${PYTHON_SUFFIX} |
473 |
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools${PYTHON_SUFFIX}>0:devel/py-setuptools${PYTHON_SUFFIX} |
555 |
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools${PYTHON_SUFFIX}>0:devel/${_PYTHON_SHORTNAME}-setuptools${PYTHON_SUFFIX} |
474 |
.endif |
556 |
.endif |
475 |
|
557 |
|
476 |
# distutils support |
558 |
# distutils support |
Lines 481-487
PYDISTUTILS_SETUP?= -c \
Link Here
|
481 |
exec(compile(open(__file__, 'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec'))" |
563 |
exec(compile(open(__file__, 'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec'))" |
482 |
PYDISTUTILS_CONFIGUREARGS?= # empty |
564 |
PYDISTUTILS_CONFIGUREARGS?= # empty |
483 |
PYDISTUTILS_BUILDARGS?= # empty |
565 |
PYDISTUTILS_BUILDARGS?= # empty |
484 |
PYDISTUTILS_INSTALLARGS?= -c -O1 --prefix=${PREFIX} |
566 |
PYDISTUTILS_INSTALLARGS?= -c -O1 --prefix=${PYTHONPREFIX} |
485 |
.if defined(_PYTHON_FEATURE_DISTUTILS) |
567 |
.if defined(_PYTHON_FEATURE_DISTUTILS) |
486 |
. if !defined(PYDISTUTILS_INSTALLNOSINGLE) |
568 |
. if !defined(PYDISTUTILS_INSTALLNOSINGLE) |
487 |
PYDISTUTILS_INSTALLARGS+= --single-version-externally-managed |
569 |
PYDISTUTILS_INSTALLARGS+= --single-version-externally-managed |
Lines 564-582
PYNUMPY= ${PYTHON_SITELIBDIR}/numpy/core/numeric.py:math/py-numpy
Link Here
|
564 |
.if defined(_PYTHON_BUILD_DEP) |
646 |
.if defined(_PYTHON_BUILD_DEP) |
565 |
BUILD_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} |
647 |
BUILD_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} |
566 |
.if defined(_WANTS_META_PORT) |
648 |
.if defined(_WANTS_META_PORT) |
567 |
BUILD_DEPENDS+= python${_WANTS_META_PORT}:${_PYTHON_RELPORTDIR}${_WANTS_META_PORT} |
649 |
BUILD_DEPENDS+= python${_WANTS_META_PORT}:lang/python${_WANTS_META_PORT} |
568 |
.endif |
650 |
.endif |
569 |
.endif |
651 |
.endif |
570 |
.if defined(_PYTHON_RUN_DEP) |
652 |
.if defined(_PYTHON_RUN_DEP) |
571 |
RUN_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} |
653 |
RUN_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} |
572 |
.if defined(_WANTS_META_PORT) |
654 |
.if defined(_WANTS_META_PORT) |
573 |
RUN_DEPENDS+= python${_WANTS_META_PORT}:${_PYTHON_RELPORTDIR}${_WANTS_META_PORT} |
655 |
RUN_DEPENDS+= python${_WANTS_META_PORT}:lang/python${_WANTS_META_PORT} |
574 |
.endif |
656 |
.endif |
575 |
.endif |
657 |
.endif |
576 |
.if defined(_PYTHON_TEST_DEP) |
658 |
.if defined(_PYTHON_TEST_DEP) |
577 |
TEST_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} |
659 |
TEST_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} |
578 |
.if defined(_WANTS_META_PORT) |
660 |
.if defined(_WANTS_META_PORT) |
579 |
TEST_DEPENDS+= python${_WANTS_META_PORT}:${_PYTHON_RELPORTDIR}${_WANTS_META_PORT} |
661 |
TEST_DEPENDS+= python${_WANTS_META_PORT}:lang/python${_WANTS_META_PORT} |
580 |
.endif |
662 |
.endif |
581 |
.endif |
663 |
.endif |
582 |
|
664 |
|
Lines 593-599
PLIST_SUB+= PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR:S;${PREFIX}/;;} \
Link Here
|
593 |
PYTHON_PLATFORM=${PYTHON_PLATFORM} \ |
675 |
PYTHON_PLATFORM=${PYTHON_PLATFORM} \ |
594 |
PYTHON_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;} \ |
676 |
PYTHON_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;} \ |
595 |
PYTHON_VER=${PYTHON_VER} \ |
677 |
PYTHON_VER=${PYTHON_VER} \ |
596 |
PYTHON_VERSION=python${_PYTHON_VERSION} |
678 |
PYTHON_VERSION=${_PYTHON_IMPL}${_PYTHON_VERSION} |
597 |
|
679 |
|
598 |
_USES_POST+= python |
680 |
_USES_POST+= python |
599 |
.endif # _INCLUDE_USES_PYTHON_MK |
681 |
.endif # _INCLUDE_USES_PYTHON_MK |