From: Kirill A. Korinsky Subject: Re: archivers/py-zstandard: improve tests To: OpenBSD ports , Klemens Nanni Date: Mon, 23 Sep 2024 17:43:33 +0200 On Tue, 03 Sep 2024 18:31:56 +0200, Kirill A. Korinsky wrote: > > I had dig into archivers/py-zstandard (a couple moths ago) and if I recall > right the cause of issue was inside zstandard/__init__.py it uses: > > from .backend_c import * > > which is a root cause for this issue because . means check the current > package, and don't use PYTHONPATH if I recall right. > Here a cleaner approach which can be reused on different places. I have no idea about good namig for variable, any suggestion? 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 15:41:21 -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_RELEATIVE_IMPORT_CFFI = 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 15:41:21 -0000 @@ -124,6 +124,8 @@ RUN_DEPENDS += ${MODPY_RUN_DEPENDS} TEST_DEPENDS += ${MODPY_TEST_DEPENDS} .endif +MODPY_RELEATIVE_IMPORT_CFFI ?= No + _MODPY_PRE_BUILD_STEPS = : .if ${MODPY_PYBUILD:L} == "no" @@ -356,6 +358,12 @@ do-install: . if !target(do-test) && \ (${MODPY_SETUPUTILS:L} == "yes" || ${MODPY_PYTEST:L} == "yes") do-test: +. if ${MODPY_RELEATIVE_IMPORT_CFFI:L} == "yes" + cd ${WRKSRC}/build/lib.openbsd-${OSREV}-${ARCH}-cpython-${MODPY_MAJORMINOR} && \ + find . \ + -name '*.so' -type f \ + -exec ln -sf ${WRKSRC}/build/lib.openbsd-${OSREV}-${ARCH}-cpython-${MODPY_MAJORMINOR}/{} ${WRKSRC}/{} \; +. endif @${MODPY_TEST_TARGET} . endif -- wbr, Kirill