summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorwiz <wiz>2014-01-16 10:27:36 +0000
committerwiz <wiz>2014-01-16 10:27:36 +0000
commit731530258791d977402e4beedc72f532a037f937 (patch)
tree44f14e7d95582f68b172b3bc2b77658f3fe429bd /lang
parent79930fdcd2018c6a7606e5edefe34114dd63212d (diff)
downloadpkgsrc-731530258791d977402e4beedc72f532a037f937.tar.gz
Add support for python package modules having different pkgsrc packages
depending on python major version. For now, this supports the dateutil module.
Diffstat (limited to 'lang')
-rw-r--r--lang/python/versioned_dependencies.mk37
1 files changed, 37 insertions, 0 deletions
diff --git a/lang/python/versioned_dependencies.mk b/lang/python/versioned_dependencies.mk
new file mode 100644
index 00000000000..0cb6e47a0e2
--- /dev/null
+++ b/lang/python/versioned_dependencies.mk
@@ -0,0 +1,37 @@
+# $NetBSD: versioned_dependencies.mk,v 1.1 2014/01/16 10:27:36 wiz Exp $
+#
+# This file determines which separate distribution of a Python
+# package is used as dependency, depending on the Python version
+# used.
+#
+# === User-settable variables ===
+#
+# PYTHON_VERSIONED_DEPENDENCIES
+# The Python package which should be added as a dependency.
+#
+# Possible values: dateutil
+# Default: (nothing)
+#
+
+.include "../../lang/python/pyversion.mk"
+
+_SUPPORTED_PACKAGES=# empty
+#_SUPPORTED_PACKAGES+=cairo graphics/py-cairo graphics/py-cairo3
+_SUPPORTED_PACKAGES+=dateutil time/py-dateutil time/py-dateutil2
+
+.for pkg in ${PYTHON_VERSIONED_DEPENDENCIES}
+_PKG_MATCHED= no
+.for name py2dir py3dir in ${_SUPPORTED_PACKAGES}
+.if ${pkg} == ${name}
+_PKG_MATCHED= yes
+.if ${PYPKGPREFIX} == "py26" || ${PYPKGPREFIX} == "py27"
+DEPENDS+= ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${py2dir}
+.else
+DEPENDS+= ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${py3dir}
+.endif
+.endif
+.endfor
+.if ${_PKG_MATCHED} == "no"
+PKG_FAIL_REASON= "${pkg} unsupported in PYTHON_PACKAGE_AUTOSWITCH"
+.endif
+.endfor