tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: how to use different distfiles for py2 and py3?



On Wed, Jan 15, 2014 at 07:24:47PM +0100, Thomas Klausner wrote:
> Reading the make man page again, I found this can be done much simpler.

Now includes help, and has a hopefully better name.
 Thomas
# $NetBSD$
#
# This file determines which separate distribution of a Python
# package is used as dependency, depending on the Python version
# used.
#
# === User-settable variables ===
#
# PYTHON_VERSIONED_DEPENDENCIES
#       The Python package which should be added as a dependency.
#
#       Possible values: cairo dateutil
#       Default: (nothing)
#

.include "../../lang/python/pyversion.mk"

_SUPPORTED_PACKAGES=# empty
_SUPPORTED_PACKAGES+=cairo graphics/py-cairo graphics/py-cairo3
_SUPPORTED_PACKAGES+=dateutil time/py-dateutil time/py-dateutil2

.for pkg in ${PYTHON_VERSIONED_DEPENDENCIES}
_PKG_MATCHED=   no
.for name py2dir py3dir in ${_SUPPORTED_PACKAGES}
.if ${pkg} == ${name}
_PKG_MATCHED=   yes
.if ${PYPKGPREFIX} == "py26" || ${PYPKGPREFIX} == "py27"
DEPENDS+=       ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${py2dir}
.else
DEPENDS+=       ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${py3dir}
.endif
.endif
.endfor
.if ${_PKG_MATCHED} == "no"
PKG_FAIL_REASON=        "${pkg} unsupported in PYTHON_PACKAGE_AUTOSWITCH"
.endif
.endfor


Home | Main Index | Thread Index | Old Index