On Wed, Sep 15, 2010 at 10:18:01AM +0100, Federico G. Schwindt wrote:
> Hi,
> 
>   New day new diff. Move things to WRKDIR to avoid warnings during plist
> generation reported by r...@.
>   While I was here also change how bad eggs are handled to avoid warnings
> and to allow make clean to run as a regular user. Tested with py-urwid,
> py-cheetah and py-distutils-extra.
>   Comments? OK to individual pieces or the whole welcome.

I am not fiercely opposed to these changes, but 2 comments though:

About the MODPY_JSON thing. Shouldn't it be handled per-port where
needed?  I am not quite sure what is the point of trying to add a
pseudo-"backward compatibility" hack in the infrastructure, when we
now moved to 2.6 anyway. Especially for something like json, which
sounds very anecdotal.

About the egg thing (I hate them, I am disgusted at the farce python
has turned into wrt to packaging).  How about simply adding setuptools
unconditionnally as a BUILD_DEPENDS for all python modules? Would that
really hurt?


Eric.

>   f.-
> 
> Index: python.port.mk
> ===================================================================
> RCS file: /cvs/ports/lang/python/python.port.mk,v
> retrieving revision 1.36
> diff -u -r1.36 python.port.mk
> --- python.port.mk    30 Aug 2010 16:35:02 -0000      1.36
> +++ python.port.mk    15 Sep 2010 09:10:44 -0000
> @@ -17,6 +17,12 @@
>  .endif
>  MODPYSPEC = python-${MODPY_VSPEC}
>  
> +.if ${MODPY_VERSION} < 2.6
> +MODPY_JSON =         ::devel/py-simplejson
> +.else
> +MODPY_JSON =
> +.endif
> +
>  MODPY_RUN_DEPENDS=   :${MODPYSPEC}:lang/python/${MODPY_VERSION}
>  MODPY_LIB_DEPENDS=   
> python${MODPY_VERSION}:${MODPYSPEC}:lang/python/${MODPY_VERSION}
>  _MODPY_BUILD_DEPENDS=        :${MODPYSPEC}:lang/python/${MODPY_VERSION}
> @@ -31,6 +37,7 @@
>  RUN_DEPENDS+=                ${MODPY_RUN_DEPENDS}
>  .endif
>  
> +MODPY_PRE_BUILD_STEPS = @:
>  .if defined(MODPY_SETUPTOOLS) && ${MODPY_SETUPTOOLS:U} == YES
>  # The setuptools module provides a package locator (site.py) that is
>  # required at runtime for the pkg_resources stuff to work
> @@ -39,6 +46,20 @@
>  BUILD_DEPENDS+=              ${MODPY_SETUPUTILS_DEPEND}
>  # The setuptools uses test target
>  REGRESS_TARGET?=     test
> +_MODPY_USERBASE =
> +.else
> +# Try to detect the case where a port will build regardless of setuptools
> +# but the final plist will be different if it's present.
> +_MODPY_SETUPTOOLS_FAKE_DIR = \
> +     ${WRKDIR}/lib/python${MODPY_VERSION}/site-packages/setuptools
> +MODPY_PRE_BUILD_STEPS +=     \
> +     ;mkdir -p ${_MODPY_SETUPTOOLS_FAKE_DIR} \
> +     ;exec >${_MODPY_SETUPTOOLS_FAKE_DIR}/__init__.py \
> +     ;echo 'def setup(*args, **kwargs):' \
> +     ;echo '    msg = "OpenBSD ports: MODPY_SETUPTOOLS = Yes is required"' \
> +     ;echo '    raise Exception(msg)' \
> +     ;echo 'Extension = Feature = find_packages = setup'
> +_MODPY_USERBASE =    ${WRKDIR}
>  .endif
>  
>  .if !defined(NO_SHARED_LIBS) || ${NO_SHARED_LIBS:U} != YES
> @@ -50,12 +71,9 @@
>  MODPY_LIBDIR=                ${LOCALBASE}/lib/python${MODPY_VERSION}
>  MODPY_SITEPKG=               ${MODPY_LIBDIR}/site-packages
>  
> -MODPY_POST_BUILD_BAD_EGGS = @:
> -MODPY_PRE_INSTALL_BAD_EGGS = @:
>  .if defined(MODPY_BADEGGS)
>  .  for egg in ${MODPY_BADEGGS}
> -MODPY_POST_BUILD_BAD_EGGS += ;ln -sf ${WRKINST}/${egg}.egg-info 
> ${WRKBUILD}/${egg}.egg-info
> -MODPY_PRE_INSTALL_BAD_EGGS += ;mkdir -p ${WRKINST}/${egg}.egg-info
> +MODPY_PRE_BUILD_STEPS += ;mkdir -p ${WRKBUILD}/${egg}.egg-info
>  .  endfor
>  .endif
>  
> @@ -75,7 +93,7 @@
>                               --root=${DESTDIR}
>  .endif
>  
> -MAKE_ENV+=   CC=${CC}
> +MAKE_ENV+=   CC=${CC} PYTHONUSERBASE=${_MODPY_USERBASE}
>  CONFIGURE_ENV+=      PYTHON="${MODPY_BIN}"
>  
>  _MODPY_CMD=  @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
> @@ -87,14 +105,13 @@
>  .if empty(CONFIGURE_STYLE)
>  .  if !target(do-build)
>  do-build:
> +     ${MODPY_PRE_BUILD_STEPS}
>       ${_MODPY_CMD} ${MODPY_DISTUTILS_BUILD} ${MODPY_DISTUTILS_BUILDARGS}
> -     ${MODPY_POST_BUILD_BAD_EGGS}
>  .  endif
>  
>  # extra documentation or scripts should be installed via post-install
>  .  if !target(do-install)
>  do-install:
> -     ${MODPY_PRE_INSTALL_BAD_EGGS}
>       ${_MODPY_CMD} ${MODPY_DISTUTILS_BUILD} ${MODPY_DISTUTILS_BUILDARGS} \
>               ${MODPY_DISTUTILS_INSTALL} ${MODPY_DISTUTILS_INSTALLARGS}
>  .  endif

Reply via email to