Changeset View
Standalone View
Mk/Uses/python.mk
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
# PYDISTUTILS_BUILD_TARGET | # PYDISTUTILS_BUILD_TARGET | ||||
# - Pass this command to distutils on build stage. | # - Pass this command to distutils on build stage. | ||||
# default: build | # default: build | ||||
# | # | ||||
# PYDISTUTILS_INSTALL_TARGET | # PYDISTUTILS_INSTALL_TARGET | ||||
# - Pass this command to distutils on install stage. | # - Pass this command to distutils on install stage. | ||||
# default: install | # default: install | ||||
# | # | ||||
# PYDISTUTILS_TEST_TARGET | |||||
koobs: I would prefer to see this as a generic variable, overriding the default TEST_TARGET from bsd. | |||||
Not Done Inline Actions
How existing regression-test in the py-* ports survived tinderbox run then? In pointyhat.freebsd.org days such ports would be quickly flagged as BROKEN or the target would be disabled somehow. Since poudriere became the tool of choice testing automation gradually regressed. Until it catches up tests are unreliable. They can fail on some cpython versions, different freebsd releases or architectures. Only maintainer knows where or when tests are supposed to work. Otherwise, NO_TEST works fine as a tool to disable broken tests without also disabling package generation. jbeich: > Many upstream test suites break/fail from one version to the next.
How existing `regression… | |||||
Not Done Inline Actions
That will be inconsistent with other PYDISTUTILS_*_TARGETs. TEST_TARGET is intended primarily for make, so there's nothing wrong if different kind of target variables are used for pydistutils. Otoh, we may consider switching these to normal *_TARGETs.
I'd say opt-out. We want tests to run by default, and disable them only if they are useless and cannot be fixed. Every failure should be fixed this way or another, as it's either problem of software or test itself. AMDmi3: > I would prefer to see this as a generic variable, overriding the default TEST_TARGET from bsd. | |||||
# - Pass this command to distutils on test stage. | |||||
# default: test | |||||
# | |||||
# PYDISTUTILS_CONFIGUREARGS | # PYDISTUTILS_CONFIGUREARGS | ||||
# - Arguments to config with distutils. | # - Arguments to config with distutils. | ||||
# default: <empty> | # default: <empty> | ||||
# | # | ||||
# PYDISTUTILS_BUILDARGS | # PYDISTUTILS_BUILDARGS | ||||
# - Arguments to build with distutils. | # - Arguments to build with distutils. | ||||
# default: <empty> | # default: <empty> | ||||
# | # | ||||
# PYDISTUTILS_INSTALLARGS | # PYDISTUTILS_INSTALLARGS | ||||
# - Arguments to install with distutils. | # - Arguments to install with distutils. | ||||
# default: -c -O1 --prefix=${PREFIX} --single-version-externally-managed --root=${STAGEDIR} | # default: -c -O1 --prefix=${PREFIX} --single-version-externally-managed --root=${STAGEDIR} | ||||
# | # | ||||
# PYDISTUTILS_TESTARGS | |||||
# - Arguments to test with distutils. | |||||
# default: <empty> | |||||
# | |||||
# PYDISTUTILS_EGGINFO | # PYDISTUTILS_EGGINFO | ||||
# - Canonical name for egg-info. | # - Canonical name for egg-info. | ||||
# default: ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-py${PYTHON_VER}.egg-info | # default: ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-py${PYTHON_VER}.egg-info | ||||
# | # | ||||
# The following variables can be read by ports and must not be modified: | # The following variables can be read by ports and must not be modified: | ||||
# | # | ||||
# PYTHONBASE - The installation prefix of the chosen Python | # PYTHONBASE - The installation prefix of the chosen Python | ||||
# interpreter, e.g. /usr/local | # interpreter, e.g. /usr/local | ||||
▲ Show 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | |||||
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_PYTHON_POST_MK) | .if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_PYTHON_POST_MK) | ||||
_INCLUDE_USES_PYTHON_POST_MK= yes | _INCLUDE_USES_PYTHON_POST_MK= yes | ||||
# py-distutils support | # py-distutils support | ||||
PYDISTUTILS_CONFIGURE_TARGET?= config | PYDISTUTILS_CONFIGURE_TARGET?= config | ||||
PYDISTUTILS_BUILD_TARGET?= build | PYDISTUTILS_BUILD_TARGET?= build | ||||
PYDISTUTILS_INSTALL_TARGET?= install | PYDISTUTILS_INSTALL_TARGET?= install | ||||
PYDISTUTILS_TEST_TARGET?= test | |||||
.if defined(_PYTHON_FEATURE_DISTUTILS) | .if defined(_PYTHON_FEATURE_DISTUTILS) | ||||
LDSHARED?= ${CC} -shared | LDSHARED?= ${CC} -shared | ||||
MAKE_ENV+= LDSHARED="${LDSHARED}" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= | MAKE_ENV+= LDSHARED="${LDSHARED}" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= | ||||
.if !target(do-configure) && !defined(HAS_CONFIGURE) && !defined(GNU_CONFIGURE) | .if !target(do-configure) && !defined(HAS_CONFIGURE) && !defined(GNU_CONFIGURE) | ||||
do-configure: | do-configure: | ||||
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_CONFIGURE_TARGET} ${PYDISTUTILS_CONFIGUREARGS}) | @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_CONFIGURE_TARGET} ${PYDISTUTILS_CONFIGUREARGS}) | ||||
.endif | .endif | ||||
.if !target(do-build) | .if !target(do-build) | ||||
do-build: | do-build: | ||||
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) | @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) | ||||
.endif | .endif | ||||
.if !target(do-install) | .if !target(do-install) | ||||
do-install: | do-install: | ||||
@(cd ${INSTALL_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) | @(cd ${INSTALL_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) | ||||
.endif | |||||
.if !target(do-test) && !defined(TEST_TARGET) | |||||
Done Inline ActionsHow about ".if !target(do-test) && !defined(NO_PYTHON_TEST)"? I would suggest to add check for NO_PYTHON_TEST. It allows ports with USES=python to run default test (defined in bsd.port.mk) instead of python one. I did a similar one in perl5.mk. sunpoet: How about ".if !target(do-test) && !defined(NO_PYTHON_TEST)"? I would suggest to add check for… | |||||
Not Done Inline ActionsThis is not needed as we have NO_TEST. AMDmi3: This is not needed as we have NO_TEST.
NO_PERL_TEST is wrong as well, see mail. | |||||
Not Done Inline ActionsNo, they are different. IIUC NO_TEST is used to bypass test framework entirely. A port requires perl would add USES=perl5 but it does not mean that it wants to run perl tests. Since we do not support multiple tests currently, we need to check NO_PERL5_TEST in order to skip do-test: from perl5.mk but run the do-test: from bsd.port.mk or other Uses/*.mk (e.g. USES=python). Please try ftp/curl with/without NO_PERL5_TEST. BTW, I think Jan's idea is much better. Checking TEST_TARGET should have same effect but avoids new knob like NO_foo_TEST. sunpoet: No, they are different. IIUC NO_TEST is used to bypass test framework entirely. A port requires… | |||||
Not Done Inline Actions
https://reviews.freebsd.org/D3830
No. It won't work e.g. with perl5 as perl5 tests require TEST_TARGET, and here it's basically the same thing, but python duplicates *_TARGET by PYDISTUTILS_*_TARGET. Which feels wrong by itself. AMDmi3: > Please try ftp/curl with/without NO_PERL5_TEST.
https://reviews.freebsd.org/D3830
> BTW, I… | |||||
do-test: | |||||
@(cd ${TEST_WRKSRC}; ${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_TEST_TARGET} ${PYDISTUTILS_TESTARGS}) | |||||
Not Done Inline ActionsPYDISTUTILS_TESTARGS is undefined. Why not use TEST_ARGS? sunpoet: PYDISTUTILS_TESTARGS is undefined. Why not use TEST_ARGS? | |||||
koobsUnsubmitted Not Done Inline ActionsAs per original diff comment, I would much prefer to use TEST_* variables in python.mk and python ports. These test framework bits ought to have nothing to do (and dont) with distutils/setuptools. The setuptools test command is just one possible invocation command. This allows us to use the plethora of python testing frameworks, with granularity in setting/overriding defaults from bsd.port.mk and python.mk if necessary. For example:
Thus, I'd like to see, in Python ports, and all ports more generally that support test suites, use something like: TEST_ENV TEST_CMD TEST_TARGET TEST_ARGS If the defaults (make test, python setup.py test, perl whatever) don't happen to just work for any package, it's then trivial to override the appropriate variable(s) for that port, while staying entirely faithful to a generic test framework. koobs: As per original diff comment, I would much prefer to use TEST_* variables in python.mk and… | |||||
Not Done Inline ActionsAs I've noted, I don't really like TEST_CMD.
Trying to sticking everything into "TEST_ENV TEST_CMD TEST_TARGET TEST_ARGS" or similar pattern will lead to ugliness like TEST_CMD=${python_CMD} TEST_TARGET=./run_tests TEST_ARGS= which is both longer and less readable than a custom do-test. AMDmi3: As I've noted, I don't really like TEST_CMD.
- If you need custom command to run tests, you… | |||||
Not Done Inline Actions
DO_MAKE_TEST already can do something DO_MAKE_TEST= nosetests TEST_TARGET= # empty DO_MAKE_TEST= tox TEST_TARGET= # empty DO_MAKE_TEST= py.test TEST_TARGET= # empty DO_MAKE_TEST= ${PYTHON_CMD} -m unittest discover TEST_TARGET= # empty DO_MAKE_TEST= ${MAKE_CMD} test # with USE_PYTHON=distutils TEST_TARGET= # empty Most of default ${MAKE_ENV} is garbage at runtime, anyway. jbeich: > Trying to sticking everything into "TEST_ENV TEST_CMD TEST_TARGET TEST_ARGS" or similar… | |||||
.endif | .endif | ||||
add-plist-post: add-plist-egginfo | add-plist-post: add-plist-egginfo | ||||
.endif # defined(_PYTHON_FEATURE_DISTUTILS) | .endif # defined(_PYTHON_FEATURE_DISTUTILS) | ||||
.endif # defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_PYTHON_POST_MK) | .endif # defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_PYTHON_POST_MK) |
I would prefer to see this as a generic variable, overriding the default TEST_TARGET from bsd.port.mk.
The canonical 'test' target is a setuptools target, so naming it 'distutils' is technically incorrect.
Also, my gut feeling tells me we want to explicitly opt-in/enable tests, indepently to whether other TEST_* variables are set. Many upstream test suites break/fail from one version to the next.