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:12:32PM +0100, Thomas Klausner wrote:
> In a package, set
> PYTHON_PACKAGE_AUTOSWITCH=dateutil
> and include
> .include "../../lang/python/package_autoswitch.mk"
> (better names welcome)

Reading the make man page again, I found this can be done much simpler.
 Thomas
# $NetBSD$

.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_PACKAGE_AUTOSWITCH}
_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