On Mon, Nov 21, 2011 at 08:24:52PM +0100, Remi Pointel wrote:
> 
> Hi, I have worked on the diff.
> 
> Differences with last diff I sent are:
> - use PY3 instead of IS_PY3
> - PY3 could be:
> * both if it works with python 2 and python 3 (instead of yes)

I'm ok with the diff, but I find the following a bit weird:
PY3=    both
To me that means the ports would be able to use 2 versions of python *3*.
I'd rather have:
PY3=    yes # if it works also with python3 (i.e. the port can be build with 
python2 and python3)
PY3=    only # if it can only work with python3

or something else (I suck at setting var names), but I find 'PY3=both' odd and 
confusing.


> * only if it works only with python 3
> - modify FLAVORS, it was not correct
> 
> I run a build (amd64) on all ports which have python for modules and it works 
> fine.
> 
> Are you ok with this diff?
> 
> Cheers,
> 
> -- 
> Remi

> Index: python.port.mk
> ===================================================================
> RCS file: /cvs/ports/lang/python/python.port.mk,v
> retrieving revision 1.47
> diff -u -p -r1.47 python.port.mk
> --- python.port.mk    17 Oct 2011 13:55:24 -0000      1.47
> +++ python.port.mk    21 Nov 2011 19:16:27 -0000
> @@ -7,23 +7,67 @@ SHARED_ONLY=                Yes
>  
>  CATEGORIES+=         lang/python
>  
> -MODPY_VERSION?=              2.7
> +# define the default version
> +_MODPY_DEFAULT_VERSION = 2.7
>  
> -.if ${MODPY_VERSION} == "2.4" || ${MODPY_VERSION} == "2.5" || 
> ${MODPY_VERSION} == "2.7" || ${MODPY_VERSION} == "3.2"
> -
> -.  if ${MODPY_VERSION} < 2.6
> -MODPY_JSON =         devel/py-simplejson
> -.  else
> -MODPY_JSON =
> +.if !defined(MODPY_VERSION)
> +.  if defined(PY3)
> +.    if ${PY3:L:Mboth}
> +FLAVORS+=    python3
> +# force to use python3 if ports is python3 only
> +.    elif ${PY3:L:Monly}
> +FLAVORS+=    python3
> +FLAVOR+=     python3
> +.    else
> +ERRORS += "Fatal: please verify PY3 is correctly defined: \n\
> +     - set to both if your port can be build with python2 and python3 \n\
> +     - set to only if your port can be build only with python3 \n"
> +.    endif
>  .  endif
>  
> -.  if ${MODPY_VERSION} < 3.2
> -MODPY_WANTLIB =      python${MODPY_VERSION}
> +FLAVOR?=
> +
> +# try do detect if the port has other FLAVORS than just python3
> +.  if ${FLAVOR:L:Mpython3}
> +# define default version 3
> +MODPY_VERSION?=              3.2
>  .  else
> -MODPY_WANTLIB = python${MODPY_VERSION}m
> +# without flavor, assume we use the default version
> +MODPY_VERSION?=              ${_MODPY_DEFAULT_VERSION}
>  .  endif
> +
> +# verify if MODPY_VERSION forced is correct
>  .else
> +.  if ${MODPY_VERSION} != "2.4" && \
> +      ${MODPY_VERSION} != "2.5" && \
> +      ${MODPY_VERSION} != "2.7" && \
> +      ${MODPY_VERSION} != "3.2"
>  ERRORS += "Fatal: unknown or unsupported MODPY_VERSION: ${MODPY_VERSION}"
> +.  endif
> +.endif
> +
> +_MODPY_MAJOR_VERSION =       ${MODPY_VERSION:C/\.[1-9]*//g}
> +
> +.if ${_MODPY_MAJOR_VERSION} == 2
> +MODPY_LIB_SUFFIX =
> +MODPY_FLAVOR =
> +MODPY_BIN_SUFFIX =
> +
> +.elif ${_MODPY_MAJOR_VERSION} == 3
> +MODPY_LIB_SUFFIX =   m
> +# replace py- prefix by py3-
> +FULLPKGNAME =        ${PKGNAME:S/^py-/py3-/}
> +MODPY_FLAVOR =       ,python3
> +# add the modpy_version without the '.' to the binaries to avoid conflict
> +MODPY_BIN_SUFFIX =   ${_MODPY_MAJOR_VERSION}
> +.endif
> +
> +MODPY_WANTLIB = python${MODPY_VERSION}${MODPY_LIB_SUFFIX}
> +
> +.if ${MODPY_VERSION} < 2.6
> +MODPY_JSON =         devel/py-simplejson
> +.else
> +MODPY_JSON =
>  .endif
>  
>  MODPY_RUN_DEPENDS=   lang/python/${MODPY_VERSION}
> @@ -41,15 +85,17 @@ RUN_DEPENDS+=             ${MODPY_RUN_DEPENDS}
>  .endif
>  
>  MODPY_PRE_BUILD_STEPS = @:
> -.if (defined(MODPY_SETUPTOOLS) && ${MODPY_SETUPTOOLS:U} == YES) || \
> -    (defined(MODPY_DISTRIBUTE) && ${MODPY_DISTRIBUTE:U} == YES)
> +.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
> -.if ${MODPY_SETUPTOOLS:U} == YES
> +.  if ${_MODPY_MAJOR_VERSION} == 2
>  MODPY_SETUPUTILS_DEPEND?=devel/py-setuptools
> -.else
> -MODPY_SETUPUTILS_DEPEND ?= devel/py3-distribute
> -.endif
> +.  elif ${_MODPY_MAJOR_VERSION} == 3
> +MODPY_SETUPUTILS_DEPEND?=devel/py-distribute,python3
> +.  else
> +ERRORS += "Fatal: unknown or unsupported _MODPY_MAJOR_VERSION: 
> ${_MODPY_MAJOR_VERSION}"
> +.  endif
> +
>  MODPY_RUN_DEPENDS+=  ${MODPY_SETUPUTILS_DEPEND}
>  BUILD_DEPENDS+=              ${MODPY_SETUPUTILS_DEPEND}
>  MODPY_SETUPUTILS =   Yes
> @@ -65,8 +111,7 @@ MODPY_PRE_BUILD_STEPS +=   \
>       ;mkdir -p ${_MODPY_SETUPUTILS_FAKE_DIR} \
>       ;exec >${_MODPY_SETUPUTILS_FAKE_DIR}/__init__.py \
>       ;echo 'def setup(*args, **kwargs):' \
> -     ;echo '    msg = "OpenBSD ports: MODPY_SETUPTOOLS = Yes or\\n" \' \
> -     ;echo '          "\\t\\t\\t  MODPY_DISTRIBUTE = Yes required"' \
> +     ;echo '    msg = "OpenBSD ports: MODPY_SETUPTOOLS = Yes is required"' \
>       ;echo '    raise Exception(msg)' \
>       ;echo 'Extension = Feature = find_packages = setup'
>  MODPY_SETUPUTILS =   No
> @@ -110,7 +155,7 @@ CONFIGURE_ENV+=   PYTHON="${MODPY_BIN}"
>  _MODPY_CMD=  @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
>                       ${MODPY_BIN} ./${MODPY_SETUP}
>  
> -SUBST_VARS:= MODPY_BIN MODPY_EGG_VERSION MODPY_VERSION ${SUBST_VARS}
> +SUBST_VARS:= MODPY_BIN MODPY_BIN_SUFFIX MODPY_EGG_VERSION MODPY_VERSION 
> ${SUBST_VARS}
>  
>  # set MODPY_BIN for executable scripts
>  MODPY_BIN_ADJ=       perl -pi \


-- 
Antoine

Reply via email to