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