Annotation of pkgsrc/lang/python/pyversion.mk, revision 1.5

1.5     ! drochner    1: # $NetBSD: pyversion.mk,v 1.4 2002/01/16 20:09:08 drochner Exp $
1.2       drochner    2: 
                      3: .if !defined(PYTHON_PYVERSION_MK)
                      4: PYTHON_PYVERSION_MK=   defined
1.1       drochner    5: 
                      6: .include "../../mk/bsd.prefs.mk"
                      7: 
                      8: PYTHON_VERSION_DEFAULT?=       21
1.2       drochner    9: PYTHON_VERSIONS_ACCEPTED?=     22 21 20
1.1       drochner   10: 
1.4       drochner   11: BUILDLINK_DEPENDS.python20?=   python20>=2.0
                     12: BUILDLINK_DEPENDS.python21?=   python21>=2.1
                     13: BUILDLINK_DEPENDS.python22?=   python22>=2.2
                     14: 
1.1       drochner   15: # transform the list into individual variables
                     16: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
                     17: _PYTHON_VERSION_${pv}_OK=      yes
                     18: .endfor
                     19: 
                     20: # check what is installed
1.2       drochner   21: .if exists(${LOCALBASE}/bin/python2.2)
                     22: _PYTHON_VERSION_22_INSTALLED=  yes
                     23: .endif
1.1       drochner   24: .if exists(${LOCALBASE}/bin/python2.1)
                     25: _PYTHON_VERSION_21_INSTALLED=  yes
                     26: .endif
                     27: .if exists(${LOCALBASE}/bin/python2.0)
                     28: _PYTHON_VERSION_20_INSTALLED=  yes
                     29: .endif
                     30: 
                     31: #
                     32: # choose a python version where to add,
                     33: # try to be intelligent
                     34: #
1.2       drochner   35: # if a version is explicitely required, take it
                     36: .if defined(PYTHON_VERSION_REQD)
                     37: _PYTHON_VERSION=       ${PYTHON_VERSION_REQD}
                     38: .endif
1.1       drochner   39: # if the default is already installed, it is first choice
1.2       drochner   40: .if !defined(_PYTHON_VERSION)
1.1       drochner   41: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
                     42: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_INSTALLED)
                     43: _PYTHON_VERSION=       ${PYTHON_VERSION_DEFAULT}
                     44: .endif
                     45: .endif
1.2       drochner   46: .endif
1.1       drochner   47: # prefer an already installed version, in order of "accepted"
                     48: .if !defined(_PYTHON_VERSION)
                     49: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
                     50: .if defined(_PYTHON_VERSION_${pv}_INSTALLED)
                     51: _PYTHON_VERSION?=      ${pv}
                     52: .else
                     53: # keep information as last resort - see below
                     54: _PYTHON_VERSION_FIRSTACCEPTED?=        ${pv}
                     55: .endif
                     56: .endfor
                     57: .endif
                     58: # if the default is OK for the addon pkg, take this
                     59: .if !defined(_PYTHON_VERSION)
                     60: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
                     61: _PYTHON_VERSION=       ${PYTHON_VERSION_DEFAULT}
                     62: .endif
                     63: .endif
                     64: # take the first one accepted by the package
                     65: .if !defined(_PYTHON_VERSION)
                     66: _PYTHON_VERSION=       ${_PYTHON_VERSION_FIRSTACCEPTED}
                     67: .endif
                     68: 
                     69: #
1.5     ! drochner   70: # set variables for the version we decided to use:
        !            71: #  PYVERSSUFFIX: suffix to executables and in library path,
        !            72: #                equal to sys.version[0:3]
        !            73: #  PYPKGPREFIX: prefix to use in PKGNAME for extensions which can install
        !            74: #               to multiple Python versions
1.1       drochner   75: #
1.2       drochner   76: .if ${_PYTHON_VERSION} == "22"
1.4       drochner   77: DEPENDS+=      ${BUILDLINK_DEPENDS.python22}:../../lang/python22
1.5     ! drochner   78: PYVERSSUFFIX=  2.2
1.2       drochner   79: PYPKGPREFIX=   py22
                     80: .elif ${_PYTHON_VERSION} == "21"
1.4       drochner   81: DEPENDS+=      ${BUILDLINK_DEPENDS.python21}:../../lang/python21
1.5     ! drochner   82: PYVERSSUFFIX=  2.1
1.1       drochner   83: PYPKGPREFIX=   py21
                     84: .elif ${_PYTHON_VERSION} == "20"
1.4       drochner   85: DEPENDS+=      ${BUILDLINK_DEPENDS.python20}:../../lang/python20
1.5     ! drochner   86: PYVERSSUFFIX=  2.0
1.1       drochner   87: PYPKGPREFIX=   py20
                     88: .endif
1.5     ! drochner   89: 
        !            90: PYTHONBIN=     ${LOCALBASE}/bin/python${PYVERSSUFFIX}
1.2       drochner   91: 
                     92: .endif # PYTHON_PYVERSION_MK

CVSweb <webmaster@jp.NetBSD.org>