aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses
diff options
context:
space:
mode:
authorkoobs <koobs@FreeBSD.org>2016-01-02 23:24:37 +0800
committerkoobs <koobs@FreeBSD.org>2016-01-02 23:24:37 +0800
commit67ca9366d7dd2d8227e7edc7376ab3a92dac03d8 (patch)
treeffe6684d2e23a0b97fc308195d7bf2577f47ae15 /Mk/Uses
parent27dc717cc0fad1f848261bfe7cc62b89e4c27c82 (diff)
downloadfreebsd-ports-graphics-67ca9366d7dd2d8227e7edc7376ab3a92dac03d8.tar.gz
freebsd-ports-graphics-67ca9366d7dd2d8227e7edc7376ab3a92dac03d8.tar.zst
freebsd-ports-graphics-67ca9366d7dd2d8227e7edc7376ab3a92dac03d8.zip
Mk/Uses/python.mk: Add support for optional 'test' argument
Some ports may need to use Python for their testing suite but otherwise do not need it at all (ie, not for build or run). This patch adds support for the test argument to be used in the USES clause, such as python:3.2+,test. This enables the relevant Python environment and modifies TEST_DEPENDS as necessary. For non-Python ports that use Python as their testing suite, add python:<ver>,test as required to the USES clause. PR: 205616 Submitted by: Brendan Molloy <brendan+freebsd bbqsrc net> Reviewed by: mat, miwi, koobs, antoine Approved by: koobs (python) Differential Revision: https://reviews.freebsd.org/D4711
Diffstat (limited to 'Mk/Uses')
-rw-r--r--Mk/Uses/python.mk29
1 files changed, 22 insertions, 7 deletions
diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index a5ebce00c0f..d47978f053a 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -6,7 +6,7 @@
#
# Feature: python
# Usage: USES=python or USES=python:args
-# Valid ARGS: <version>, build, run
+# Valid ARGS: <version>, build, run, test
#
# version If your port requires only some set of Python versions, you
# can set this to [min]-[max] or min+ or -max or as an
@@ -23,12 +23,15 @@
# # version
#
# build Indicates that Python is needed at build time and adds
-# it as BUILD_DEPENDS.
+# it to BUILD_DEPENDS.
# run Indicates that Python is needed at run time and adds
-# it as RUN_DEPENDS.
+# it to RUN_DEPENDS.
+# test Indicates that Python is needed at test time and adds
+# it to TEST_DEPENDS.
#
-# If build and run are omitted, Python will be added as BUILD_DEPENDS and
-# RUN_DEPENDS. PYTHON_NO_DEPENDS can be set to not add any dependencies.
+# If build, run and test are omitted, Python will be added as BUILD_DEPENDS,
+# RUN_DEPENDS and TEST_DEPENDS. PYTHON_NO_DEPENDS can be set to not add any
+# dependencies.
#
# Variables, which can be set by a user:
#
@@ -231,6 +234,7 @@ _PYTHON_FEATURE_${var:tu}= yes
# pollutes the build/run dependency detection
.undef _PYTHON_BUILD_DEP
.undef _PYTHON_RUN_DEP
+.undef _PYTHON_TEST_DEP
_PYTHON_ARGS= ${python_ARGS:S/,/ /g}
.if ${_PYTHON_ARGS:Mbuild}
_PYTHON_BUILD_DEP= yes
@@ -240,13 +244,18 @@ _PYTHON_ARGS:= ${_PYTHON_ARGS:Nbuild}
_PYTHON_RUN_DEP= yes
_PYTHON_ARGS:= ${_PYTHON_ARGS:Nrun}
.endif
+.if ${_PYTHON_ARGS:Mtest}
+_PYTHON_TEST_DEP= yes
+_PYTHON_ARGS:= ${_PYTHON_ARGS:Ntest}
+.endif
-# The port does not specify a build or run dependency, assume both are
+# The port does not specify a build, run or test dependency, assume all are
# required.
.if !defined(_PYTHON_BUILD_DEP) && !defined(_PYTHON_RUN_DEP) && \
- !defined(PYTHON_NO_DEPENDS)
+ !defined(_PYTHON_TEST_DEP) && !defined(PYTHON_NO_DEPENDS)
_PYTHON_BUILD_DEP= yes
_PYTHON_RUN_DEP= yes
+_PYTHON_TEST_DEP= yes
.endif
# Determine version number of Python to use
@@ -561,6 +570,12 @@ RUN_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR}
RUN_DEPENDS+= python${_WANTS_META_PORT}:${_PYTHON_RELPORTDIR}${_WANTS_META_PORT}
.endif
.endif
+.if defined(_PYTHON_TEST_DEP)
+TEST_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR}
+.if defined(_WANTS_META_PORT)
+TEST_DEPENDS+= python${_WANTS_META_PORT}:${_PYTHON_RELPORTDIR}${_WANTS_META_PORT}
+.endif
+.endif
# set $PREFIX as Python's one
.if defined(_PYTHON_FEATURE_PYTHONPREFIX)