summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lang/python/distutils.mk44
-rw-r--r--lang/python/pyversion.mk5
2 files changed, 48 insertions, 1 deletions
diff --git a/lang/python/distutils.mk b/lang/python/distutils.mk
new file mode 100644
index 00000000000..f0b7885a6f4
--- /dev/null
+++ b/lang/python/distutils.mk
@@ -0,0 +1,44 @@
+# $NetBSD: distutils.mk,v 1.1 2010/07/24 12:32:22 gdt Exp $
+#
+# Common logic for python distributions that use distutils.
+#
+.include "../../mk/bsd.fast.prefs.mk"
+
+.include "../../lang/python/pyversion.mk"
+
+# This file should be included to package python "distributions" which
+# use distutils. See egg.mk for distributions that use setuptools and
+# extensions.mk for ad hoc cases.
+
+# Some day, hoist the PYDISTUTILSPKG code in extension.mk to here,
+# after all distutils-using packages use this.
+PYDISTUTILSPKG= yes
+
+# We expect distutils to create an egg-info file if Python distutils
+# can do so, and provide support for a PLIST entry that represents
+# this norm and will work with all python versions. (If the package
+# set PY_NO_EGG, respect that choice, but PLIST.eggfile is still set.)
+
+# Set the egg file basename.
+EGG_NAME?= ${DISTNAME}
+
+PLIST_VARS+= eggfile
+.if !empty(PYDISTUTILS_CREATES_EGGFILES:M[yY][eE][sS])
+# Python distutils will create an eggfile.
+PLIST.eggfile= yes
+PY_NO_EGG?= no
+.else
+# Python distutils will not create an eggfile.
+# (PLIST.eggfile being set to no is equivalent to being set to yes!)
+PY_NO_EGG?= yes
+.endif
+
+# Egg files have the version encoded, so generalize in PLIST, and provide
+# our conditional.
+PLIST_SUBST+= EGG_FILE=${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
+# Somehow, this rule seems to run after PYSITELIB is de-expanded and
+# therefore not work.
+PRINT_PLIST_AWK+= { gsub("${PYSITELIB}/${EGG_NAME}-py${PYVERSSUFFIX}.egg-info", \
+ "$${PLIST.eggfile}$${PYSITELIB}/$${EGG_FILE}") }
+
+.include "../../lang/python/extension.mk"
diff --git a/lang/python/pyversion.mk b/lang/python/pyversion.mk
index e542efa91d9..62100ff162a 100644
--- a/lang/python/pyversion.mk
+++ b/lang/python/pyversion.mk
@@ -1,4 +1,4 @@
-# $NetBSD: pyversion.mk,v 1.80 2010/02/12 13:45:54 drochner Exp $
+# $NetBSD: pyversion.mk,v 1.81 2010/07/24 12:32:22 gdt Exp $
# This file determines which Python version is used as a dependency for
# a package.
@@ -122,18 +122,21 @@ PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python26}:${PYPKGSRCDIR}
PYPACKAGE= python26
PYVERSSUFFIX= 2.6
PYPKGPREFIX= py26
+PYDISTUTILS_CREATES_EGGFILES= yes
.elif ${_PYTHON_VERSION} == "25"
PYPKGSRCDIR= ../../lang/python25
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python25}:${PYPKGSRCDIR}
PYPACKAGE= python25
PYVERSSUFFIX= 2.5
PYPKGPREFIX= py25
+PYDISTUTILS_CREATES_EGGFILES= yes
.elif ${_PYTHON_VERSION} == "24"
PYPKGSRCDIR= ../../lang/python24
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python24}:${PYPKGSRCDIR}
PYPACKAGE= python24
PYVERSSUFFIX= 2.4
PYPKGPREFIX= py24
+PYDISTUTILS_CREATES_EGGFILES= no
.else
PKG_FAIL_REASON+= "No valid Python version"
.endif