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

1.1     ! drochner    1: # $NetBSD$
        !             2: 
        !             3: .include "../../mk/bsd.prefs.mk"
        !             4: 
        !             5: PYTHON_VERSION_DEFAULT?=       21
        !             6: PYTHON_VERSIONS_ACCEPTED?=     21 20
        !             7: 
        !             8: # transform the list into individual variables
        !             9: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
        !            10: _PYTHON_VERSION_${pv}_OK=      yes
        !            11: .endfor
        !            12: 
        !            13: # check what is installed
        !            14: .if exists(${LOCALBASE}/bin/python2.1)
        !            15: _PYTHON_VERSION_21_INSTALLED=  yes
        !            16: .endif
        !            17: .if exists(${LOCALBASE}/bin/python2.0)
        !            18: _PYTHON_VERSION_20_INSTALLED=  yes
        !            19: .endif
        !            20: 
        !            21: #
        !            22: # choose a python version where to add,
        !            23: # try to be intelligent
        !            24: #
        !            25: # if the default is already installed, it is first choice
        !            26: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
        !            27: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_INSTALLED)
        !            28: _PYTHON_VERSION=       ${PYTHON_VERSION_DEFAULT}
        !            29: .endif
        !            30: .endif
        !            31: # prefer an already installed version, in order of "accepted"
        !            32: .if !defined(_PYTHON_VERSION)
        !            33: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
        !            34: .if defined(_PYTHON_VERSION_${pv}_INSTALLED)
        !            35: _PYTHON_VERSION?=      ${pv}
        !            36: .else
        !            37: # keep information as last resort - see below
        !            38: _PYTHON_VERSION_FIRSTACCEPTED?=        ${pv}
        !            39: .endif
        !            40: .endfor
        !            41: .endif
        !            42: # if the default is OK for the addon pkg, take this
        !            43: .if !defined(_PYTHON_VERSION)
        !            44: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
        !            45: _PYTHON_VERSION=       ${PYTHON_VERSION_DEFAULT}
        !            46: .endif
        !            47: .endif
        !            48: # take the first one accepted by the package
        !            49: .if !defined(_PYTHON_VERSION)
        !            50: _PYTHON_VERSION=       ${_PYTHON_VERSION_FIRSTACCEPTED}
        !            51: .endif
        !            52: 
        !            53: #
        !            54: # set variables for the version we decided to use
        !            55: #
        !            56: .if ${_PYTHON_VERSION} == "21"
        !            57: DEPENDS+=      python21>=2.1:../../lang/python21
        !            58: PYTHONBIN=     ${LOCALBASE}/bin/python2.1
        !            59: PYPKGPREFIX=   py21
        !            60: .elif ${_PYTHON_VERSION} == "20"
        !            61: #DEPENDS+=     python20>=2.0:../../lang/python20
        !            62: DEPENDS+=      python-2.0.1:../../lang/python
        !            63: PYTHONBIN=     ${LOCALBASE}/bin/python2.0
        !            64: PYPKGPREFIX=   py20
        !            65: .endif

CVSweb <webmaster@jp.NetBSD.org>