Annotation of pkgsrc/lang/python/pyversion.mk, revision 1.16
1.16 ! tsarna 1: # $NetBSD: pyversion.mk,v 1.15 2002/10/25 10:52:24 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:
1.16 ! tsarna 8: PYTHON_VERSION_DEFAULT?= 22
1.2 drochner 9: PYTHON_VERSIONS_ACCEPTED?= 22 21 20
1.1 drochner 10:
1.13 jlam 11: BUILDLINK_DEPENDS.python15?= python15>=1.5
12: BUILDLINK_DEPENDS.python20?= python20>=2.0
13: BUILDLINK_DEPENDS.python21?= python21>=2.1
14: BUILDLINK_DEPENDS.python21-pth?= python21-pth>=2.1
15: BUILDLINK_DEPENDS.python22?= python22>=2.2
1.15 drochner 16: BUILDLINK_DEPENDS.python22-pth?= python22-pth>=2.2
1.4 drochner 17:
1.1 drochner 18: # transform the list into individual variables
19: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
20: _PYTHON_VERSION_${pv}_OK= yes
21: .endfor
22:
23: # check what is installed
1.2 drochner 24: .if exists(${LOCALBASE}/bin/python2.2)
25: _PYTHON_VERSION_22_INSTALLED= yes
26: .endif
1.15 drochner 27: .if exists(${LOCALBASE}/bin/python2p2)
28: _PYTHON_VERSION_22pth_INSTALLED=yes
29: .endif
1.1 drochner 30: .if exists(${LOCALBASE}/bin/python2.1)
31: _PYTHON_VERSION_21_INSTALLED= yes
32: .endif
1.9 drochner 33: .if exists(${LOCALBASE}/bin/python2p1)
34: _PYTHON_VERSION_21pth_INSTALLED=yes
35: .endif
1.1 drochner 36: .if exists(${LOCALBASE}/bin/python2.0)
37: _PYTHON_VERSION_20_INSTALLED= yes
38: .endif
1.7 drochner 39: .if exists(${LOCALBASE}/bin/python1.5)
40: _PYTHON_VERSION_15_INSTALLED= yes
41: .endif
1.1 drochner 42:
43: #
44: # choose a python version where to add,
45: # try to be intelligent
46: #
1.2 drochner 47: # if a version is explicitely required, take it
48: .if defined(PYTHON_VERSION_REQD)
49: _PYTHON_VERSION= ${PYTHON_VERSION_REQD}
50: .endif
1.1 drochner 51: # if the default is already installed, it is first choice
1.2 drochner 52: .if !defined(_PYTHON_VERSION)
1.1 drochner 53: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
54: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_INSTALLED)
55: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
56: .endif
57: .endif
1.2 drochner 58: .endif
1.1 drochner 59: # prefer an already installed version, in order of "accepted"
60: .if !defined(_PYTHON_VERSION)
61: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
62: .if defined(_PYTHON_VERSION_${pv}_INSTALLED)
63: _PYTHON_VERSION?= ${pv}
64: .else
65: # keep information as last resort - see below
66: _PYTHON_VERSION_FIRSTACCEPTED?= ${pv}
67: .endif
68: .endfor
69: .endif
70: # if the default is OK for the addon pkg, take this
71: .if !defined(_PYTHON_VERSION)
72: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
73: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
74: .endif
75: .endif
76: # take the first one accepted by the package
77: .if !defined(_PYTHON_VERSION)
78: _PYTHON_VERSION= ${_PYTHON_VERSION_FIRSTACCEPTED}
79: .endif
80:
81: #
1.5 drochner 82: # set variables for the version we decided to use:
83: # PYVERSSUFFIX: suffix to executables and in library path,
84: # equal to sys.version[0:3]
85: # PYPKGPREFIX: prefix to use in PKGNAME for extensions which can install
86: # to multiple Python versions
1.1 drochner 87: #
1.2 drochner 88: .if ${_PYTHON_VERSION} == "22"
1.10 jlam 89: PYPKGSRCDIR= ../../lang/python22
90: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22}:${PYPKGSRCDIR}
1.14 jlam 91: PYPACKAGE= python22
1.5 drochner 92: PYVERSSUFFIX= 2.2
1.2 drochner 93: PYPKGPREFIX= py22
1.15 drochner 94: .elif ${_PYTHON_VERSION} == "22pth"
95: PYPKGSRCDIR= ../../lang/python22-pth
96: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22-pth}:${PYPKGSRCDIR}
97: PYPACKAGE= python22-pth
98: PYVERSSUFFIX= 2p2
99: PYPKGPREFIX= py22pth
100: . if defined(USE_BUILDLINK2)
101: . include "../../devel/pth/buildlink2.mk"
102: . else
103: . include "../../devel/pth/buildlink.mk"
104: . endif
1.2 drochner 105: .elif ${_PYTHON_VERSION} == "21"
1.10 jlam 106: PYPKGSRCDIR= ../../lang/python21
1.14 jlam 107: PYPACKAGE= python21
1.10 jlam 108: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21}:${PYPKGSRCDIR}
1.5 drochner 109: PYVERSSUFFIX= 2.1
1.1 drochner 110: PYPKGPREFIX= py21
1.9 drochner 111: .elif ${_PYTHON_VERSION} == "21pth"
1.12 seb 112: PYPKGSRCDIR= ../../lang/python21-pth
1.14 jlam 113: PYPACKAGE= python21-pth
1.13 jlam 114: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21-pth}:${PYPKGSRCDIR}
1.9 drochner 115: PYVERSSUFFIX= 2p1
116: PYPKGPREFIX= py21pth
1.10 jlam 117: . if defined(USE_BUILDLINK2)
118: . include "../../devel/pth/buildlink2.mk"
119: . else
120: . include "../../devel/pth/buildlink.mk"
121: . endif
1.1 drochner 122: .elif ${_PYTHON_VERSION} == "20"
1.10 jlam 123: PYPKGSRCDIR= ../../lang/python20
1.14 jlam 124: PYPACKAGE= python20
1.10 jlam 125: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python20}:${PYPKGSRCDIR}
1.5 drochner 126: PYVERSSUFFIX= 2.0
1.1 drochner 127: PYPKGPREFIX= py20
1.7 drochner 128: .elif ${_PYTHON_VERSION} == "15"
1.10 jlam 129: PYPKGSRCDIR= ../../lang/python15
1.14 jlam 130: PYPACKAGE= python15
1.10 jlam 131: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python15}:${PYPKGSRCDIR}
1.7 drochner 132: PYVERSSUFFIX= 1.5
133: PYPKGPREFIX= py15
134: .if !defined(PYTHON_DISTUTILS_BOOTSTRAP)
135: BUILD_DEPENDS+= py15-distutils-*:../../devel/py-distutils
136: .endif
1.8 drochner 137: .else
138: # force an error
139: error: no valid Python version
1.1 drochner 140: .endif
1.5 drochner 141:
1.10 jlam 142: .if defined(USE_BUILDLINK2)
143: . if defined(PYTHON_FOR_BUILD_ONLY)
144: BUILD_DEPMETHOD.python?= build
145: . endif
146: . include "${PYPKGSRCDIR}/buildlink2.mk"
147: .else
148: . if defined(PYTHON_FOR_BUILD_ONLY)
1.6 drochner 149: BUILD_DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 150: . else
1.6 drochner 151: DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 152: . endif
1.11 jlam 153: .endif
154:
155: PYTHONBIN= ${LOCALBASE}/bin/python${PYVERSSUFFIX}
156:
157: .if exists(${PYTHONBIN})
158: PYINC!= ${PYTHONBIN} -c "import distutils.sysconfig; \
159: print distutils.sysconfig.get_python_inc(0, \"\")" || ${ECHO} ""
160: PYLIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
161: print distutils.sysconfig.get_python_lib(0, 1, \"\")" || ${ECHO} ""
162: PYSITELIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
163: print distutils.sysconfig.get_python_lib(0, 0, \"\")" || ${ECHO} ""
1.6 drochner 164: .endif
1.2 drochner 165:
166: .endif # PYTHON_PYVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>