From: Kirill A. Korinsky Subject: Re: archivers/py-zstandard: improve tests To: OpenBSD ports , Klemens Nanni Date: Mon, 23 Sep 2024 20:10:02 +0200 On Mon, 23 Sep 2024 18:08:46 +0200, Stuart Henderson wrote: > > IIRC the build/lib.openbsd-${OSREV}-... format is just for setuptools, > so it may be better to define a new variable containing the directory > name and set it as appropriate for each MODPY_PYBUILD backend. > (They don't need to be done all at once, just error out if someone > tries to use the new option and the dir isn't set - I can help with > looking for other ports which could use this later, but too busy right > now). > Thanks for review and help to track ports which needed. Here is much cleaner approach which I really like. I've tried: . for _dir in ${MODPY_TEST_LIBDIR:S,:, ,g} MODPY_TEST_TARGET := if [ -e ${_dir} ]; then \ cd ${_dir} && \ find . -name '*.so' -type f \ -exec ln -sf ${_dir}/{} ${WRKSRC}/{} \; \ ; fi; ${MODPY_TEST_TARGET} . endfor but it doesn't expand as I expected, so, here a bit different approach: Index: archivers/py-zstandard/Makefile =================================================================== RCS file: /cvs/ports/archivers/py-zstandard/Makefile,v retrieving revision 1.2 diff -u -p -r1.2 Makefile --- archivers/py-zstandard/Makefile 28 Aug 2024 11:49:24 -0000 1.2 +++ archivers/py-zstandard/Makefile 23 Sep 2024 17:39:58 -0000 @@ -17,11 +17,6 @@ BUILD_DEPENDS = devel/py-cffi${MODPY_FL FLAVORS = python3 FLAVOR = python3 -MODPY_PYTEST_ARGS = tests/ -MODPY_TEST_DIR = ${WRKDIR} - -pre-test: - @rm -rf ${WRKDIR}/tests - @cp -r ${WRKSRC}/tests ${WRKDIR}/ +MODPY_TEST_LINK_SO = Yes .include Index: lang/python/python.port.mk =================================================================== RCS file: /cvs/ports/lang/python/python.port.mk,v retrieving revision 1.192 diff -u -p -r1.192 python.port.mk --- lang/python/python.port.mk 25 Jul 2024 15:42:03 -0000 1.192 +++ lang/python/python.port.mk 23 Sep 2024 17:39:58 -0000 @@ -336,6 +336,18 @@ MODPY_TEST_TARGET += ${TEST_TARGET} . endif .endif +MODPY_TEST_LINK_SO ?= No + +.if ${MODPY_TEST_LINK_SO:L} == "yes" && !empty(MODPY_TEST_LIBDIR) +MODPY_TEST_TARGET := for _dir in ${MODPY_TEST_LIBDIR:S,:, ,g}; do \ + if [ -e $$$${_dir} ]; then \ + cd $$$${_dir} && \ + find . -name '*.so' -type f \ + -exec ln -sf $$$${_dir}/{} ${WRKSRC}/{} \; ;\ + fi; done; ${MODPY_TEST_TARGET} +.endif + + # dirty way to do it with no modifications in bsd.port.mk .if empty(CONFIGURE_STYLE) . if !target(do-build) -- wbr, Kirill