Annotation of pkgsrc/lang/python/pyversion.mk, revision 1.29
1.29 ! recht 1: # $NetBSD: pyversion.mk,v 1.28 2004/06/06 16:24:55 tv 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.26 danw 8: PYTHON_VERSION_DEFAULT?= 23
1.17 schmonz 9: .if ${OPSYS} == "Darwin"
1.28 tv 10: PYTHON_VERSIONS_INCOMPATIBLE+= 23 22 21 21pth 20 15
1.26 danw 11: BUILDLINK_DEPENDS.python22-pth?= python22-pth>=2.2.3nb2
12: BUILDLINK_DEPENDS.python23-pth?= python23-pth>=2.3.3nb3
1.28 tv 13: .endif
1.26 danw 14: PYTHON_VERSIONS_ACCEPTED?= 23 23pth 22 22pth 21 21pth 20
1.28 tv 15: PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default
1.1 drochner 16:
1.13 jlam 17: BUILDLINK_DEPENDS.python15?= python15>=1.5
18: BUILDLINK_DEPENDS.python20?= python20>=2.0
19: BUILDLINK_DEPENDS.python21?= python21>=2.1
20: BUILDLINK_DEPENDS.python21-pth?= python21-pth>=2.1
21: BUILDLINK_DEPENDS.python22?= python22>=2.2
1.15 drochner 22: BUILDLINK_DEPENDS.python22-pth?= python22-pth>=2.2
1.21 drochner 23: BUILDLINK_DEPENDS.python23?= python23>=2.3
24: BUILDLINK_DEPENDS.python23-pth?= python23-pth>=2.3
1.4 drochner 25:
1.1 drochner 26: # transform the list into individual variables
27: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
1.28 tv 28: .if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv})
1.1 drochner 29: _PYTHON_VERSION_${pv}_OK= yes
1.28 tv 30: .endif
1.1 drochner 31: .endfor
32:
33: # check what is installed
1.21 drochner 34: .if exists(${LOCALBASE}/bin/python2.3)
35: _PYTHON_VERSION_23_INSTALLED= yes
36: .endif
37: .if exists(${LOCALBASE}/bin/python2p3)
38: _PYTHON_VERSION_23pth_INSTALLED=yes
39: .endif
1.2 drochner 40: .if exists(${LOCALBASE}/bin/python2.2)
41: _PYTHON_VERSION_22_INSTALLED= yes
42: .endif
1.15 drochner 43: .if exists(${LOCALBASE}/bin/python2p2)
44: _PYTHON_VERSION_22pth_INSTALLED=yes
45: .endif
1.1 drochner 46: .if exists(${LOCALBASE}/bin/python2.1)
47: _PYTHON_VERSION_21_INSTALLED= yes
48: .endif
1.9 drochner 49: .if exists(${LOCALBASE}/bin/python2p1)
50: _PYTHON_VERSION_21pth_INSTALLED=yes
51: .endif
1.1 drochner 52: .if exists(${LOCALBASE}/bin/python2.0)
53: _PYTHON_VERSION_20_INSTALLED= yes
54: .endif
1.7 drochner 55: .if exists(${LOCALBASE}/bin/python1.5)
56: _PYTHON_VERSION_15_INSTALLED= yes
57: .endif
1.1 drochner 58:
59: #
60: # choose a python version where to add,
61: # try to be intelligent
62: #
1.2 drochner 63: # if a version is explicitely required, take it
64: .if defined(PYTHON_VERSION_REQD)
65: _PYTHON_VERSION= ${PYTHON_VERSION_REQD}
66: .endif
1.1 drochner 67: # if the default is already installed, it is first choice
1.2 drochner 68: .if !defined(_PYTHON_VERSION)
1.1 drochner 69: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
70: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_INSTALLED)
71: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
72: .endif
73: .endif
1.2 drochner 74: .endif
1.1 drochner 75: # prefer an already installed version, in order of "accepted"
76: .if !defined(_PYTHON_VERSION)
77: .for pv in ${PYTHON_VERSIONS_ACCEPTED}
1.28 tv 78: .if defined(_PYTHON_VERSION_${pv}_OK)
1.1 drochner 79: .if defined(_PYTHON_VERSION_${pv}_INSTALLED)
80: _PYTHON_VERSION?= ${pv}
81: .else
82: # keep information as last resort - see below
83: _PYTHON_VERSION_FIRSTACCEPTED?= ${pv}
84: .endif
1.28 tv 85: .endif
1.1 drochner 86: .endfor
87: .endif
88: # if the default is OK for the addon pkg, take this
89: .if !defined(_PYTHON_VERSION)
90: .if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
91: _PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
92: .endif
93: .endif
94: # take the first one accepted by the package
95: .if !defined(_PYTHON_VERSION)
96: _PYTHON_VERSION= ${_PYTHON_VERSION_FIRSTACCEPTED}
97: .endif
98:
99: #
1.5 drochner 100: # set variables for the version we decided to use:
101: # PYVERSSUFFIX: suffix to executables and in library path,
102: # equal to sys.version[0:3]
103: # PYPKGPREFIX: prefix to use in PKGNAME for extensions which can install
104: # to multiple Python versions
1.1 drochner 105: #
1.21 drochner 106: .if ${_PYTHON_VERSION} == "23"
107: PYPKGSRCDIR= ../../lang/python23
108: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python23}:${PYPKGSRCDIR}
109: PYPACKAGE= python23
110: PYVERSSUFFIX= 2.3
111: PYPKGPREFIX= py23
112: .elif ${_PYTHON_VERSION} == "23pth"
113: PYPKGSRCDIR= ../../lang/python23-pth
114: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python23-pth}:${PYPKGSRCDIR}
115: PYPACKAGE= python23-pth
116: PYVERSSUFFIX= 2p3
117: PYPKGPREFIX= py23pth
1.27 recht 118: . if defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
1.23 recht 119: PTHREAD_OPTS= require
120: . include "../../mk/pthread.buildlink3.mk"
121: . if ${PTHREAD_TYPE} == "pth"
122: . include "../../devel/pth/buildlink3.mk"
123: . endif
1.21 drochner 124: . endif
125: .elif ${_PYTHON_VERSION} == "22"
1.10 jlam 126: PYPKGSRCDIR= ../../lang/python22
127: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22}:${PYPKGSRCDIR}
1.14 jlam 128: PYPACKAGE= python22
1.5 drochner 129: PYVERSSUFFIX= 2.2
1.2 drochner 130: PYPKGPREFIX= py22
1.15 drochner 131: .elif ${_PYTHON_VERSION} == "22pth"
132: PYPKGSRCDIR= ../../lang/python22-pth
133: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python22-pth}:${PYPKGSRCDIR}
134: PYPACKAGE= python22-pth
135: PYVERSSUFFIX= 2p2
136: PYPKGPREFIX= py22pth
1.27 recht 137: . if defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
1.23 recht 138: PTHREAD_OPTS= require
139: . include "../../mk/pthread.buildlink3.mk"
140: . if ${PTHREAD_TYPE} == "pth"
141: . include "../../devel/pth/buildlink3.mk"
142: . endif
1.15 drochner 143: . endif
1.2 drochner 144: .elif ${_PYTHON_VERSION} == "21"
1.10 jlam 145: PYPKGSRCDIR= ../../lang/python21
1.14 jlam 146: PYPACKAGE= python21
1.10 jlam 147: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21}:${PYPKGSRCDIR}
1.5 drochner 148: PYVERSSUFFIX= 2.1
1.1 drochner 149: PYPKGPREFIX= py21
1.9 drochner 150: .elif ${_PYTHON_VERSION} == "21pth"
1.12 seb 151: PYPKGSRCDIR= ../../lang/python21-pth
1.14 jlam 152: PYPACKAGE= python21-pth
1.13 jlam 153: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python21-pth}:${PYPKGSRCDIR}
1.9 drochner 154: PYVERSSUFFIX= 2p1
155: PYPKGPREFIX= py21pth
1.27 recht 156: . if defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO])
1.23 recht 157: PTHREAD_OPTS= require
158: . include "../../mk/pthread.buildlink3.mk"
159: . if ${PTHREAD_TYPE} == "pth"
160: . include "../../devel/pth/buildlink3.mk"
161: . endif
1.10 jlam 162: . endif
1.1 drochner 163: .elif ${_PYTHON_VERSION} == "20"
1.10 jlam 164: PYPKGSRCDIR= ../../lang/python20
1.14 jlam 165: PYPACKAGE= python20
1.10 jlam 166: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python20}:${PYPKGSRCDIR}
1.5 drochner 167: PYVERSSUFFIX= 2.0
1.1 drochner 168: PYPKGPREFIX= py20
1.7 drochner 169: .elif ${_PYTHON_VERSION} == "15"
1.10 jlam 170: PYPKGSRCDIR= ../../lang/python15
1.14 jlam 171: PYPACKAGE= python15
1.10 jlam 172: PYDEPENDENCY= ${BUILDLINK_DEPENDS.python15}:${PYPKGSRCDIR}
1.7 drochner 173: PYVERSSUFFIX= 1.5
174: PYPKGPREFIX= py15
175: .if !defined(PYTHON_DISTUTILS_BOOTSTRAP)
176: BUILD_DEPENDS+= py15-distutils-*:../../devel/py-distutils
177: .endif
1.8 drochner 178: .else
179: # force an error
180: error: no valid Python version
1.1 drochner 181: .endif
1.5 drochner 182:
1.27 recht 183: .if (defined(USE_BUILDLINK3) && empty(USE_BUILDLINK3:M[nN][oO]))
1.10 jlam 184: . if defined(PYTHON_FOR_BUILD_ONLY)
185: BUILD_DEPMETHOD.python?= build
186: . endif
1.27 recht 187: . include "${PYPKGSRCDIR}/buildlink3.mk"
1.10 jlam 188: .else
189: . if defined(PYTHON_FOR_BUILD_ONLY)
1.6 drochner 190: BUILD_DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 191: . else
1.6 drochner 192: DEPENDS+= ${PYDEPENDENCY}
1.10 jlam 193: . endif
1.11 jlam 194: .endif
195:
196: PYTHONBIN= ${LOCALBASE}/bin/python${PYVERSSUFFIX}
197:
198: .if exists(${PYTHONBIN})
199: PYINC!= ${PYTHONBIN} -c "import distutils.sysconfig; \
200: print distutils.sysconfig.get_python_inc(0, \"\")" || ${ECHO} ""
201: PYLIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
202: print distutils.sysconfig.get_python_lib(0, 1, \"\")" || ${ECHO} ""
203: PYSITELIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
204: print distutils.sysconfig.get_python_lib(0, 0, \"\")" || ${ECHO} ""
1.29 ! recht 205:
! 206: PRINT_PLIST_AWK+= /^@dirrm ${PYINC:S|/|\\/|g}$$/ { next; }
! 207: PRINT_PLIST_AWK+= /^@dirrm ${PYSITELIB:S|/|\\/|g}$$/ { next; }
! 208: PRINT_PLIST_AWK+= /^@dirrm ${PYLIB:S|/|\\/|g}$$/ { next; }
! 209:
! 210: PRINT_PLIST_AWK+= /^(@dirrm )?${PYINC:S|/|\\/|g}/ \
! 211: { gsub(/${PYINC:S|/|\\/|g}/, "$${PYINC}"); \
! 212: print; next; }
! 213: PRINT_PLIST_AWK+= /^(@dirrm )?${PYSITELIB:S|/|\\/|g}/ \
! 214: { gsub(/${PYSITELIB:S|/|\\/|g}/, "$${PYSITELIB}"); \
! 215: print; next; }
! 216: PRINT_PLIST_AWK+= /^(@dirrm )?${PYLIB:S|/|\\/|g}/ \
! 217: { gsub(/${PYLIB:S|/|\\/|g}/, "$${PYLIB}"); \
! 218: print; next; }
1.6 drochner 219: .endif
1.2 drochner 220:
221: .endif # PYTHON_PYVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>