Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
Re: archivers/py-zstandard: improve tests
To:
OpenBSD ports <ports@openbsd.org>, "Kirill A. Korinsky" <kirill@korins.ky>
Date:
Thu, 24 Oct 2024 19:13:15 +0000

Download raw body.

Thread
24.10.2024 17:46, Stuart Henderson пишет:
> On 2024/10/20 15:32, Klemens Nanni wrote:
>>>> +
>>>> +.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
>>>
>>> Looks fine make-wise, but I lack python experience to judge the approach itself.
>>>
>>> I think you can do without double-escaping and prepending the target variable
>>> by using your own and using it fist, this way it looks a clearer;  diff below.
>>>
>>>> +
>>>> +
>>>>  # dirty way to do it with no modifications in bsd.port.mk
>>>>  .if empty(CONFIGURE_STYLE)
>>>>  .  if !target(do-build)
>>>
>>> Since that is a default-off opt-in, I'm fine committing it and tweaking in-tree.
>>>
>>> Feedback or OKs for either of the two diffs?
>>
>> None so far,  we'll land this in a bit unless there's objection.
> 
> Can I have a diff rather than a "either of two diffs" to look at
> please?

Sure, here's the same diff I sent out last time.

Index: lang/python/python.port.mk
===================================================================
RCS file: /cvs/ports/lang/python/python.port.mk,v
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	5 Oct 2024 10:16:58 -0000
@@ -303,6 +303,18 @@ MODPY_COMPILEALL = ${MODPY_BIN} -m compi
 MODPY_COMPILEALL = ${MODPY_BIN} -m compileall -j ${MAKE_JOBS} -s ${WRKINST} -o 0 -o 1
 .endif
 
+MODPY_TEST_TARGET =
+MODPY_TEST_LINK_SO ?=	No
+.if ${MODPY_TEST_LINK_SO:L} == "yes" && !empty(MODPY_TEST_LIBDIR)
+MODPY_TEST_SO_CMD = 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 +=	${MODPY_TEST_SO_CMD};
+.endif
+
 .if ${MODPY_PYBUILD:L} != no
 .  if ! ${MODPY_PYBUILD:Msetuptools_scm}
 _MODPY_PRE_BUILD_STEPS += ; if [ -e ${WRKSRC}/pyproject.toml ]; then \
@@ -317,7 +329,7 @@ MODPY_BUILD_TARGET = ${_MODPY_PRE_BUILD_
 MODPY_INSTALL_TARGET = \
 	${INSTALL_DATA_DIR} ${WRKINST}${MODPY_LIBDIR}; \
 	${_MODPY_RUNBIN} -m installer -d ${WRKINST} ${WRKSRC}/dist/*.whl
-MODPY_TEST_TARGET =	${MODPY_TEST_CMD}
+MODPY_TEST_TARGET +=	${MODPY_TEST_CMD}
 .  if ${MODPY_PYTEST:L} == "yes"
 MODPY_TEST_TARGET +=	${MODPY_PYTEST_ARGS}
 .  endif
@@ -328,7 +340,7 @@ MODPY_INSTALL_TARGET = \
 	${MODPY_CMD} ${MODPY_DISTUTILS_BUILD} ${MODPY_DISTUTILS_BUILDARGS} \
 		${MODPY_DISTUTILS_INSTALL} ${MODPY_DISTUTILS_INSTALLARGS}
 
-MODPY_TEST_TARGET =	${MODPY_TEST_CMD}
+MODPY_TEST_TARGET +=	${MODPY_TEST_CMD}
 .  if ${MODPY_PYTEST:L} == "yes"
 MODPY_TEST_TARGET +=	${MODPY_PYTEST_ARGS}
 .  elif ${MODPY_SETUPUTILS:L} == "yes"
Index: archivers/py-zstandard//Makefile
===================================================================
RCS file: /cvs/ports/archivers/py-zstandard/Makefile,v
diff -u -p -r1.2 Makefile
--- archivers/py-zstandard//Makefile	28 Aug 2024 11:49:24 -0000	1.2
+++ archivers/py-zstandard//Makefile	5 Oct 2024 09:08:46 -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 <bsd.port.mk>