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 Tue, Jan 14, 2014 at 08:07:03PM +0100, Thomas Klausner wrote:
> On Mon, Jan 13, 2014 at 12:00:45PM +0900, OBATA Akio wrote:
> > How about following?
> >  time/py2-dateutil -> current one (v1.5)
> >  time/py3-dateutil -> upcomming one (v2.0)
> > 
> > then time/py-dateutil/Makefile include time/py?-dateutil/Makefile 
> > conditionally.
> 
> I think until we have more packages with this issue, I prefer this
> solution to Greg's. Any opposition?

While implementing it, I found out that I don't really know how to do
it obache's way, but I do know how to do it Greg's way, so here's what
I came up with.

Put the attachment in lang/python. Then use it as follows:

In a package, set
PYTHON_PACKAGE_AUTOSWITCH=dateutil
and include
.include "../../lang/python/package_autoswitch.mk"
(better names welcome)

Comments?
 Thomas
# $NetBSD$

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

SUPPORTED_PACKAGES=dateutil:time/py-dateutil:time/py-dateutil2

.for pkg in ${PYTHON_PACKAGE_AUTOSWITCH}
_PKG_MATCHED=   no
.for supported_pkgs in ${SUPPORTED_PACKAGES}
_PKG_NAME:=${supported_pkgs:C/:.*//}
_PKG_PY2:=${supported_pkgs:C/[^:]*://:C/:[^:]*//}
_PKG_PY3:=${supported_pkgs:C/.*://}
.if ${pkg} == ${_PKG_NAME}
_PKG_MATCHED=   yes
.if ${PYPKGPREFIX} == "py26" || ${PYPKGPREFIX} == "py27"
DEPENDS+=       ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${_PKG_PY2}
.else
DEPENDS+=       ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${_PKG_PY3}
.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