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