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

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

CVSweb <webmaster@jp.NetBSD.org>