Lines 323-362
_PYTHON_TEST_DEP= yes
Link Here
|
323 |
.if ${PYTHON2_DEFAULT} != ${PYTHON_DEFAULT} && ${PYTHON3_DEFAULT} != ${PYTHON_DEFAULT} |
323 |
.if ${PYTHON2_DEFAULT} != ${PYTHON_DEFAULT} && ${PYTHON3_DEFAULT} != ${PYTHON_DEFAULT} |
324 |
WARNING+= "PYTHON_DEFAULT must be a version present in PYTHON2_DEFAULT or PYTHON3_DEFAULT, if you want more Python flavors, set BUILD_ALL_PYTHON_FLAVORS in your make.conf" |
324 |
WARNING+= "PYTHON_DEFAULT must be a version present in PYTHON2_DEFAULT or PYTHON3_DEFAULT, if you want more Python flavors, set BUILD_ALL_PYTHON_FLAVORS in your make.conf" |
325 |
.endif |
325 |
.endif |
326 |
|
326 |
|
327 |
.if ${_PYTHON_ARGS} == "2" |
327 |
.if ${_PYTHON_ARGS} == "2" |
328 |
DEV_ERROR+= "USES=python:2 is no longer supported, use USES=python:2.7" |
328 |
DEV_ERROR+= "USES=python:2 is no longer supported, use USES=python:2.7" |
329 |
.elif ${_PYTHON_ARGS} == "3" |
329 |
.elif ${_PYTHON_ARGS} == "3" |
330 |
DEV_ERROR+= "USES=python:3 is no longer supported, use USES=python:3.5+ or an appropriate version range" |
330 |
DEV_ERROR+= "USES=python:3 is no longer supported, use USES=python:3.5+ or an appropriate version range" |
331 |
.endif # ${_PYTHON_ARGS} == "2" |
331 |
.endif # ${_PYTHON_ARGS} == "2" |
332 |
|
332 |
|
333 |
.if defined(PYTHON_VERSION) |
|
|
334 |
# A port/user requests a specific python version for its dependencies via |
335 |
# DEPENDS_ARGS, since it requires the specific python version itself. |
336 |
# Several things can happen now: |
337 |
# a) the dependency supports the requested version -> everything's fine |
338 |
# b) the dependency does not support the requested version |
339 |
# 1) the dependency works in a way that the different python |
340 |
# versions do not matter -> everything's fine |
341 |
# 2) the dependency is likely to break due to the conflict |
342 |
# nothing's fine |
343 |
# |
344 |
# b.2) needs to be resolved. Due to the complexity of how different pieces of |
345 |
# software are built, we can't solve this automatically. Instead, let's assume |
346 |
# that maintainers know what they are doing and assume PYTHON_VERSION to be a |
347 |
# hint. Just warn maintainers, if the versions do not match |
348 |
# (_PYTHON_VERSION_NONSUPPORTED). |
349 |
_PYTHON_VERSION:= ${PYTHON_VERSION:S/^python//} |
350 |
.else |
351 |
_PYTHON_VERSION:= ${PYTHON_DEFAULT} |
333 |
_PYTHON_VERSION:= ${PYTHON_DEFAULT} |
352 |
.endif # defined(PYTHON_VERSION) |
|
|
353 |
|
334 |
|
354 |
# Validate Python version whether it meets the version restriction. |
335 |
# Validate Python version whether it meets the version restriction. |
355 |
_PYTHON_VERSION_CHECK:= ${_PYTHON_ARGS:C/^([1-9]\.[0-9])$/\1-\1/} |
336 |
_PYTHON_VERSION_CHECK:= ${_PYTHON_ARGS:C/^([1-9]\.[0-9])$/\1-\1/} |
356 |
_PYTHON_VERSION_MINIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/([1-9]\.[0-9])[-+].*/\1/} |
337 |
_PYTHON_VERSION_MINIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/([1-9]\.[0-9])[-+].*/\1/} |
357 |
_PYTHON_VERSION_MINIMUM:= ${_PYTHON_VERSION_MINIMUM_TMP:M[1-9].[0-9]} |
338 |
_PYTHON_VERSION_MINIMUM:= ${_PYTHON_VERSION_MINIMUM_TMP:M[1-9].[0-9]} |
358 |
_PYTHON_VERSION_MAXIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/.*-([1-9]\.[0-9])/\1/} |
339 |
_PYTHON_VERSION_MAXIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/.*-([1-9]\.[0-9])/\1/} |
359 |
_PYTHON_VERSION_MAXIMUM:= ${_PYTHON_VERSION_MAXIMUM_TMP:M[1-9].[0-9]} |
340 |
_PYTHON_VERSION_MAXIMUM:= ${_PYTHON_VERSION_MAXIMUM_TMP:M[1-9].[0-9]} |
360 |
|
341 |
|
361 |
# At this point we should have no argument left in ${_PYTHON_ARGS} |
342 |
# At this point we should have no argument left in ${_PYTHON_ARGS} |
362 |
# except a version spec |
343 |
# except a version spec |
Lines 367-390
IGNORE= uses unknown USES=python arguments: ${_PYTHON_ARGS}
Link Here
|
367 |
|
348 |
|
368 |
.undef _PYTHON_VERSION_NONSUPPORTED |
349 |
.undef _PYTHON_VERSION_NONSUPPORTED |
369 |
.if !empty(_PYTHON_VERSION_MINIMUM) && (${_PYTHON_VERSION} < ${_PYTHON_VERSION_MINIMUM}) |
350 |
.if !empty(_PYTHON_VERSION_MINIMUM) && (${_PYTHON_VERSION} < ${_PYTHON_VERSION_MINIMUM}) |
370 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MINIMUM} at least |
351 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MINIMUM} at least |
371 |
.elif !empty(_PYTHON_VERSION_MAXIMUM) && (${_PYTHON_VERSION} > ${_PYTHON_VERSION_MAXIMUM}) |
352 |
.elif !empty(_PYTHON_VERSION_MAXIMUM) && (${_PYTHON_VERSION} > ${_PYTHON_VERSION_MAXIMUM}) |
372 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MAXIMUM} at most |
353 |
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MAXIMUM} at most |
373 |
.endif |
354 |
.endif |
374 |
|
355 |
|
375 |
# If we have an unsupported version of Python, try another. |
356 |
# If we have an unsupported version of Python, try another. |
376 |
.if defined(_PYTHON_VERSION_NONSUPPORTED) |
357 |
.if defined(_PYTHON_VERSION_NONSUPPORTED) |
377 |
.if defined(PYTHON_VERSION) || defined(PYTHON_CMD) |
|
|
378 |
_PV:= ${_PYTHON_VERSION} # preserve the specified python version |
379 |
IGNORE= needs Python ${_PYTHON_VERSION_NONSUPPORTED}, but ${_PV} was specified |
380 |
.endif # defined(PYTHON_VERSION) || defined(PYTHON_CMD) |
381 |
.undef _PYTHON_VERSION |
358 |
.undef _PYTHON_VERSION |
382 |
.for ver in ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} ${_PYTHON_VERSIONS} |
359 |
.for ver in ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} ${_PYTHON_VERSIONS} |
383 |
__VER= ${ver} |
360 |
__VER= ${ver} |
384 |
.if !defined(_PYTHON_VERSION) && \ |
361 |
.if !defined(_PYTHON_VERSION) && \ |
385 |
!(!empty(_PYTHON_VERSION_MINIMUM) && ( \ |
362 |
!(!empty(_PYTHON_VERSION_MINIMUM) && ( \ |
386 |
${__VER} < ${_PYTHON_VERSION_MINIMUM})) && \ |
363 |
${__VER} < ${_PYTHON_VERSION_MINIMUM})) && \ |
387 |
!(!empty(_PYTHON_VERSION_MAXIMUM) && ( \ |
364 |
!(!empty(_PYTHON_VERSION_MAXIMUM) && ( \ |
388 |
${__VER} > ${_PYTHON_VERSION_MAXIMUM})) |
365 |
${__VER} > ${_PYTHON_VERSION_MAXIMUM})) |
389 |
_PYTHON_VERSION= ${ver} |
366 |
_PYTHON_VERSION= ${ver} |
390 |
.endif |
367 |
.endif |
Lines 447-485
PKGNAMESUFFIX= ${PYTHON_PKGNAMESUFFIX}
Link Here
|
447 |
.endif |
424 |
.endif |
448 |
|
425 |
|
449 |
# To avoid having dependencies with @ and empty flavor: |
426 |
# To avoid having dependencies with @ and empty flavor: |
450 |
# _PYTHON_VERSION is either set by (first that matches): |
427 |
# _PYTHON_VERSION is either set by (first that matches): |
451 |
# - If using Python flavors, from the current Python flavor |
428 |
# - If using Python flavors, from the current Python flavor |
452 |
# - If using a version restriction (USES=python:3.5+), from the first |
429 |
# - If using a version restriction (USES=python:3.5+), from the first |
453 |
# acceptable default Python version. |
430 |
# acceptable default Python version. |
454 |
# - From PYTHON_DEFAULT |
431 |
# - From PYTHON_DEFAULT |
455 |
PY_FLAVOR= py${_PYTHON_VERSION:S/.//} |
432 |
PY_FLAVOR= py${_PYTHON_VERSION:S/.//} |
456 |
|
433 |
|
457 |
# Pass PYTHON_VERSION down the dependency chain. This ensures that |
434 |
PYTHON_VERSION= python${_PYTHON_VERSION} |
458 |
# port A -> B -> C all will use the same python version and do not |
|
|
459 |
# try to find a different one, if the passed version fits into |
460 |
# the supported version range. |
461 |
PYTHON_VERSION?= python${_PYTHON_VERSION} |
462 |
.if !defined(PYTHON_NO_DEPENDS) && \ |
463 |
${PYTHON_VERSION} != python${PYTHON_DEFAULT} |
464 |
DEPENDS_ARGS+= PYTHON_VERSION=${PYTHON_VERSION} |
465 |
.endif |
466 |
|
467 |
# NOTE: |
468 |
# |
469 |
# PYTHON_VERSION will hold whatever is passed down the dependency chain. |
470 |
# If a user runs `make PYTHON_VERSION=python3.5, PYTHON_VERSION will be |
471 |
# set to 'python3.5'. A port however may require a different version, |
472 |
# which is stored (above) in _PYTHON_VERSION. |
473 |
# Every python bit below hence should use python${_PYTHON_VERSION}, since |
474 |
# this is the value, the _port_ requires |
475 |
# |
476 |
|
435 |
|
477 |
# Got the correct python version, set some publicly accessible variables |
436 |
# Got the correct python version, set some publicly accessible variables |
478 |
PYTHON_VER= ${_PYTHON_VERSION} |
437 |
PYTHON_VER= ${_PYTHON_VERSION} |
479 |
PYTHON_SUFFIX= ${_PYTHON_VERSION:S/.//g} |
438 |
PYTHON_SUFFIX= ${_PYTHON_VERSION:S/.//g} |
480 |
PYTHON_MAJOR_VER= ${PYTHON_VER:R} |
439 |
PYTHON_MAJOR_VER= ${PYTHON_VER:R} |
481 |
PYTHON_REL= # empty |
440 |
PYTHON_REL= # empty |
482 |
PYTHON_ABIVER= # empty |
441 |
PYTHON_ABIVER= # empty |
483 |
PYTHON_PORTSDIR= ${_PYTHON_RELPORTDIR}${PYTHON_SUFFIX} |
442 |
PYTHON_PORTSDIR= ${_PYTHON_RELPORTDIR}${PYTHON_SUFFIX} |
484 |
# Protect partial checkouts from Mk/Scripts/functions.sh:export_ports_env(). |
443 |
# Protect partial checkouts from Mk/Scripts/functions.sh:export_ports_env(). |
485 |
.if !defined(_PORTS_ENV_CHECK) || exists(${PORTSDIR}/${PYTHON_PORTSDIR}) |
444 |
.if !defined(_PORTS_ENV_CHECK) || exists(${PORTSDIR}/${PYTHON_PORTSDIR}) |
Lines 550-570
BUILD_DEPENDS+= cython-${PYTHON_VER}:lang/cython@${PY_FLAVOR}
Link Here
|
550 |
RUN_DEPENDS+= cython-${PYTHON_VER}:lang/cython@${PY_FLAVOR} |
509 |
RUN_DEPENDS+= cython-${PYTHON_VER}:lang/cython@${PY_FLAVOR} |
551 |
.endif |
510 |
.endif |
552 |
|
511 |
|
553 |
.if defined(_PYTHON_FEATURE_CONCURRENT) |
512 |
.if defined(_PYTHON_FEATURE_CONCURRENT) |
554 |
.if !defined(_PYTHON_FEATURE_FLAVORS) && (${_PYTHON_VERSION_MINIMUM:M3*} || ${_PYTHON_VERSION_MAXIMUM:M2*}) |
513 |
.if !defined(_PYTHON_FEATURE_FLAVORS) && (${_PYTHON_VERSION_MINIMUM:M3*} || ${_PYTHON_VERSION_MAXIMUM:M2*}) |
555 |
DEV_WARNING+= "USE_PYTHON=concurrent when only one of Python 2 or 3 is supported AND not using flavors does not make any sense" |
514 |
DEV_WARNING+= "USE_PYTHON=concurrent when only one of Python 2 or 3 is supported AND not using flavors does not make any sense" |
556 |
.endif |
515 |
.endif |
557 |
_USES_POST+= uniquefiles:dirs |
516 |
_USES_POST+= uniquefiles:dirs |
558 |
.if defined(_PYTHON_FEATURE_FLAVORS) && ${FLAVOR} == ${FLAVORS:[1]} |
517 |
.if defined(_PYTHON_FEATURE_FLAVORS) && ${FLAVOR} == ${FLAVORS:[1]} |
559 |
UNIQUE_DEFAULT_LINKS= yes |
518 |
UNIQUE_DEFAULT_LINKS= yes |
560 |
.elif !defined(_PYTHON_FEATURE_FLAVORS) && ${PYTHON_VERSION} == python${PYTHON_DEFAULT} |
519 |
.elif !defined(_PYTHON_FEATURE_FLAVORS) && ${_PYTHON_VERSION} == ${PYTHON_DEFAULT} |
561 |
UNIQUE_DEFAULT_LINKS= yes |
520 |
UNIQUE_DEFAULT_LINKS= yes |
562 |
.else |
521 |
.else |
563 |
UNIQUE_DEFAULT_LINKS= no |
522 |
UNIQUE_DEFAULT_LINKS= no |
564 |
.endif |
523 |
.endif |
565 |
UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX} |
524 |
UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX} |
566 |
UNIQUE_SUFFIX= -${PYTHON_VER} |
525 |
UNIQUE_SUFFIX= -${PYTHON_VER} |
567 |
UNIQUE_SUFFIX_TYPES+= SUFFIX_MAN |
526 |
UNIQUE_SUFFIX_TYPES+= SUFFIX_MAN |
568 |
UNIQUE_SUFFIX_MAN_WITH_EXT= .[1-9ln] |
527 |
UNIQUE_SUFFIX_MAN_WITH_EXT= .[1-9ln] |
569 |
UNIQUE_SUFFIX_MAN_EXTRA_EXT= .gz |
528 |
UNIQUE_SUFFIX_MAN_EXTRA_EXT= .gz |
570 |
|
529 |
|