pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/python Add support for packaging python "distribu...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/efe3ea6811dc
branches:  trunk
changeset: 577911:efe3ea6811dc
user:      gdt <gdt%pkgsrc.org@localhost>
date:      Sat Jul 24 12:32:22 2010 +0000

description:
Add support for packaging python "distributions" that use distutils.
Suppport conditional PLIST inclusion of the expected egg file, because
python2.4 distutils does not create them but later versions do.  (Note
that PRINT_PLIST_AWK production is not working, probably due to order
of substitution.)

Earlier patch reviewed by wiz@.

diffstat:

 lang/python/distutils.mk |  44 ++++++++++++++++++++++++++++++++++++++++++++
 lang/python/pyversion.mk |   5 ++++-
 2 files changed, 48 insertions(+), 1 deletions(-)

diffs (79 lines):

diff -r 2987680d47a1 -r efe3ea6811dc lang/python/distutils.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python/distutils.mk  Sat Jul 24 12:32:22 2010 +0000
@@ -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 -r 2987680d47a1 -r efe3ea6811dc lang/python/pyversion.mk
--- a/lang/python/pyversion.mk  Sat Jul 24 12:20:58 2010 +0000
+++ b/lang/python/pyversion.mk  Sat Jul 24 12:32:22 2010 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index