Fri Jun 17 01:01:04 2011 UTC ()
Add support for python31.

(I have been using this for around 18 months on several platforms;
adjusted once after python27 was added.)


(reed)
diff -r1.88 -r1.89 pkgsrc/lang/python/pyversion.mk

cvs diff -r1.88 -r1.89 pkgsrc/lang/python/pyversion.mk (expand / switch to unified diff)

--- pkgsrc/lang/python/pyversion.mk 2011/03/26 07:53:30 1.88
+++ pkgsrc/lang/python/pyversion.mk 2011/06/17 01:01:04 1.89
@@ -1,40 +1,40 @@ @@ -1,40 +1,40 @@
1# $NetBSD: pyversion.mk,v 1.88 2011/03/26 07:53:30 obache Exp $ 1# $NetBSD: pyversion.mk,v 1.89 2011/06/17 01:01:04 reed Exp $
2 2
3# This file determines which Python version is used as a dependency for 3# This file determines which Python version is used as a dependency for
4# a package. 4# a package.
5# 5#
6# === User-settable variables === 6# === User-settable variables ===
7# 7#
8# PYTHON_VERSION_DEFAULT 8# PYTHON_VERSION_DEFAULT
9# The preferred Python version to use. 9# The preferred Python version to use.
10# 10#
11# Possible values: 24 25 26 27 11# Possible values: 24 25 26 27 31
12# Default: 26 12# Default: 26
13# 13#
14# === Package-settable variables === 14# === Package-settable variables ===
15# 15#
16# PYTHON_VERSIONS_ACCEPTED 16# PYTHON_VERSIONS_ACCEPTED
17# The Python versions that are acceptable for the package. The 17# The Python versions that are acceptable for the package. The
18# order of the entries matters, since earlier entries are 18# order of the entries matters, since earlier entries are
19# preferred over later ones. 19# preferred over later ones.
20# 20#
21# Possible values: 27 26 25 24 21# Possible values: 31 27 26 25 24
22# Default: 27 26 25 24 22# Default: 31 27 26 25 24
23# 23#
24# PYTHON_VERSIONS_INCOMPATIBLE 24# PYTHON_VERSIONS_INCOMPATIBLE
25# The Python versions that are NOT acceptable for the package. 25# The Python versions that are NOT acceptable for the package.
26# 26#
27# Possible values: 24 25 26 27 27# Possible values: 24 25 26 27 31
28# Default: (depends on the platform) 28# Default: (depends on the platform)
29# 29#
30# PYTHON_FOR_BUILD_ONLY 30# PYTHON_FOR_BUILD_ONLY
31# Whether Python is needed only at build time or at run time. 31# Whether Python is needed only at build time or at run time.
32# 32#
33# Possible values: (defined) (undefined) 33# Possible values: (defined) (undefined)
34# Default: (undefined) 34# Default: (undefined)
35# 35#
36# === Defined variables === 36# === Defined variables ===
37# 37#
38# PYPKGPREFIX 38# PYPKGPREFIX
39# The prefix to use in PKGNAME for extensions which are meant 39# The prefix to use in PKGNAME for extensions which are meant
40# to be installed for multiple Python versions. 40# to be installed for multiple Python versions.
@@ -59,33 +59,34 @@ PYTHON_PYVERSION_MK= defined @@ -59,33 +59,34 @@ PYTHON_PYVERSION_MK= defined
59 defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:M*-py[0-9][0-9]-*) 59 defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:M*-py[0-9][0-9]-*)
60PYTHON_VERSION_REQD?= ${PKGNAME_REQD:C/(^.*-|^)py([0-9][0-9])-.*/\2/} 60PYTHON_VERSION_REQD?= ${PKGNAME_REQD:C/(^.*-|^)py([0-9][0-9])-.*/\2/}
61.elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9]-*) || \ 61.elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9]-*) || \
62 defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9]-*) 62 defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9]-*)
63PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9])-.*/\2/} 63PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9])-.*/\2/}
64.endif 64.endif
65 65
66.include "../../mk/bsd.prefs.mk" 66.include "../../mk/bsd.prefs.mk"
67 67
68BUILD_DEFS+= PYTHON_VERSION_DEFAULT 68BUILD_DEFS+= PYTHON_VERSION_DEFAULT
69BUILD_DEFS_EFFECTS+= PYPACKAGE 69BUILD_DEFS_EFFECTS+= PYPACKAGE
70 70
71PYTHON_VERSION_DEFAULT?= 26 71PYTHON_VERSION_DEFAULT?= 26
72PYTHON_VERSIONS_ACCEPTED?= 27 26 25 24 72PYTHON_VERSIONS_ACCEPTED?= 31 27 26 25 24
73PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default 73PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default
74 74
75BUILDLINK_API_DEPENDS.python24?= python24>=2.4 75BUILDLINK_API_DEPENDS.python24?= python24>=2.4
76BUILDLINK_API_DEPENDS.python25?= python25>=2.5.1 76BUILDLINK_API_DEPENDS.python25?= python25>=2.5.1
77BUILDLINK_API_DEPENDS.python26?= python26>=2.6 77BUILDLINK_API_DEPENDS.python26?= python26>=2.6
78BUILDLINK_API_DEPENDS.python27?= python27>=2.7 78BUILDLINK_API_DEPENDS.python27?= python27>=2.7
 79BUILDLINK_API_DEPENDS.python31?= python31>=3.1
79 80
80# transform the list into individual variables 81# transform the list into individual variables
81.for pv in ${PYTHON_VERSIONS_ACCEPTED} 82.for pv in ${PYTHON_VERSIONS_ACCEPTED}
82.if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv}) 83.if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv})
83_PYTHON_VERSION_${pv}_OK= yes 84_PYTHON_VERSION_${pv}_OK= yes
84_PYTHON_VERSIONS_ACCEPTED+= ${pv} 85_PYTHON_VERSIONS_ACCEPTED+= ${pv}
85.endif 86.endif
86.endfor 87.endfor
87 88
88# 89#
89# choose a python version where to add, 90# choose a python version where to add,
90# try to be intelligent 91# try to be intelligent
91# 92#
@@ -111,27 +112,33 @@ _PYTHON_VERSION?= ${pv} @@ -111,27 +112,33 @@ _PYTHON_VERSION?= ${pv}
111. endfor 112. endfor
112. endif 113. endif
113.endif 114.endif
114 115
115# 116#
116# Variable assignment for multi-python packages 117# Variable assignment for multi-python packages
117MULTI+= PYTHON_VERSION_REQD=${_PYTHON_VERSION} 118MULTI+= PYTHON_VERSION_REQD=${_PYTHON_VERSION}
118 119
119# No supported version found, annotate to simplify statements below. 120# No supported version found, annotate to simplify statements below.
120.if !defined(_PYTHON_VERSION) 121.if !defined(_PYTHON_VERSION)
121_PYTHON_VERSION= none 122_PYTHON_VERSION= none
122.endif 123.endif
123 124
124.if ${_PYTHON_VERSION} == "27" 125.if ${_PYTHON_VERSION} == "31"
 126PYPKGSRCDIR= ../../lang/python31
 127PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python26}:${PYPKGSRCDIR}
 128PYPACKAGE= python31
 129PYVERSSUFFIX= 3.1
 130PYPKGPREFIX= py31
 131.elif ${_PYTHON_VERSION} == "27"
125PYPKGSRCDIR= ../../lang/python27 132PYPKGSRCDIR= ../../lang/python27
126PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python27}:${PYPKGSRCDIR} 133PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python27}:${PYPKGSRCDIR}
127PYPACKAGE= python27 134PYPACKAGE= python27
128PYVERSSUFFIX= 2.7 135PYVERSSUFFIX= 2.7
129PYPKGPREFIX= py27 136PYPKGPREFIX= py27
130PYDISTUTILS_CREATES_EGGFILES= yes 137PYDISTUTILS_CREATES_EGGFILES= yes
131.elif ${_PYTHON_VERSION} == "26" 138.elif ${_PYTHON_VERSION} == "26"
132PYPKGSRCDIR= ../../lang/python26 139PYPKGSRCDIR= ../../lang/python26
133PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python26}:${PYPKGSRCDIR} 140PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python26}:${PYPKGSRCDIR}
134PYPACKAGE= python26 141PYPACKAGE= python26
135PYVERSSUFFIX= 2.6 142PYVERSSUFFIX= 2.6
136PYPKGPREFIX= py26 143PYPKGPREFIX= py26
137PYDISTUTILS_CREATES_EGGFILES= yes 144PYDISTUTILS_CREATES_EGGFILES= yes