On Sun, Mar 17, 2019 at 04:22:51PM -0400, Kurt Mosiejczuk wrote:
> On Sun, Mar 17, 2019 at 02:10:47PM -0400, Kurt Mosiejczuk wrote:
> 
> > Here are diffs for python.port.mk and port-modules.5.
> 
> > I changed Remi's diff a bit. With the discussion about C.UTF-8 being
> > an alias for en_US.UTF-8, I changed the default locale we add to that.
> > Additionally, I changed it so it is MODPY_TEST_LOCALE (that defaults to
> > en_US.UTF-8) that gets added to TEST_ENV.
> 
> > Similar to MODPY_SETUPTOOLS, I have MODPY_PYTEST adding devel/py-test
> > to TEST_DEPENDS. I added code to do that and added a MODPY_TEST_DEPENDS
> > that is similar to MODPY_*_DEPENDS that will keep us from adding
> > anything to TEST_DEPENDS if it is set to No.
> 

I think adding devel/py-test to TEST_DEPENDS is useful.

Some comments below.

> > I added all these new environment variables to port-modules.5, which is
> > the second diff included here.
> 
> Here is a fixed diff for python.port.mk
> 
> I need to not make tweaks after tests.
> 
> --Kurt
> 
> Index: python.port.mk
> ===================================================================
> RCS file: /cvs/ports/lang/python/python.port.mk,v
> retrieving revision 1.100
> diff -u -p -r1.100 python.port.mk
> --- python.port.mk    4 Dec 2018 05:57:31 -0000       1.100
> +++ python.port.mk    17 Mar 2019 20:21:45 -0000
> @@ -68,6 +68,9 @@ MODPY_WANTLIB = python${MODPY_VERSION}${
>  MODPY_RUN_DEPENDS =  lang/python/${MODPY_VERSION}
>  MODPY_LIB_DEPENDS =  lang/python/${MODPY_VERSION}
>  _MODPY_BUILD_DEPENDS =       lang/python/${MODPY_VERSION}
> +.if defined(MODPY_TEST) && ${MODPY_PYTEST:L} == "yes"

Should this be "defined(MODPY_*PY*TEST)"? Why not move "MODPY_PYTEST ?= no"
up and get rid of the "defined" test?

> +MODPY_TEST_DEPENDS = devel/py-test

Does this also work for python3 ports? I think you need to append
${MODPY_FLAVOR}.

> +.endif
>  
>  .if ${NO_BUILD:L} == "no"
>  MODPY_BUILDDEP ?=    Yes
> @@ -75,6 +78,7 @@ MODPY_BUILDDEP ?=   Yes
>  MODPY_BUILDDEP ?=    No
>  .endif
>  MODPY_RUNDEP ?=              Yes
> +MODPY_TESTDEP ?=     Yes
>  
>  .if ${MODPY_BUILDDEP:L} == "yes"
>  BUILD_DEPENDS +=     ${_MODPY_BUILD_DEPENDS}
> @@ -84,6 +88,10 @@ BUILD_DEPENDS +=   ${_MODPY_BUILD_DEPENDS}
>  RUN_DEPENDS +=               ${MODPY_RUN_DEPENDS}
>  .endif
>  
> +.if ${MODPY_TESTDEP:L} == "yes'
> +TEST_DEPENDS +=              ${MODPY_TEST_DEPENDS}
> +.endif
> +
>  _MODPY_PRE_BUILD_STEPS = :
>  .if defined(MODPY_SETUPTOOLS) && ${MODPY_SETUPTOOLS:L} == "yes"
>  # The setuptools module provides a package locator (site.py) that is
> @@ -159,6 +167,13 @@ MODPY_TEST_CMD = cd ${WRKSRC} && ${SETEN
>                       ${MODPY_BIN} ./${MODPY_SETUP} \
>                       ${MODPY_SETUP_ARGS}
>  
> +MODPY_PYTEST_CMD = cd ${WRKSRC} && ${SETENV} ${ALL_TEST_ENV} \
> +                     ${MODPY_BIN} -m pytest
> +
> +MODPY_TEST_LOCALE ?= LC_CTYPE=en_US.UTF-8
> +
> +TEST_ENV +=          ${MODPY_TEST_LOCALE}
> +
>  SUBST_VARS :=        MODPY_PYCACHE MODPY_COMMENT MODPY_ABI3SO 
> MODPY_PYC_MAGIC_TAG \
>               MODPY_BIN MODPY_EGG_VERSION MODPY_VERSION MODPY_BIN_SUFFIX \
>               MODPY_PY_PREFIX MODPY_PYOEXTENSION ${SUBST_VARS}
> @@ -184,6 +199,8 @@ MODPY_INSTALL_TARGET = \
>               ${MODPY_DISTUTILS_INSTALL} ${MODPY_DISTUTILS_INSTALLARGS}
>  MODPY_TEST_TARGET = \
>       ${MODPY_TEST_CMD} ${TEST_TARGET}
> +MODPY_PYTEST ?=      no
> +MODPY_PYTEST_ARGS ?=
>  
>  # dirty way to do it with no modifications in bsd.port.mk
>  .if empty(CONFIGURE_STYLE)
> @@ -198,8 +215,11 @@ do-install:
>       @${MODPY_INSTALL_TARGET}
>  .  endif
>  
> +.  if !target(do-test) && ${MODPY_PYTEST:L} == "yes"
> +do-test:
> +     ${MODPY_PYTEST_CMD} ${MODPY_PYTEST_ARGS}
>  # setuptools supports regress testing from setup.py using a standard target
> -.  if !target(do-test) && ${MODPY_SETUPUTILS:L} == "yes"
> +.  elif !target(do-test) && ${MODPY_SETUPUTILS:L} == "yes"
>  do-test:
>       @${MODPY_TEST_TARGET}
>  .  endif
> 

Reply via email to