summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorrecht <recht>2003-12-08 21:13:56 +0000
committerrecht <recht>2003-12-08 21:13:56 +0000
commit72f126d102952a50a135e80eb57314a6f529ba20 (patch)
tree70f4cf85affe88fccec44ff34b037ea0db35eb45 /lang
parentde3d7d9c5477fe915f3a098df4ddc4a5e6e6db83 (diff)
downloadpkgsrc-72f126d102952a50a135e80eb57314a6f529ba20.tar.gz
Update to Python 2.3.2
Changes in Python: Quite a few fixes.. See NEWS for details. Changes in the pkg: - add FreeBSD patches from the FreeBSD port - add fix for a fatal bug in type's GC handling causes segfaults (via FreeBSD port) see http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Misc/NEWS?r1=1.831.4.75&r2=1.831.4.76&diff_format=u - always build the db 1.85 module (on all platforms)
Diffstat (limited to 'lang')
-rw-r--r--lang/python/srcdist.mk8
-rw-r--r--lang/python23-pth/Makefile72
-rw-r--r--lang/python23-pth/PLIST.Linux4
-rw-r--r--lang/python23-pth/PLIST.NetBSD3
-rw-r--r--lang/python23-pth/PLIST.common13
-rw-r--r--lang/python23-pth/distinfo31
-rw-r--r--lang/python23-pth/patches/patch-aa88
-rw-r--r--lang/python23-pth/patches/patch-ab26
-rw-r--r--lang/python23-pth/patches/patch-ac13
-rw-r--r--lang/python23-pth/patches/patch-ad23
-rw-r--r--lang/python23-pth/patches/patch-ae34
-rw-r--r--lang/python23-pth/patches/patch-af (renamed from lang/python23-pth/patches/patch-bb)6
-rw-r--r--lang/python23-pth/patches/patch-ag223
-rw-r--r--lang/python23-pth/patches/patch-ah31
-rw-r--r--lang/python23-pth/patches/patch-ai39
-rw-r--r--lang/python23-pth/patches/patch-aj209
-rw-r--r--lang/python23-pth/patches/patch-ak74
-rw-r--r--lang/python23-pth/patches/patch-al63
-rw-r--r--lang/python23-pth/patches/patch-am145
-rw-r--r--lang/python23-pth/patches/patch-ba32
-rw-r--r--lang/python23-pth/patches/patch-bc21
-rw-r--r--lang/python23/Makefile74
-rw-r--r--lang/python23/PLIST.Linux8
-rw-r--r--lang/python23/PLIST.NetBSD7
-rw-r--r--lang/python23/PLIST.common17
-rw-r--r--lang/python23/PLIST.common_end2
-rw-r--r--lang/python23/distinfo26
-rw-r--r--lang/python23/patches/patch-aa81
-rw-r--r--lang/python23/patches/patch-ab26
-rw-r--r--lang/python23/patches/patch-ac13
-rw-r--r--lang/python23/patches/patch-ad23
-rw-r--r--lang/python23/patches/patch-ae34
-rw-r--r--lang/python23/patches/patch-af (renamed from lang/python23/patches/patch-bb)6
-rw-r--r--lang/python23/patches/patch-ag216
-rw-r--r--lang/python23/patches/patch-ah22
-rw-r--r--lang/python23/patches/patch-ai39
-rw-r--r--lang/python23/patches/patch-aj209
-rw-r--r--lang/python23/patches/patch-ak68
-rw-r--r--lang/python23/patches/patch-al62
-rw-r--r--lang/python23/patches/patch-am145
-rw-r--r--lang/python23/patches/patch-bc21
41 files changed, 1655 insertions, 602 deletions
diff --git a/lang/python/srcdist.mk b/lang/python/srcdist.mk
index 79effe9c54e..51d82f2bee2 100644
--- a/lang/python/srcdist.mk
+++ b/lang/python/srcdist.mk
@@ -1,16 +1,16 @@
-# $NetBSD: srcdist.mk,v 1.8 2003/08/04 08:15:47 drochner Exp $
+# $NetBSD: srcdist.mk,v 1.9 2003/12/08 21:13:56 recht Exp $
.include "../../lang/python/pyversion.mk"
.if ${_PYTHON_VERSION} == "23" || ${_PYTHON_VERSION} == "23pth"
-DISTNAME= Python-2.3
+DISTNAME= Python-2.3.2
EXTRACT_SUFX= .tgz
DISTINFO_FILE= ${.CURDIR}/../../lang/python23/distinfo
PATCHDIR= ${.CURDIR}/../../lang/python23/patches
-PYSUBDIR= Python-2.3
+PYSUBDIR= Python-2.3.2
WRKSRC= ${WRKDIR}/${PYSUBDIR}
-MASTER_SITES= ftp://ftp.python.org/pub/python/2.3/
+MASTER_SITES= ftp://ftp.python.org/pub/python/2.3.2/
.elif ${_PYTHON_VERSION} == "22" || ${_PYTHON_VERSION} == "22pth"
diff --git a/lang/python23-pth/Makefile b/lang/python23-pth/Makefile
index 35c1d892d12..1f5a15fb0db 100644
--- a/lang/python23-pth/Makefile
+++ b/lang/python23-pth/Makefile
@@ -1,22 +1,22 @@
-# $NetBSD: Makefile,v 1.10 2003/11/17 00:11:43 recht Exp $
+# $NetBSD: Makefile,v 1.11 2003/12/08 21:13:56 recht Exp $
#
-DISTNAME= Python-2.3
-PKGNAME= python23-pth-2.3
-PKGREVISION= 3
+DISTNAME= Python-2.3.2
+PKGNAME= python23-pth-2.3.2
CATEGORIES= lang
-MASTER_SITES= ftp://ftp.python.org/pub/python/2.3/
+MASTER_SITES= ftp://ftp.python.org/pub/python/2.3.2/
EXTRACT_SUFX= .tgz
MAINTAINER= recht@NetBSD.org
HOMEPAGE= http://www.python.org/
COMMENT= Interpreted, interactive, object-oriented programming language
-USE_BUILDLINK2= YES
-GNU_CONFIGURE= YES
-
+USE_DB185= yes
+USE_BUILDLINK2= yes
+GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --enable-shared
CONFIGURE_ARGS+= OPT="${CFLAGS}"
+UNLIMIT_RESOURCES+= stacksize
PTHREAD_OPTS= require
.include "../../mk/pthread.buildlink2.mk"
@@ -25,15 +25,11 @@ CONFIGURE_ARGS+= --with-pth
.endif
INSTALL_TARGET= altinstall
+TEST_TARGET= test
post-extract:
${MV} ${WRKSRC}/Tools/scripts/pydoc ${WRKSRC}/Tools/scripts/pydoc2p3
-# XXX should be done by the Python install process
-post-install:
- ${LN} -s ${PREFIX}/lib/libpython2p3.so.1.0 \
- ${PREFIX}/lib/libpython2p3.so
-
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "SunOS"
@@ -41,10 +37,11 @@ LOWER_OPSYS= sunos
.endif
.if ${OPSYS} == "Darwin" || ${OPSYS} == "IRIX"
-PLIST_SUBST+= PY_PLATNAME=${LOWER_OPSYS}
+PY_PLATNAME=${LOWER_OPSYS}
.else
-PLIST_SUBST+= PY_PLATNAME=${LOWER_OPSYS}${OS_VERSION:C/\..*//}
+PY_PLATNAME=${LOWER_OPSYS}${OS_VERSION:C/\..*//}
.endif
+PLIST_SUBST+= PY_PLATNAME=${PY_PLATNAME}
# the dl module isn't built for 64 bit archs and Darwin
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" \
@@ -55,12 +52,53 @@ PLIST_SUBST+= DLMODULE="@comment "
PLIST_SUBST+= DLMODULE=
.endif
-.if ${OPSYS} != "NetBSD"
+X86_SUBST= "@comment "
+OSSAUDIODEV_SUBST= "@comment "
+.if ${MACHINE_ARCH} == "i386"
+# activate X86_ONLY modules
+X86_SUBST=
+# ossaudiodev is only available on x86 for the following platforms
+.if ${PY_PLATNAME} == "linux2" || ${PY_PLATNAME} == "freebsd4" \
+ || ${PY_PLATNAME} == "freebsd5"
+OSSAUDIODEV_SUBST=
+.endif
+.endif
+PLIST_SUBST+= X86_ONLY=${X86_SUBST}
+PLIST_SUBST+= OSSAUDIODEV=${OSSAUDIODEV_SUBST}
+
+# ensure that the bsddb185 module is build on all platforms
.include "../../databases/db/buildlink2.mk"
-CPPFLAGS+= -I${BUILDLINK_PREFIX.db}/include/db2
+
+SUBST_CLASSES+= setup
+SUBST_MESSAGE.setup= "Fixing paths for db 1.85."
+SUBST_STAGE.setup= post-patch
+SUBST_FILES.setup= setup.py
+SUBST_SED.setup= -e 's,%%DB185_H%%,${DB185_H},g'
+SUBST_SED.setup+= -e 's,%%DB185_INCS%%,${DB185_INCS},g'
+SUBST_SED.setup+= -e 's,%%DB185_LIBS%%,${DB185_LIBS},g'
+SUBST_SED.setup+= -e 's,%%DB185_LIBDIR%%,${DB185_LIBDIR},g'
+
+DB185_LIBDIR= ${BUILDLINK_PREFIX.db}/lib
+
+.if !empty(BUILDLINK_CPPFLAGS.db)
+LDFLAGS+= ${BUILDLINK_LDFLAGS.db}
+DBINCDIR= ${BUILDLINK_CPPFLAGS.db:S/-I//}
+DB185_INCS= ${DBINCDIR}
+DB185_LIBS= ${BUILDLINK_LIBS.db:S/-l//}
+
+.if ${_NEED_DB2} == "YES"
+DB185_H= ${DBINCDIR}/db_185.h
+.else
+DB185_H= ${DBINCDIR}/db.h
+.endif
+.else
+DB185_H= /usr/include/db.h
+DB185_INCS= /usr/include
+DB185_LIBS=
.endif
.include "../../archivers/bzip2/buildlink2.mk"
.include "../../devel/zlib/buildlink2.mk"
.include "../../security/openssl/buildlink2.mk"
+.include "../../mk/ossaudio.buildlink2.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/lang/python23-pth/PLIST.Linux b/lang/python23-pth/PLIST.Linux
index 13d5816a59d..5558e497c0f 100644
--- a/lang/python23-pth/PLIST.Linux
+++ b/lang/python23-pth/PLIST.Linux
@@ -1,7 +1,5 @@
-@comment $NetBSD: PLIST.Linux,v 1.1 2003/08/18 20:57:14 recht Exp $
-lib/python2p3/lib-dynload/_bsddb.so
+@comment $NetBSD: PLIST.Linux,v 1.2 2003/12/08 21:13:56 recht Exp $
lib/python2p3/lib-dynload/${LOWER_OPSYS}audiodev.so
-lib/python2p3/lib-dynload/ossaudiodev.so
lib/python2p3/plat-${LOWER_OPSYS}2/CDROM.py
lib/python2p3/plat-${LOWER_OPSYS}2/CDROM.pyc
lib/python2p3/plat-${LOWER_OPSYS}2/CDROM.pyo
diff --git a/lang/python23-pth/PLIST.NetBSD b/lang/python23-pth/PLIST.NetBSD
index 562af4876a0..b0dfcf24409 100644
--- a/lang/python23-pth/PLIST.NetBSD
+++ b/lang/python23-pth/PLIST.NetBSD
@@ -1,2 +1 @@
-@comment $NetBSD: PLIST.NetBSD,v 1.1 2003/08/18 20:57:14 recht Exp $
-lib/python2p3/lib-dynload/bsddb185.so
+@comment $NetBSD: PLIST.NetBSD,v 1.2 2003/12/08 21:13:56 recht Exp $
diff --git a/lang/python23-pth/PLIST.common b/lang/python23-pth/PLIST.common
index 1fc2f0f45d7..0c412e82f18 100644
--- a/lang/python23-pth/PLIST.common
+++ b/lang/python23-pth/PLIST.common
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST.common,v 1.2 2003/11/17 00:11:43 recht Exp $
+@comment $NetBSD: PLIST.common,v 1.3 2003/12/08 21:13:56 recht Exp $
bin/pydoc2p3
bin/python2p3
include/python2p3/Python.h
@@ -1125,7 +1125,9 @@ lib/python2p3/lib-dynload/_ssl.so
lib/python2p3/lib-dynload/_testcapi.so
lib/python2p3/lib-dynload/_weakref.so
lib/python2p3/lib-dynload/array.so
+${X86_ONLY}lib/python2p3/lib-dynload/audioop.so
lib/python2p3/lib-dynload/binascii.so
+lib/python2p3/lib-dynload/bsddb185.so
lib/python2p3/lib-dynload/bz2.so
lib/python2p3/lib-dynload/cPickle.so
lib/python2p3/lib-dynload/cStringIO.so
@@ -1136,6 +1138,7 @@ lib/python2p3/lib-dynload/dbm.so
${DLMODULE}lib/python2p3/lib-dynload/dl.so
lib/python2p3/lib-dynload/fcntl.so
lib/python2p3/lib-dynload/grp.so
+${X86_ONLY}lib/python2p3/lib-dynload/imageop.so
lib/python2p3/lib-dynload/itertools.so
lib/python2p3/lib-dynload/math.so
lib/python2p3/lib-dynload/md5.so
@@ -1147,6 +1150,8 @@ lib/python2p3/lib-dynload/pcre.so
lib/python2p3/lib-dynload/pwd.so
lib/python2p3/lib-dynload/regex.so
lib/python2p3/lib-dynload/resource.so
+${X86_ONLY}lib/python2p3/lib-dynload/rgbimg.so
+${OSSAUDIODEV}lib/python2p3/lib-dynload/ossaudiodev.so
lib/python2p3/lib-dynload/rotor.so
lib/python2p3/lib-dynload/select.so
lib/python2p3/lib-dynload/sha.so
@@ -1361,13 +1366,13 @@ lib/python2p3/pickletools.pyo
lib/python2p3/pipes.py
lib/python2p3/pipes.pyc
lib/python2p3/pipes.pyo
+lib/python2p3/pkgutil.py
+lib/python2p3/pkgutil.pyc
+lib/python2p3/pkgutil.pyo
lib/python2p3/plat-${PY_PLATNAME}/IN.py
lib/python2p3/plat-${PY_PLATNAME}/IN.pyc
lib/python2p3/plat-${PY_PLATNAME}/IN.pyo
lib/python2p3/plat-${PY_PLATNAME}/regen
-lib/python2p3/pkgutil.py
-lib/python2p3/pkgutil.pyc
-lib/python2p3/pkgutil.pyo
lib/python2p3/platform.py
lib/python2p3/platform.pyc
lib/python2p3/platform.pyo
diff --git a/lang/python23-pth/distinfo b/lang/python23-pth/distinfo
index a6f0649770d..8f6321cb868 100644
--- a/lang/python23-pth/distinfo
+++ b/lang/python23-pth/distinfo
@@ -1,16 +1,17 @@
-$NetBSD: distinfo,v 1.7 2003/09/14 14:04:32 recht Exp $
+$NetBSD: distinfo,v 1.8 2003/12/08 21:13:56 recht Exp $
-SHA1 (Python-2.3.tgz) = ce5fbde09be17ea5dddd4baa62d2b90e06e7e5c1
-Size (Python-2.3.tgz) = 8436880 bytes
-SHA1 (patch-aa) = c00652fd038a881c1bb07f871d820b93651ddc54
-SHA1 (patch-ae) = ff045dc1b42ce8a4fe5e64fde72469e1be8dab28
-SHA1 (patch-ag) = c11f521d3bd3172289b67224ad4b07d861d8fe18
-SHA1 (patch-ah) = 9bc1b5bf1ee0e76fc19bd582299bf70ee3a10535
-SHA1 (patch-ai) = 75d30db64343afcf2f0bcfe8e73dc9948acb237e
-SHA1 (patch-aj) = e2291bde6a59fc0441bc7c87c0946b7f5601aa5c
-SHA1 (patch-ak) = 341e7dd750e46463f6174676e06fd3a847efd311
-SHA1 (patch-al) = 5614ef46970b5eea2bfdcfc64d1018aa0f4a6e85
-SHA1 (patch-am) = 20235b2febbc2811ca5f9b54958a4064722431ed
-SHA1 (patch-ba) = 9be4490e38c895dfc5041af1889ca7ab1c6d8bd9
-SHA1 (patch-bb) = 1390c5f0bcd75f5f3f1b9949921b555e1021954f
-SHA1 (patch-bc) = 0a83a90aea8a1414b43fa3506912ab09aafbc3c0
+SHA1 (Python-2.3.2.tgz) = 2176d1c42802ea2f9d430f23f1d578e00336c6aa
+Size (Python-2.3.2.tgz) = 8459427 bytes
+SHA1 (patch-aa) = 7c27e64068185a767bd1371851c33952711de854
+SHA1 (patch-ab) = 111d7fa8adbb7001bacad36e3bdbe23ae6ce8b9b
+SHA1 (patch-ac) = 30c16b3770fed3324a38c18426d9d7758e8db889
+SHA1 (patch-ad) = c8f6ea08e68dae3bd9ad639c38e74cf654c0b41e
+SHA1 (patch-ae) = 544af90b9b7c5eb5cbad0ba0cefa3d9496b5efe3
+SHA1 (patch-af) = 2989a1975c8ea435903eafc9add57cb7c4d7de14
+SHA1 (patch-ag) = e2bf14e5858b4273148f1feaf46d5fbb325640a9
+SHA1 (patch-ah) = 6e44407c89edcee59b1f674783544884e96cf101
+SHA1 (patch-ai) = 6299b36119927e87a9a1ea7ef1859ec5f833d0b1
+SHA1 (patch-aj) = 91c1679f8109922c30e4d25fe6f99c856dc6e3d5
+SHA1 (patch-ak) = cabeb3d84102bd8be8c109986f7afb8fc147cd5a
+SHA1 (patch-al) = 1f4353aa56de3bf426c8424bf7b24bbe35e388d4
+SHA1 (patch-am) = 066fc423e4d75ad0d62759b4af2a40f798dfaebf
diff --git a/lang/python23-pth/patches/patch-aa b/lang/python23-pth/patches/patch-aa
index e3558b3f04d..0acbec09d4c 100644
--- a/lang/python23-pth/patches/patch-aa
+++ b/lang/python23-pth/patches/patch-aa
@@ -1,81 +1,13 @@
-$NetBSD: patch-aa,v 1.2 2003/08/18 20:57:14 recht Exp $
+$NetBSD: patch-aa,v 1.3 2003/12/08 21:13:56 recht Exp $
---- setup.py.orig 2003-07-10 14:48:39.000000000 +0200
-+++ setup.py 2003-08-18 21:19:14.000000000 +0200
-@@ -15,7 +15,7 @@
- from distutils.command.install_lib import install_lib
+--- Include/patchlevel.h.orig 2003-10-01 08:47:48.000000000 +0200
++++ Include/patchlevel.h
+@@ -26,7 +26,7 @@
+ #define PY_RELEASE_SERIAL 0
- # This global variable is used to hold the list of modules to be disabled.
--disabled_module_list = []
-+disabled_module_list = ["_curses", "_curses_panel", "_tkinter", "gdbm", "mpz", "pyexpat", "readline"]
+ /* Version as a string */
+-#define PY_VERSION "2.3.2"
++#define PY_VERSION "2p3.2"
- def add_dir_to_list(dirlist, dir):
- """Add the directory 'dir' to the list 'dirlist' (at the front) if
-@@ -240,9 +240,15 @@
- return sys.platform
-
- def detect_modules(self):
-- # Ensure that /usr/local is always used
-- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-+ # Add the buildlink directories for pkgsrc
-+ if os.environ.has_key('BUILDLINK_DIR'):
-+ dir = os.environ['BUILDLINK_DIR']
-+ libdir = dir + '/lib'
-+ incdir = dir + '/include'
-+ if libdir not in self.compiler.library_dirs:
-+ self.compiler.library_dirs.insert(0, libdir)
-+ if incdir not in self.compiler.include_dirs:
-+ self.compiler.include_dirs.insert(0, incdir)
-
- # fink installs lots of goodies in /sw/... - make sure we
- # check there
-@@ -396,13 +402,13 @@
- # These represent audio samples or images as strings:
-
- # Disabled on 64-bit platforms
-- if sys.maxint != 9223372036854775807L:
-+# if sys.maxint != 9223372036854775807L:
- # Operations on audio samples
-- exts.append( Extension('audioop', ['audioop.c']) )
-+# exts.append( Extension('audioop', ['audioop.c']) )
- # Operations on images
-- exts.append( Extension('imageop', ['imageop.c']) )
-+# exts.append( Extension('imageop', ['imageop.c']) )
- # Read SGI RGB image files (but coded portably)
-- exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
-+# exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
-
- # readline
- if self.compiler.find_library_file(lib_dirs, 'readline'):
-@@ -436,9 +442,7 @@
- depends = ['socketmodule.h']) )
- # Detect SSL support for the socket module (via _ssl)
- ssl_incs = find_file('openssl/ssl.h', inc_dirs,
-- ['/usr/local/ssl/include',
-- '/usr/contrib/ssl/include/'
-- ]
-+ []
- )
- if ssl_incs is not None:
- krb5_h = find_file('krb5.h', inc_dirs,
-@@ -446,9 +450,7 @@
- if krb5_h:
- ssl_incs += krb5_h
- ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
-- ['/usr/local/ssl/lib',
-- '/usr/contrib/ssl/lib/'
-- ] )
-+ [] )
-
- if (ssl_incs is not None and
- ssl_libs is not None):
-@@ -1128,7 +1130,7 @@
- ext_modules=[Extension('struct', ['structmodule.c'])],
-
- # Scripts to install
-- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle']
-+ scripts = ['Tools/scripts/pydoc2p3']
- )
-
- # --install-platlib
+ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
+ Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
diff --git a/lang/python23-pth/patches/patch-ab b/lang/python23-pth/patches/patch-ab
new file mode 100644
index 00000000000..b3c51270615
--- /dev/null
+++ b/lang/python23-pth/patches/patch-ab
@@ -0,0 +1,26 @@
+$NetBSD: patch-ab,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Include/py_curses.h.orig 2003-06-29 17:46:21.000000000 +0200
++++ Include/py_curses.h
+@@ -39,6 +39,21 @@
+ #endif
+ #endif
+
++#ifdef __NetBSD__
++/*
++** On NetBSD, [n]curses.h and stdlib.h/wchar.h use different guards
++** against multiple definition of wchar_t and wint_t.
++*/
++#ifdef _XOPEN_SOURCE_EXTENDED
++#ifndef _WCHAR_T
++#define _WCHAR_T
++#endif
++#ifndef _WINT_T
++#define _WINT_T
++#endif
++#endif
++#endif
++
+ #ifdef HAVE_NCURSES_H
+ #include <ncurses.h>
+ #else
diff --git a/lang/python23-pth/patches/patch-ac b/lang/python23-pth/patches/patch-ac
new file mode 100644
index 00000000000..d062928ce91
--- /dev/null
+++ b/lang/python23-pth/patches/patch-ac
@@ -0,0 +1,13 @@
+$NetBSD: patch-ac,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Include/weakrefobject.h.orig 2002-08-12 09:21:58.000000000 +0200
++++ Include/weakrefobject.h
+@@ -39,6 +39,8 @@ PyAPI_FUNC(PyObject *) PyWeakref_GetObje
+
+ PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
+
++PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
++
+ #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
+
+
diff --git a/lang/python23-pth/patches/patch-ad b/lang/python23-pth/patches/patch-ad
new file mode 100644
index 00000000000..e1730705004
--- /dev/null
+++ b/lang/python23-pth/patches/patch-ad
@@ -0,0 +1,23 @@
+$NetBSD: patch-ad,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Lib/distutils/command/build_ext.py.orig 2002-11-19 14:12:28.000000000 +0100
++++ Lib/distutils/command/build_ext.py
+@@ -475,8 +475,18 @@ class build_ext (Command):
+ # that go into the mix.
+ if ext.extra_objects:
+ objects.extend(ext.extra_objects)
++
++ # Two possible sources for extra linker arguments:
++ # - 'extra_link_args' in Extension object
++ # - LDFLAGS environment variable
++ # The environment variable should take precedence, and
++ # any sensible compiler will give precedence to later
++ # command line args. Hence we combine them in order:
+ extra_args = ext.extra_link_args or []
+
++ if os.environ.has_key('LDFLAGS'):
++ extra_args.extend(string.split(os.environ['LDFLAGS']))
++
+ # Detect target language, if not provided
+ language = ext.language or self.compiler.detect_language(sources)
+
diff --git a/lang/python23-pth/patches/patch-ae b/lang/python23-pth/patches/patch-ae
index de1bf167743..e3e2b097710 100644
--- a/lang/python23-pth/patches/patch-ae
+++ b/lang/python23-pth/patches/patch-ae
@@ -1,23 +1,13 @@
-$NetBSD: patch-ae,v 1.1.1.1 2003/08/04 08:29:32 drochner Exp $
+$NetBSD: patch-ae,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Lib/distutils/command/build_ext.py.orig 2002-11-19 14:12:28.000000000 +0100
-+++ Lib/distutils/command/build_ext.py 2003-08-03 13:20:35.000000000 +0200
-@@ -475,8 +475,18 @@
- # that go into the mix.
- if ext.extra_objects:
- objects.extend(ext.extra_objects)
-+
-+ # Two possible sources for extra linker arguments:
-+ # - 'extra_link_args' in Extension object
-+ # - LDFLAGS environment variable
-+ # The environment variable should take precedence, and
-+ # any sensible compiler will give precedence to later
-+ # command line args. Hence we combine them in order:
- extra_args = ext.extra_link_args or []
-
-+ if os.environ.has_key('LDFLAGS'):
-+ extra_args.extend(string.split(os.environ['LDFLAGS']))
-+
- # Detect target language, if not provided
- language = ext.language or self.compiler.detect_language(sources)
-
+--- Lib/distutils/command/build_scripts.py.orig 2003-06-27 21:33:38.000000000 +0200
++++ Lib/distutils/command/build_scripts.py
+@@ -99,7 +99,7 @@ class build_scripts (Command):
+ outf.write("#!%s%s\n" %
+ (os.path.join(
+ sysconfig.get_config_var("BINDIR"),
+- "python" + sysconfig.get_config_var("EXE")),
++ "python%s" % sys.version[:3] + sysconfig.get_config_var("EXE")),
+ post_interp))
+ outf.writelines(f.readlines())
+ outf.close()
diff --git a/lang/python23-pth/patches/patch-bb b/lang/python23-pth/patches/patch-af
index 09d41355aab..8401fc8422e 100644
--- a/lang/python23-pth/patches/patch-bb
+++ b/lang/python23-pth/patches/patch-af
@@ -1,8 +1,8 @@
-$NetBSD: patch-bb,v 1.1.1.1 2003/08/04 08:29:32 drochner Exp $
+$NetBSD: patch-af,v 1.1 2003/12/08 21:13:56 recht Exp $
--- Lib/test/test_fcntl.py.orig 2002-07-23 21:03:51.000000000 +0200
-+++ Lib/test/test_fcntl.py 2003-08-03 12:50:25.000000000 +0200
-@@ -24,7 +24,7 @@
++++ Lib/test/test_fcntl.py
+@@ -24,7 +24,7 @@ if sys.platform in ('netbsd1', 'Darwin1.
'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
'bsdos2', 'bsdos3', 'bsdos4',
'openbsd', 'openbsd2', 'openbsd3'):
diff --git a/lang/python23-pth/patches/patch-ag b/lang/python23-pth/patches/patch-ag
index ab803d54fa9..6bca9ddf6d1 100644
--- a/lang/python23-pth/patches/patch-ag
+++ b/lang/python23-pth/patches/patch-ag
@@ -1,13 +1,216 @@
-$NetBSD: patch-ag,v 1.1.1.1 2003/08/04 08:29:32 drochner Exp $
+$NetBSD: patch-ag,v 1.2 2003/12/08 21:13:56 recht Exp $
---- configure.orig 2003-08-03 13:46:44.000000000 +0200
-+++ configure 2003-08-03 13:47:19.000000000 +0200
-@@ -1243,7 +1243,7 @@
- mv confdefs.h.new confdefs.h
+--- Lib/test/test_weakref.py.orig 2003-07-14 23:37:17.000000000 +0200
++++ Lib/test/test_weakref.py
+@@ -299,6 +299,211 @@ class ReferencesTestCase(TestBase):
+ self.fail("exception not properly restored")
--VERSION=2.3
-+VERSION=2p3
-
-
- SOVERSION=1.0
++ def test_callback_in_cycle_1(self):
++ import gc
++
++ class J(object):
++ pass
++
++ class II(object):
++ def acallback(self, ignore):
++ self.J
++
++ I = II()
++ I.J = J
++ I.wr = weakref.ref(J, I.acallback)
++
++ # Now J and II are each in a self-cycle (as all new-style class
++ # objects are, since their __mro__ points back to them). I holds
++ # both a weak reference (I.wr) and a strong reference (I.J) to class
++ # J. I is also in a cycle (I.wr points to a weakref that references
++ # I.acallback). When we del these three, they all become trash, but
++ # the cycles prevent any of them from getting cleaned up immediately.
++ # Instead they have to wait for cyclic gc to deduce that they're
++ # trash.
++ #
++ # gc used to call tp_clear on all of them, and the order in which
++ # it does that is pretty accidental. The exact order in which we
++ # built up these things manages to provoke gc into running tp_clear
++ # in just the right order (I last). Calling tp_clear on II leaves
++ # behind an insane class object (its __mro__ becomes NULL). Calling
++ # tp_clear on J breaks its self-cycle, but J doesn't get deleted
++ # just then because of the strong reference from I.J. Calling
++ # tp_clear on I starts to clear I's __dict__, and just happens to
++ # clear I.J first -- I.wr is still intact. That removes the last
++ # reference to J, which triggers the weakref callback. The callback
++ # tries to do "self.J", and instances of new-style classes look up
++ # attributes ("J") in the class dict first. The class (II) wants to
++ # search II.__mro__, but that's NULL. The result was a segfault in
++ # a release build, and an assert failure in a debug build.
++ del I, J, II
++ gc.collect()
++
++ def test_callback_in_cycle_2(self):
++ import gc
++
++ # This is just like test_callback_in_cycle_1, except that II is an
++ # old-style class. The symptom is different then: an instance of an
++ # old-style class looks in its own __dict__ first. 'J' happens to
++ # get cleared from I.__dict__ before 'wr', and 'J' was never in II's
++ # __dict__, so the attribute isn't found. The difference is that
++ # the old-style II doesn't have a NULL __mro__ (it doesn't have any
++ # __mro__), so no segfault occurs. Instead it got:
++ # test_callback_in_cycle_2 (__main__.ReferencesTestCase) ...
++ # Exception exceptions.AttributeError:
++ # "II instance has no attribute 'J'" in <bound method II.acallback
++ # of <?.II instance at 0x00B9B4B8>> ignored
++
++ class J(object):
++ pass
++
++ class II:
++ def acallback(self, ignore):
++ self.J
++
++ I = II()
++ I.J = J
++ I.wr = weakref.ref(J, I.acallback)
++
++ del I, J, II
++ gc.collect()
++
++ def test_callback_in_cycle_3(self):
++ import gc
++
++ # This one broke the first patch that fixed the last two. In this
++ # case, the objects reachable from the callback aren't also reachable
++ # from the object (c1) *triggering* the callback: you can get to
++ # c1 from c2, but not vice-versa. The result was that c2's __dict__
++ # got tp_clear'ed by the time the c2.cb callback got invoked.
++
++ class C:
++ def cb(self, ignore):
++ self.me
++ self.c1
++ self.wr
++
++ c1, c2 = C(), C()
++
++ c2.me = c2
++ c2.c1 = c1
++ c2.wr = weakref.ref(c1, c2.cb)
++
++ del c1, c2
++ gc.collect()
++
++ def test_callback_in_cycle_4(self):
++ import gc
++
++ # Like test_callback_in_cycle_3, except c2 and c1 have different
++ # classes. c2's class (C) isn't reachable from c1 then, so protecting
++ # objects reachable from the dying object (c1) isn't enough to stop
++ # c2's class (C) from getting tp_clear'ed before c2.cb is invoked.
++ # The result was a segfault (C.__mro__ was NULL when the callback
++ # tried to look up self.me).
++
++ class C(object):
++ def cb(self, ignore):
++ self.me
++ self.c1
++ self.wr
++
++ class D:
++ pass
++
++ c1, c2 = D(), C()
++
++ c2.me = c2
++ c2.c1 = c1
++ c2.wr = weakref.ref(c1, c2.cb)
++
++ del c1, c2, C, D
++ gc.collect()
++
++ def test_callback_in_cycle_resurrection(self):
++ import gc
++
++ # Do something nasty in a weakref callback: resurrect objects
++ # from dead cycles. For this to be attempted, the weakref and
++ # its callback must also be part of the cyclic trash (else the
++ # objects reachable via the callback couldn't be in cyclic trash
++ # to begin with -- the callback would act like an external root).
++ # But gc clears trash weakrefs with callbacks early now, which
++ # disables the callbacks, so the callbacks shouldn't get called
++ # at all (and so nothing actually gets resurrected).
++
++ alist = []
++ class C(object):
++ def __init__(self, value):
++ self.attribute = value
++
++ def acallback(self, ignore):
++ alist.append(self.c)
++
++ c1, c2 = C(1), C(2)
++ c1.c = c2
++ c2.c = c1
++ c1.wr = weakref.ref(c2, c1.acallback)
++ c2.wr = weakref.ref(c1, c2.acallback)
++
++ def C_went_away(ignore):
++ alist.append("C went away")
++ wr = weakref.ref(C, C_went_away)
++
++ del c1, c2, C # make them all trash
++ self.assertEqual(alist, []) # del isn't enough to reclaim anything
++
++ gc.collect()
++ # c1.wr and c2.wr were part of the cyclic trash, so should have
++ # been cleared without their callbacks executing. OTOH, the weakref
++ # to C is bound to a function local (wr), and wasn't trash, so that
++ # callback should have been invoked when C went away.
++ self.assertEqual(alist, ["C went away"])
++ # The remaining weakref should be dead now (its callback ran).
++ self.assertEqual(wr(), None)
++
++ del alist[:]
++ gc.collect()
++ self.assertEqual(alist, [])
++
++ def test_callbacks_on_callback(self):
++ import gc
++
++ # Set up weakref callbacks *on* weakref callbacks.
++ alist = []
++ def safe_callback(ignore):
++ alist.append("safe_callback called")
++
++ class C(object):
++ def cb(self, ignore):
++ alist.append("cb called")
++
++ c, d = C(), C()
++ c.other = d
++ d.other = c
++ callback = c.cb
++ c.wr = weakref.ref(d, callback) # this won't trigger
++ d.wr = weakref.ref(callback, d.cb) # ditto
++ external_wr = weakref.ref(callback, safe_callback) # but this will
++ self.assert_(external_wr() is callback)
++
++ # The weakrefs attached to c and d should get cleared, so that
++ # C.cb is never called. But external_wr isn't part of the cyclic
++ # trash, and no cyclic trash is reachable from it, so safe_callback
++ # should get invoked when the bound method object callback (c.cb)
++ # -- which is itself a callback, and also part of the cyclic trash --
++ # gets reclaimed at the end of gc.
++
++ del callback, c, d, C
++ self.assertEqual(alist, []) # del isn't enough to clean up cycles
++ gc.collect()
++ self.assertEqual(alist, ["safe_callback called"])
++ self.assertEqual(external_wr(), None)
++
++ del alist[:]
++ gc.collect()
++ self.assertEqual(alist, [])
++
+ class Object:
+ def __init__(self, arg):
+ self.arg = arg
diff --git a/lang/python23-pth/patches/patch-ah b/lang/python23-pth/patches/patch-ah
index ad26b016099..8b882168980 100644
--- a/lang/python23-pth/patches/patch-ah
+++ b/lang/python23-pth/patches/patch-ah
@@ -1,13 +1,22 @@
-$NetBSD: patch-ah,v 1.1.1.1 2003/08/04 08:29:32 drochner Exp $
+$NetBSD: patch-ah,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Include/patchlevel.h.orig 2003-08-03 13:47:59.000000000 +0200
-+++ Include/patchlevel.h 2003-08-03 13:48:20.000000000 +0200
-@@ -26,7 +26,7 @@
- #define PY_RELEASE_SERIAL 0
+--- Makefile.pre.in.orig 2003-09-20 12:50:28.000000000 +0200
++++ Makefile.pre.in
+@@ -56,7 +56,7 @@ MAKESETUP= $(srcdir)/Modules/makese
+ OPT= @OPT@
+ BASECFLAGS= @BASECFLAGS@
+ CFLAGS= $(BASECFLAGS) $(OPT)
+-CPPFLAGS= -I. -I$(srcdir)/Include
++CPPFLAGS+= -I. -I$(srcdir)/Include
+ LDFLAGS= @LDFLAGS@
+ LDLAST= @LDLAST@
+ SGI_ABI= @SGI_ABI@
+@@ -305,7 +305,7 @@ all: $(BUILDPYTHON) oldsharedmods share
+ $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
+ $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
+ Modules/$(MAINOBJ) \
+- $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) ${LINK_ALL_LIBGCC_HACK}
- /* Version as a string */
--#define PY_VERSION "2.3"
-+#define PY_VERSION "2p3"
-
- /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
- Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
+ platform: $(BUILDPYTHON)
+ $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
diff --git a/lang/python23-pth/patches/patch-ai b/lang/python23-pth/patches/patch-ai
index ff91a1097dc..3a38ba3400b 100644
--- a/lang/python23-pth/patches/patch-ai
+++ b/lang/python23-pth/patches/patch-ai
@@ -1,22 +1,21 @@
-$NetBSD: patch-ai,v 1.2 2003/08/06 11:05:27 drochner Exp $
+$NetBSD: patch-ai,v 1.3 2003/12/08 21:13:56 recht Exp $
---- Makefile.pre.in.orig 2003-07-13 12:10:42.000000000 +0200
-+++ Makefile.pre.in 2003-08-06 12:53:27.000000000 +0200
-@@ -56,7 +56,7 @@
- OPT= @OPT@
- BASECFLAGS= @BASECFLAGS@
- CFLAGS= $(BASECFLAGS) $(OPT)
--CPPFLAGS= -I. -I$(srcdir)/Include
-+CPPFLAGS+= -I. -I$(srcdir)/Include
- LDFLAGS= @LDFLAGS@
- LDLAST= @LDLAST@
- SGI_ABI= @SGI_ABI@
-@@ -305,7 +305,7 @@
- $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
- $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
- Modules/$(MAINOBJ) \
-- $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
-+ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) ${LINK_ALL_LIBGCC_HACK}
+--- Modules/_sre.c.orig 2003-06-26 16:41:08.000000000 +0200
++++ Modules/_sre.c
+@@ -71,9 +71,14 @@ static char copyright[] =
+ Win64 (MS_WIN64), Linux64 (__LP64__), Monterey (64-bit AIX) (_LP64) */
+ /* FIXME: maybe the limit should be 40000 / sizeof(void*) ? */
+ #define USE_RECURSION_LIMIT 7500
+-#else
- platform: $(BUILDPYTHON)
- $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+-#if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__)
++#elif defined(__FreeBSD__)
++/* FreeBSD/amd64 and /sparc64 requires even smaller limit */
++#if defined(__amd64__)
++#define USE_RECURSION_LIMIT 6000
++#elif defined(__sparc64__)
++#define USE_RECURSION_LIMIT 3000
++#elif defined(__GNUC__) && defined(WITH_THREAD)
+ /* the pthreads library on FreeBSD has a fixed 1MB stack size for the
+ * initial (or "primary") thread, which is insufficient for the default
+ * recursion limit. gcc 3.x at the default optimisation
diff --git a/lang/python23-pth/patches/patch-aj b/lang/python23-pth/patches/patch-aj
index a699fc51a4f..19948262988 100644
--- a/lang/python23-pth/patches/patch-aj
+++ b/lang/python23-pth/patches/patch-aj
@@ -1,13 +1,198 @@
-$NetBSD: patch-aj,v 1.1.1.1 2003/08/04 08:29:32 drochner Exp $
+$NetBSD: patch-aj,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Lib/distutils/command/build_scripts.py.orig 2003-08-03 12:32:35.000000000 +0200
-+++ Lib/distutils/command/build_scripts.py 2003-08-03 12:34:50.000000000 +0200
-@@ -99,7 +99,7 @@
- outf.write("#!%s%s\n" %
- (os.path.join(
- sysconfig.get_config_var("BINDIR"),
-- "python" + sysconfig.get_config_var("EXE")),
-+ "python2p3" + sysconfig.get_config_var("EXE")),
- post_interp))
- outf.writelines(f.readlines())
- outf.close()
+--- Modules/gcmodule.c.orig 2003-04-17 19:29:21.000000000 +0200
++++ Modules/gcmodule.c
+@@ -377,13 +377,17 @@ has_finalizer(PyObject *op)
+ return 0;
+ }
+
+-/* Move the objects in unreachable with __del__ methods into finalizers.
+- * The objects remaining in unreachable do not have __del__ methods, and
+- * gc_refs remains GC_TENTATIVELY_UNREACHABLE for them. The objects
+- * moved into finalizers have gc_refs changed to GC_REACHABLE.
++/* Move the objects in unreachable with __del__ methods into finalizers,
++ * and weakrefs with callbacks into wr_callbacks.
++ * The objects remaining in unreachable do not have __del__ methods, and are
++ * not weakrefs with callbacks.
++ * The objects moved have gc_refs changed to GC_REACHABLE; the objects
++ * remaining in unreachable are left at GC_TENTATIVELY_UNREACHABLE.
+ */
+ static void
+-move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
++move_troublemakers(PyGC_Head *unreachable,
++ PyGC_Head *finalizers,
++ PyGC_Head *wr_callbacks)
+ {
+ PyGC_Head *gc = unreachable->gc.gc_next;
+
+@@ -398,6 +402,12 @@ move_finalizers(PyGC_Head *unreachable,
+ gc_list_append(gc, finalizers);
+ gc->gc.gc_refs = GC_REACHABLE;
+ }
++ else if (PyWeakref_Check(op) &&
++ ((PyWeakReference *)op)->wr_callback) {
++ gc_list_remove(gc);
++ gc_list_append(gc, wr_callbacks);
++ gc->gc.gc_refs = GC_REACHABLE;
++ }
+ gc = next;
+ }
+ }
+@@ -434,6 +444,93 @@ move_finalizer_reachable(PyGC_Head *fina
+ }
+ }
+
++/* Clear all trash weakrefs with callbacks. This clears weakrefs first,
++ * which has the happy result of disabling the callbacks without executing
++ * them. A nasty technical complication: a weakref callback can itself be
++ * the target of a weakref, in which case decrefing the callback can cause
++ * another callback to trigger. But we can't allow arbitrary Python code to
++ * get executed at this point (the callback on the callback may try to muck
++ * with other cyclic trash we're trying to collect, even resurrecting it
++ * while we're in the middle of doing tp_clear() on the trash).
++ *
++ * The private _PyWeakref_ClearRef() function exists so that we can clear
++ * the reference in a weakref without triggering a callback on the callback.
++ *
++ * We have to save the callback objects and decref them later. But we can't
++ * allocate new memory to save them (if we can't get new memory, we're dead).
++ * So we grab a new reference on the clear'ed weakref, which prevents the
++ * rest of gc from reclaiming it. _PyWeakref_ClearRef() leaves the
++ * weakref's wr_callback member intact.
++ *
++ * In the end, then, wr_callbacks consists of cleared weakrefs that are
++ * immune from collection. Near the end of gc, after collecting all the
++ * cyclic trash, we call release_weakrefs(). That releases our references
++ * to the cleared weakrefs, which in turn may trigger callbacks on their
++ * callbacks.
++ */
++static void
++clear_weakrefs(PyGC_Head *wr_callbacks)
++{
++ PyGC_Head *gc = wr_callbacks->gc.gc_next;
++
++ for (; gc != wr_callbacks; gc = gc->gc.gc_next) {
++ PyObject *op = FROM_GC(gc);
++ PyWeakReference *wr;
++
++ assert(IS_REACHABLE(op));
++ assert(PyWeakref_Check(op));
++ wr = (PyWeakReference *)op;
++ assert(wr->wr_callback != NULL);
++ Py_INCREF(op);
++ _PyWeakref_ClearRef(wr);
++ }
++}
++
++/* Called near the end of gc. This gives up the references we own to
++ * cleared weakrefs, allowing them to get collected, and in turn decref'ing
++ * their callbacks.
++ *
++ * If a callback object is itself the target of a weakref callback,
++ * decref'ing the callback object may trigger that other callback. If
++ * that other callback was part of the cyclic trash in this generation,
++ * that won't happen, since we cleared *all* trash-weakref callbacks near
++ * the start of gc. If that other callback was not part of the cyclic trash
++ * in this generation, then it acted like an external root to this round
++ * of gc, so all the objects reachable from that callback are still alive.
++ *
++ * Giving up the references to the weakref objects will probably make
++ * them go away too. However, if a weakref is reachable from finalizers,
++ * it won't go away. We move it to the old generation then. Since a
++ * weakref object doesn't have a finalizer, that's the right thing to do (it
++ * doesn't belong in gc.garbage).
++ *
++ * We return the number of weakref objects freed (those not appended to old).
++ */
++static int
++release_weakrefs(PyGC_Head *wr_callbacks, PyGC_Head *old)
++{
++ int num_freed = 0;
++
++ while (! gc_list_is_empty(wr_callbacks)) {
++ PyGC_Head *gc = wr_callbacks->gc.gc_next;
++ PyObject *op = FROM_GC(gc);
++ PyWeakReference *wr = (PyWeakReference *)op;
++
++ assert(IS_REACHABLE(op));
++ assert(PyWeakref_Check(op));
++ assert(wr->wr_callback != NULL);
++ Py_DECREF(op);
++ if (wr_callbacks->gc.gc_next == gc) {
++ /* object is still alive -- move it */
++ gc_list_remove(gc);
++ gc_list_append(gc, old);
++ }
++ else
++ ++num_freed;
++ }
++ return num_freed;
++}
++
+ static void
+ debug_instance(char *msg, PyInstanceObject *inst)
+ {
+@@ -535,8 +632,9 @@ collect(int generation)
+ long n = 0; /* # unreachable objects that couldn't be collected */
+ PyGC_Head *young; /* the generation we are examining */
+ PyGC_Head *old; /* next older generation */
+- PyGC_Head unreachable;
+- PyGC_Head finalizers;
++ PyGC_Head unreachable; /* non-problematic unreachable trash */
++ PyGC_Head finalizers; /* objects with, & reachable from, __del__ */
++ PyGC_Head wr_callbacks; /* weakrefs with callbacks */
+ PyGC_Head *gc;
+
+ if (delstr == NULL) {
+@@ -597,20 +695,33 @@ collect(int generation)
+ /* All objects in unreachable are trash, but objects reachable from
+ * finalizers can't safely be deleted. Python programmers should take
+ * care not to create such things. For Python, finalizers means
+- * instance objects with __del__ methods.
++ * instance objects with __del__ methods. Weakrefs with callbacks
++ * can call arbitrary Python code, so those are special-cased too.
+ *
+- * Move unreachable objects with finalizers into a different list.
++ * Move unreachable objects with finalizers, and weakrefs with
++ * callbacks, into different lists.
+ */
+ gc_list_init(&finalizers);
+- move_finalizers(&unreachable, &finalizers);
++ gc_list_init(&wr_callbacks);
++ move_troublemakers(&unreachable, &finalizers, &wr_callbacks);
++ /* Clear the trash weakrefs with callbacks. This prevents their
++ * callbacks from getting invoked (when a weakref goes away, so does
++ * its callback).
++ * We do this even if the weakrefs are reachable from finalizers.
++ * If we didn't, breaking cycles in unreachable later could trigger
++ * deallocation of objects in finalizers, which could in turn
++ * cause callbacks to trigger. This may not be ideal behavior.
++ */
++ clear_weakrefs(&wr_callbacks);
+ /* finalizers contains the unreachable objects with a finalizer;
+- * unreachable objects reachable only *from* those are also
+- * uncollectable, and we move those into the finalizers list too.
++ * unreachable objects reachable *from* those are also uncollectable,
++ * and we move those into the finalizers list too.
+ */
+ move_finalizer_reachable(&finalizers);
+
+ /* Collect statistics on collectable objects found and print
+- * debugging information. */
++ * debugging information.
++ */
+ for (gc = unreachable.gc.gc_next; gc != &unreachable;
+ gc = gc->gc.gc_next) {
+ m++;
+@@ -624,6 +735,11 @@ collect(int generation)
+ */
+ delete_garbage(&unreachable, old);
+
++ /* Now that we're done analyzing stuff and breaking cycles, let
++ * delayed weakref callbacks run.
++ */
++ m += release_weakrefs(&wr_callbacks, old);
++
+ /* Collect statistics on uncollectable objects found and print
+ * debugging information. */
+ for (gc = finalizers.gc.gc_next;
diff --git a/lang/python23-pth/patches/patch-ak b/lang/python23-pth/patches/patch-ak
index af3c5caeced..f1bbd32e9fc 100644
--- a/lang/python23-pth/patches/patch-ak
+++ b/lang/python23-pth/patches/patch-ak
@@ -1,12 +1,68 @@
-$NetBSD: patch-ak,v 1.1 2003/08/06 11:38:11 drochner Exp $
+$NetBSD: patch-ak,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Python/thread.c.orig 2003-04-19 17:41:53.000000000 +0200
-+++ Python/thread.c 2003-07-30 20:27:45.000000000 +0200
-@@ -98,6 +98,7 @@
+--- Objects/weakrefobject.c.orig 2003-07-14 23:46:23.000000000 +0200
++++ Objects/weakrefobject.c
+@@ -53,17 +53,43 @@ clear_weakref(PyWeakReference *self)
+ if (*list == self)
+ *list = self->wr_next;
+ self->wr_object = Py_None;
+- self->wr_callback = NULL;
+ if (self->wr_prev != NULL)
+ self->wr_prev->wr_next = self->wr_next;
+ if (self->wr_next != NULL)
+ self->wr_next->wr_prev = self->wr_prev;
+ self->wr_prev = NULL;
+ self->wr_next = NULL;
+- Py_XDECREF(callback);
++ }
++ if (callback != NULL) {
++ Py_DECREF(callback);
++ self->wr_callback = NULL;
+ }
+ }
- #ifdef HAVE_PTH
- #include "thread_pth.h"
-+#undef _POSIX_THREADS
- #endif
++/* Cyclic gc uses this to *just* clear the passed-in reference, leaving
++ * the callback intact and uncalled. It must be possible to call self's
++ * tp_dealloc() after calling this, so self has to be left in a sane enough
++ * state for that to work. We expect tp_dealloc to decref the callback
++ * then. The reason for not letting clear_weakref() decref the callback
++ * right now is that if the callback goes away, that may in turn trigger
++ * another callback (if a weak reference to the callback exists) -- running
++ * arbitrary Python code in the middle of gc is a disaster. The convolution
++ * here allows gc to delay triggering such callbacks until the world is in
++ * a sane state again.
++ */
++void
++_PyWeakref_ClearRef(PyWeakReference *self)
++{
++ PyObject *callback;
++
++ assert(self != NULL);
++ assert(PyWeakref_Check(self));
++ /* Preserve and restore the callback around clear_weakref. */
++ callback = self->wr_callback;
++ self->wr_callback = NULL;
++ clear_weakref(self);
++ self->wr_callback = callback;
++}
- #ifdef _POSIX_THREADS
+ static void
+ weakref_dealloc(PyWeakReference *self)
+@@ -117,7 +143,7 @@ weakref_hash(PyWeakReference *self)
+ self->hash = PyObject_Hash(PyWeakref_GET_OBJECT(self));
+ return self->hash;
+ }
+-
++
+
+ static PyObject *
+ weakref_repr(PyWeakReference *self)
+@@ -324,7 +350,7 @@ WRAP_BINARY(proxy_iand, PyNumber_InPlace
+ WRAP_BINARY(proxy_ixor, PyNumber_InPlaceXor)
+ WRAP_BINARY(proxy_ior, PyNumber_InPlaceOr)
+
+-static int
++static int
+ proxy_nonzero(PyWeakReference *proxy)
+ {
+ PyObject *o = PyWeakref_GET_OBJECT(proxy);
diff --git a/lang/python23-pth/patches/patch-al b/lang/python23-pth/patches/patch-al
index 8c3c21b987d..e398096195a 100644
--- a/lang/python23-pth/patches/patch-al
+++ b/lang/python23-pth/patches/patch-al
@@ -1,45 +1,30 @@
-$NetBSD: patch-al,v 1.3 2003/09/10 00:11:04 recht Exp $
+$NetBSD: patch-al,v 1.4 2003/12/08 21:13:56 recht Exp $
---- pyconfig.h.in.orig 2003-07-22 17:20:49.000000000 +0200
-+++ pyconfig.h.in 2003-09-10 01:01:29.000000000 +0200
-@@ -835,6 +835,13 @@
- /* Define _OSF_SOURCE to get the makedev macro. */
- #undef _OSF_SOURCE
+--- configure.orig 2003-09-27 10:58:55.000000000 +0200
++++ configure
+@@ -1318,7 +1318,7 @@ rm confdefs.h
+ mv confdefs.h.new confdefs.h
-+/* These defines disable needed library functions on NetBSD < 1.6T */
-+/* ( _NETBSD_SOURCE doesn't exist prior to 1.6T ) */
-+#if defined(__NetBSD__)
-+#include <sys/param.h>
-+#endif
-+#if !defined(__NetBSD__) || __NetBSD_Version__ > 106200000
-+
- /* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
- #undef _POSIX_1_SOURCE
-@@ -845,18 +852,20 @@
- /* Define to 1 if you need to in order for `stat' and other things to work. */
- #undef _POSIX_SOURCE
--/* Define if you have POSIX threads, and your system does not define that. */
--#undef _POSIX_THREADS
--
--/* Define to force use of thread-safe errno, h_errno, and other functions */
--#undef _REENTRANT
--
- /* Define to the level of X/Open that your system supports */
- #undef _XOPEN_SOURCE
+-VERSION=2.3
++VERSION=2p3
- /* Define to activate Unix95-and-earlier features */
- #undef _XOPEN_SOURCE_EXTENDED
-+#endif /* __NetBSD_Version__ */
-+
-+/* Define if you have POSIX threads, and your system does not define that. */
-+#undef _POSIX_THREADS
-+
-+/* Define to force use of thread-safe errno, h_errno, and other functions */
-+#undef _REENTRANT
-+
- /* Define on FreeBSD to activate all library features */
- #undef __BSD_VISIBLE
+ SOVERSION=1.0
+@@ -1440,6 +1440,8 @@ case $ac_sys_system/$ac_sys_release in
+ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm.
+ OpenBSD/2.* | OpenBSD/3.[0123])
+ define_xopen_source=no;;
++ NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S])
++ define_xopen_source=no;;
+ # On Solaris 2.6, sys/wait.h is inconsistent in the usage
+ # of union __?sigval. Reported by Stuart Bishop.
+ SunOS/5.6)
+@@ -13837,6 +13839,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+ #include "confdefs.h"
++#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
diff --git a/lang/python23-pth/patches/patch-am b/lang/python23-pth/patches/patch-am
index f268a4e040b..7b1d469da24 100644
--- a/lang/python23-pth/patches/patch-am
+++ b/lang/python23-pth/patches/patch-am
@@ -1,26 +1,121 @@
-$NetBSD: patch-am,v 1.1 2003/09/14 14:04:32 recht Exp $
+$NetBSD: patch-am,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Include/py_curses.h.orig 2003-09-14 13:55:07.000000000 +0200
-+++ Include/py_curses.h 2003-09-14 14:10:49.000000000 +0200
-@@ -39,6 +39,21 @@
- #endif
- #endif
-
-+#ifdef __NetBSD__
-+/*
-+** On NetBSD, [n]curses.h and stdlib.h/wchar.h use different guards
-+** against multiple definition of wchar_t and wint_t.
-+*/
-+#ifdef _XOPEN_SOURCE_EXTENDED
-+#ifndef _WCHAR_T
-+#define _WCHAR_T
-+#endif
-+#ifndef _WINT_T
-+#define _WINT_T
-+#endif
-+#endif
-+#endif
-+
- #ifdef HAVE_NCURSES_H
- #include <ncurses.h>
- #else
+--- setup.py.orig 2003-09-22 03:19:45.000000000 +0200
++++ setup.py
+@@ -15,7 +15,7 @@ from distutils.command.install import in
+ from distutils.command.install_lib import install_lib
+
+ # This global variable is used to hold the list of modules to be disabled.
+-disabled_module_list = []
++disabled_module_list = ["_bsddb", "_curses", "_curses_panel", "_tkinter", "gdbm", "mpz", "pyexpat", "readline"]
+
+ def add_dir_to_list(dirlist, dir):
+ """Add the directory 'dir' to the list 'dirlist' (at the front) if
+@@ -240,9 +240,15 @@ class PyBuildExt(build_ext):
+ return sys.platform
+
+ def detect_modules(self):
+- # Ensure that /usr/local is always used
+- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++ # Add the buildlink directories for pkgsrc
++ if os.environ.has_key('BUILDLINK_DIR'):
++ dir = os.environ['BUILDLINK_DIR']
++ libdir = dir + '/lib'
++ incdir = dir + '/include'
++ if libdir not in self.compiler.library_dirs:
++ self.compiler.library_dirs.insert(0, libdir)
++ if incdir not in self.compiler.include_dirs:
++ self.compiler.include_dirs.insert(0, incdir)
+
+ # fink installs lots of goodies in /sw/... - make sure we
+ # check there
+@@ -436,9 +442,7 @@ class PyBuildExt(build_ext):
+ depends = ['socketmodule.h']) )
+ # Detect SSL support for the socket module (via _ssl)
+ ssl_incs = find_file('openssl/ssl.h', inc_dirs,
+- ['/usr/local/ssl/include',
+- '/usr/contrib/ssl/include/'
+- ]
++ []
+ )
+ if ssl_incs is not None:
+ krb5_h = find_file('krb5.h', inc_dirs,
+@@ -446,9 +450,7 @@ class PyBuildExt(build_ext):
+ if krb5_h:
+ ssl_incs += krb5_h
+ ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+- ['/usr/local/ssl/lib',
+- '/usr/contrib/ssl/lib/'
+- ] )
++ [] )
+
+ if (ssl_incs is not None and
+ ssl_libs is not None):
+@@ -562,9 +564,11 @@ class PyBuildExt(build_ext):
+ include_dirs=db_incs,
+ libraries=dblibs))
+ else:
+- db_incs = None
+- dblibs = []
+- dblib_dir = None
++ db_incs =['%%DB185_INCS%%']
++ dblibs = ['%%DB185_LIBS%%']
++ dblib_dir = ['%%DB185_LIBDIR%%']
++ if len(dblibs) > 0 and dblibs[0] == '':
++ dblibs = []
+
+
+ # Look for Berkeley db 1.85. Note that it is built as a different
+@@ -573,21 +577,30 @@ class PyBuildExt(build_ext):
+ # accidentally building this module with a later version of the
+ # underlying db library. May BSD-ish Unixes incorporate db 1.85
+ # symbols into libc and place the include file in /usr/include.
+- f = "/usr/include/db.h"
++ f = "%%DB185_H%%"
+ if os.path.exists(f):
+ data = open(f).read()
+ m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
+ if m is not None:
++ bsddb185_define_macros = []
++ if f.split("/")[-1] == "db_185.h":
++ bsddb185_define_macros=[('HAVE_DB_185_H',1)]
+ # bingo - old version used hash file format version 2
+ ### XXX this should be fixed to not be platform-dependent
+ ### but I don't have direct access to an osf1 platform and
+ ### seemed to be muffing the search somehow
+- libraries = platform == "osf1" and ['db'] or None
++ #libraries = platform == "osf1" and ['db'] or None
++ libraries = dblibs
+ if libraries is not None:
+ exts.append(Extension('bsddb185', ['bsddbmodule.c'],
++ library_dirs=dblib_dir,
++ runtime_library_dirs=dblib_dir,
++ include_dirs=db_incs,
++ define_macros=bsddb185_define_macros,
+ libraries=libraries))
+ else:
+- exts.append(Extension('bsddb185', ['bsddbmodule.c']))
++ exts.append(Extension('bsddb185', ['bsddbmodule.c'],
++ define_macros=bsddb185_define_macros))
+
+ # The standard Unix dbm module:
+ if platform not in ['cygwin']:
+@@ -765,7 +778,7 @@ class PyBuildExt(build_ext):
+ # Linux-specific modules
+ exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
+
+- if platform in ('linux2', 'freebsd4'):
++ if platform in ('linux2', 'freebsd4', 'freebsd5'):
+ exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
+
+ if platform == 'sunos5':
+@@ -1135,7 +1148,7 @@ def main():
+ ext_modules=[Extension('struct', ['structmodule.c'])],
+
+ # Scripts to install
+- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle']
++ scripts = ['Tools/scripts/pydoc2p3']
+ )
+
+ # --install-platlib
diff --git a/lang/python23-pth/patches/patch-ba b/lang/python23-pth/patches/patch-ba
deleted file mode 100644
index 8b4b3c6f6b7..00000000000
--- a/lang/python23-pth/patches/patch-ba
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD: patch-ba,v 1.1 2003/08/06 11:38:11 drochner Exp $
-
---- Python/thread_pth.h.orig 2002-01-19 23:02:55.000000000 +0100
-+++ Python/thread_pth.h 2003-08-02 15:26:12.000000000 +0200
-@@ -30,6 +30,8 @@
-
- #define CHECK_STATUS(name) if (status == -1) { printf("%d ", status); perror(name); error = 1; }
-
-+pth_attr_t PyThread_attr;
-+
- /*
- * Initialization.
- */
-@@ -37,6 +39,9 @@
- static void PyThread__init_thread(void)
- {
- pth_init();
-+ PyThread_attr = pth_attr_new();
-+ pth_attr_set(PyThread_attr, PTH_ATTR_STACK_SIZE, 1<<18);
-+ pth_attr_set(PyThread_attr, PTH_ATTR_JOINABLE, FALSE);
- }
-
- /*
-@@ -51,7 +56,7 @@
- if (!initialized)
- PyThread_init_thread();
-
-- th = pth_spawn(PTH_ATTR_DEFAULT,
-+ th = pth_spawn(PyThread_attr,
- (void* (*)(void *))func,
- (void *)arg
- );
diff --git a/lang/python23-pth/patches/patch-bc b/lang/python23-pth/patches/patch-bc
deleted file mode 100644
index 5314c647014..00000000000
--- a/lang/python23-pth/patches/patch-bc
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD: patch-bc,v 1.1 2003/09/10 00:11:04 recht Exp $
-
---- configure.orig Thu Jul 24 00:17:27 2003
-+++ configure
-@@ -1365,6 +1365,8 @@ case $ac_sys_system/$ac_sys_release in
- # Reconfirmed for OpenBSD 3.3 by Zachary Hamm.
- OpenBSD/2.* | OpenBSD/3.[0123])
- define_xopen_source=no;;
-+ NetBSD/1.5 | NetBSD/1.5.*)
-+ define_xopen_source=no;;
- # On Solaris 2.6, sys/wait.h is inconsistent in the usage
- # of union __?sigval. Reported by Stuart Bishop.
- SunOS/5.6)
-@@ -13079,6 +13081,7 @@ cat >conftest.$ac_ext <<_ACEOF
- #include "confdefs.h"
-
- #include "confdefs.h"
-+#include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
diff --git a/lang/python23/Makefile b/lang/python23/Makefile
index 74f37562f48..79de7d23e09 100644
--- a/lang/python23/Makefile
+++ b/lang/python23/Makefile
@@ -1,36 +1,30 @@
-# $NetBSD: Makefile,v 1.10 2003/11/17 00:11:44 recht Exp $
+# $NetBSD: Makefile,v 1.11 2003/12/08 21:13:56 recht Exp $
#
-DISTNAME= Python-2.3
-PKGNAME= python23-2.3
-PKGREVISION= 3
+DISTNAME= Python-2.3.2
+PKGNAME= python23-2.3.2
CATEGORIES= lang
-MASTER_SITES= ftp://ftp.python.org/pub/python/2.3/
+MASTER_SITES= ftp://ftp.python.org/pub/python/2.3.2/
EXTRACT_SUFX= .tgz
MAINTAINER= recht@NetBSD.org
HOMEPAGE= http://www.python.org/
COMMENT= Interpreted, interactive, object-oriented programming language
-USE_BUILDLINK2= YES
-GNU_CONFIGURE= YES
-
+USE_DB185= yes
+USE_BUILDLINK2= yes
+GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --without-threads
CONFIGURE_ARGS+= --enable-shared
CONFIGURE_ARGS+= OPT="${CFLAGS}"
-# XXX configure would pull in libpthread
-CONFIGURE_ENV+= ac_cv_search_sem_init=no
+UNLIMIT_RESOURCES+= stacksize
INSTALL_TARGET= altinstall
+TEST_TARGET= test
post-extract:
${MV} ${WRKSRC}/Tools/scripts/pydoc ${WRKSRC}/Tools/scripts/pydoc2.3
-# XXX should be done by the Python install process
-post-install:
- ${LN} -s ${PREFIX}/lib/libpython2.3.so.1.0 \
- ${PREFIX}/lib/libpython2.3.so
-
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "SunOS"
@@ -38,10 +32,11 @@ LOWER_OPSYS= sunos
.endif
.if ${OPSYS} == "Darwin" || ${OPSYS} == "IRIX"
-PLIST_SUBST+= PY_PLATNAME=${LOWER_OPSYS}
+PY_PLATNAME=${LOWER_OPSYS}
.else
-PLIST_SUBST+= PY_PLATNAME=${LOWER_OPSYS}${OS_VERSION:C/\..*//}
+PY_PLATNAME=${LOWER_OPSYS}${OS_VERSION:C/\..*//}
.endif
+PLIST_SUBST+= PY_PLATNAME=${PY_PLATNAME}
# the dl module isn't built for 64 bit archs and Darwin
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" \
@@ -52,12 +47,53 @@ PLIST_SUBST+= DLMODULE="@comment "
PLIST_SUBST+= DLMODULE=
.endif
-.if ${OPSYS} != "NetBSD"
+X86_SUBST= "@comment "
+OSSAUDIODEV_SUBST= "@comment "
+.if ${MACHINE_ARCH} == "i386"
+# activate X86_ONLY modules
+X86_SUBST=
+# ossaudiodev is only available on x86 for the following platforms
+.if ${PY_PLATNAME} == "linux2" || ${PY_PLATNAME} == "freebsd4" \
+ || ${PY_PLATNAME} == "freebsd5"
+OSSAUDIODEV_SUBST=
+.endif
+.endif
+PLIST_SUBST+= X86_ONLY=${X86_SUBST}
+PLIST_SUBST+= OSSAUDIODEV=${OSSAUDIODEV_SUBST}
+
+# ensure that the bsddb185 module is build on all platforms
.include "../../databases/db/buildlink2.mk"
-CPPFLAGS+= -I${BUILDLINK_PREFIX.db}/include/db2
+
+SUBST_CLASSES+= setup
+SUBST_MESSAGE.setup= "Fixing paths for db 1.85."
+SUBST_STAGE.setup= post-patch
+SUBST_FILES.setup= setup.py
+SUBST_SED.setup= -e 's,%%DB185_H%%,${DB185_H},g'
+SUBST_SED.setup+= -e 's,%%DB185_INCS%%,${DB185_INCS},g'
+SUBST_SED.setup+= -e 's,%%DB185_LIBS%%,${DB185_LIBS},g'
+SUBST_SED.setup+= -e 's,%%DB185_LIBDIR%%,${DB185_LIBDIR},g'
+
+DB185_LIBDIR= ${BUILDLINK_PREFIX.db}/lib
+
+.if !empty(BUILDLINK_CPPFLAGS.db)
+LDFLAGS+= ${BUILDLINK_LDFLAGS.db}
+DBINCDIR= ${BUILDLINK_CPPFLAGS.db:S/-I//}
+DB185_INCS= ${DBINCDIR}
+DB185_LIBS= ${BUILDLINK_LIBS.db:S/-l//}
+
+.if ${_NEED_DB2} == "YES"
+DB185_H= ${DBINCDIR}/db_185.h
+.else
+DB185_H= ${DBINCDIR}/db.h
+.endif
+.else
+DB185_H= /usr/include/db.h
+DB185_INCS= /usr/include
+DB185_LIBS=
.endif
.include "../../archivers/bzip2/buildlink2.mk"
.include "../../devel/zlib/buildlink2.mk"
.include "../../security/openssl/buildlink2.mk"
+.include "../../mk/ossaudio.buildlink2.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/lang/python23/PLIST.Linux b/lang/python23/PLIST.Linux
index 1a60128f0b6..6002dd3a49a 100644
--- a/lang/python23/PLIST.Linux
+++ b/lang/python23/PLIST.Linux
@@ -1,7 +1,5 @@
-@comment $NetBSD: PLIST.Linux,v 1.1 2003/08/18 20:57:12 recht Exp $
-lib/python2.3/lib-dynload/_bsddb.so
+@comment $NetBSD: PLIST.Linux,v 1.2 2003/12/08 21:13:56 recht Exp $
lib/python2.3/lib-dynload/${LOWER_OPSYS}audiodev.so
-lib/python2.3/lib-dynload/ossaudiodev.so
lib/python2.3/plat-${LOWER_OPSYS}2/CDROM.py
lib/python2.3/plat-${LOWER_OPSYS}2/CDROM.pyc
lib/python2.3/plat-${LOWER_OPSYS}2/CDROM.pyo
@@ -11,7 +9,3 @@ lib/python2.3/plat-${LOWER_OPSYS}2/DLFCN.pyo
lib/python2.3/plat-${LOWER_OPSYS}2/TYPES.py
lib/python2.3/plat-${LOWER_OPSYS}2/TYPES.pyc
lib/python2.3/plat-${LOWER_OPSYS}2/TYPES.pyo
-lib/python2.3/test/output/test_${LOWER_OPSYS}audiodev
-lib/python2.3/test/test_${LOWER_OPSYS}audiodev.py
-lib/python2.3/test/test_${LOWER_OPSYS}audiodev.pyc
-lib/python2.3/test/test_${LOWER_OPSYS}audiodev.pyo
diff --git a/lang/python23/PLIST.NetBSD b/lang/python23/PLIST.NetBSD
index cf4849aeff2..b0dfcf24409 100644
--- a/lang/python23/PLIST.NetBSD
+++ b/lang/python23/PLIST.NetBSD
@@ -1,6 +1 @@
-@comment $NetBSD: PLIST.NetBSD,v 1.1 2003/08/18 20:57:12 recht Exp $
-lib/python2.3/lib-dynload/bsddb185.so
-lib/python2.3/test/output/test_linuxaudiodev
-lib/python2.3/test/test_linuxaudiodev.py
-lib/python2.3/test/test_linuxaudiodev.pyc
-lib/python2.3/test/test_linuxaudiodev.pyo
+@comment $NetBSD: PLIST.NetBSD,v 1.2 2003/12/08 21:13:56 recht Exp $
diff --git a/lang/python23/PLIST.common b/lang/python23/PLIST.common
index f650c4e86fd..037be53cad9 100644
--- a/lang/python23/PLIST.common
+++ b/lang/python23/PLIST.common
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST.common,v 1.2 2003/11/17 00:11:44 recht Exp $
+@comment $NetBSD: PLIST.common,v 1.3 2003/12/08 21:13:56 recht Exp $
bin/pydoc2.3
bin/python2.3
include/python2.3/Python.h
@@ -1125,7 +1125,9 @@ lib/python2.3/lib-dynload/_ssl.so
lib/python2.3/lib-dynload/_testcapi.so
lib/python2.3/lib-dynload/_weakref.so
lib/python2.3/lib-dynload/array.so
+${X86_ONLY}lib/python2.3/lib-dynload/audioop.so
lib/python2.3/lib-dynload/binascii.so
+lib/python2.3/lib-dynload/bsddb185.so
lib/python2.3/lib-dynload/bz2.so
lib/python2.3/lib-dynload/cPickle.so
lib/python2.3/lib-dynload/cStringIO.so
@@ -1136,6 +1138,7 @@ lib/python2.3/lib-dynload/dbm.so
${DLMODULE}lib/python2.3/lib-dynload/dl.so
lib/python2.3/lib-dynload/fcntl.so
lib/python2.3/lib-dynload/grp.so
+${X86_ONLY}lib/python2.3/lib-dynload/imageop.so
lib/python2.3/lib-dynload/itertools.so
lib/python2.3/lib-dynload/math.so
lib/python2.3/lib-dynload/md5.so
@@ -1147,6 +1150,8 @@ lib/python2.3/lib-dynload/pcre.so
lib/python2.3/lib-dynload/pwd.so
lib/python2.3/lib-dynload/regex.so
lib/python2.3/lib-dynload/resource.so
+${X86_ONLY}lib/python2.3/lib-dynload/rgbimg.so
+${OSSAUDIODEV}lib/python2.3/lib-dynload/ossaudiodev.so
lib/python2.3/lib-dynload/rotor.so
lib/python2.3/lib-dynload/select.so
lib/python2.3/lib-dynload/sha.so
@@ -1361,13 +1366,13 @@ lib/python2.3/pickletools.pyo
lib/python2.3/pipes.py
lib/python2.3/pipes.pyc
lib/python2.3/pipes.pyo
+lib/python2.3/pkgutil.py
+lib/python2.3/pkgutil.pyc
+lib/python2.3/pkgutil.pyo
lib/python2.3/plat-${PY_PLATNAME}/IN.py
lib/python2.3/plat-${PY_PLATNAME}/IN.pyc
lib/python2.3/plat-${PY_PLATNAME}/IN.pyo
lib/python2.3/plat-${PY_PLATNAME}/regen
-lib/python2.3/pkgutil.py
-lib/python2.3/pkgutil.pyc
-lib/python2.3/pkgutil.pyo
lib/python2.3/platform.py
lib/python2.3/platform.pyc
lib/python2.3/platform.pyo
@@ -1564,6 +1569,7 @@ lib/python2.3/test/output/test_future
lib/python2.3/test/output/test_global
lib/python2.3/test/output/test_grammar
lib/python2.3/test/output/test_httplib
+lib/python2.3/test/output/test_linuxaudiodev
lib/python2.3/test/output/test_logging
lib/python2.3/test/output/test_longexp
lib/python2.3/test/output/test_math
@@ -1980,6 +1986,9 @@ lib/python2.3/test/test_itertools.pyo
lib/python2.3/test/test_largefile.py
lib/python2.3/test/test_largefile.pyc
lib/python2.3/test/test_largefile.pyo
+lib/python2.3/test/test_linuxaudiodev.py
+lib/python2.3/test/test_linuxaudiodev.pyc
+lib/python2.3/test/test_linuxaudiodev.pyo
lib/python2.3/test/test_locale.py
lib/python2.3/test/test_locale.pyc
lib/python2.3/test/test_locale.pyo
diff --git a/lang/python23/PLIST.common_end b/lang/python23/PLIST.common_end
index 2614128010b..7a1430bf5c7 100644
--- a/lang/python23/PLIST.common_end
+++ b/lang/python23/PLIST.common_end
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST.common_end,v 1.1 2003/08/18 20:57:12 recht Exp $
+@comment $NetBSD: PLIST.common_end,v 1.2 2003/12/08 21:13:56 recht Exp $
@dirrm lib/python2.3/xml/sax
@dirrm lib/python2.3/xml/parsers
@dirrm lib/python2.3/xml/dom
diff --git a/lang/python23/distinfo b/lang/python23/distinfo
index 9a8193a506c..c75a3566e01 100644
--- a/lang/python23/distinfo
+++ b/lang/python23/distinfo
@@ -1,12 +1,16 @@
-$NetBSD: distinfo,v 1.7 2003/09/14 14:04:31 recht Exp $
+$NetBSD: distinfo,v 1.8 2003/12/08 21:13:56 recht Exp $
-SHA1 (Python-2.3.tgz) = ce5fbde09be17ea5dddd4baa62d2b90e06e7e5c1
-Size (Python-2.3.tgz) = 8436880 bytes
-SHA1 (patch-aa) = 235ddba995810bce0291e293f1159d8e1ac94dd1
-SHA1 (patch-ae) = ff045dc1b42ce8a4fe5e64fde72469e1be8dab28
-SHA1 (patch-ai) = 75d30db64343afcf2f0bcfe8e73dc9948acb237e
-SHA1 (patch-aj) = 1e3ce4072e90cb7be6d0a5539ec213b56518dcc7
-SHA1 (patch-al) = 5614ef46970b5eea2bfdcfc64d1018aa0f4a6e85
-SHA1 (patch-am) = 20235b2febbc2811ca5f9b54958a4064722431ed
-SHA1 (patch-bb) = 1390c5f0bcd75f5f3f1b9949921b555e1021954f
-SHA1 (patch-bc) = 0a83a90aea8a1414b43fa3506912ab09aafbc3c0
+SHA1 (Python-2.3.2.tgz) = 2176d1c42802ea2f9d430f23f1d578e00336c6aa
+Size (Python-2.3.2.tgz) = 8459427 bytes
+SHA1 (patch-ab) = 111d7fa8adbb7001bacad36e3bdbe23ae6ce8b9b
+SHA1 (patch-ac) = 30c16b3770fed3324a38c18426d9d7758e8db889
+SHA1 (patch-ad) = c8f6ea08e68dae3bd9ad639c38e74cf654c0b41e
+SHA1 (patch-ae) = 544af90b9b7c5eb5cbad0ba0cefa3d9496b5efe3
+SHA1 (patch-af) = 2989a1975c8ea435903eafc9add57cb7c4d7de14
+SHA1 (patch-ag) = e2bf14e5858b4273148f1feaf46d5fbb325640a9
+SHA1 (patch-ah) = 6e44407c89edcee59b1f674783544884e96cf101
+SHA1 (patch-ai) = 6299b36119927e87a9a1ea7ef1859ec5f833d0b1
+SHA1 (patch-aj) = 91c1679f8109922c30e4d25fe6f99c856dc6e3d5
+SHA1 (patch-ak) = cabeb3d84102bd8be8c109986f7afb8fc147cd5a
+SHA1 (patch-al) = b0fd18aca1949c65a342ae67c7d3ba012f40398b
+SHA1 (patch-am) = 78b10cd547aa929f397abe9d4b554efda851667b
diff --git a/lang/python23/patches/patch-aa b/lang/python23/patches/patch-aa
deleted file mode 100644
index 17e3704a051..00000000000
--- a/lang/python23/patches/patch-aa
+++ /dev/null
@@ -1,81 +0,0 @@
-$NetBSD: patch-aa,v 1.2 2003/08/18 20:57:13 recht Exp $
-
---- setup.py.orig 2003-07-10 14:48:39.000000000 +0200
-+++ setup.py 2003-08-18 21:19:14.000000000 +0200
-@@ -15,7 +15,7 @@
- from distutils.command.install_lib import install_lib
-
- # This global variable is used to hold the list of modules to be disabled.
--disabled_module_list = []
-+disabled_module_list = ["_curses", "_curses_panel", "_tkinter", "gdbm", "mpz", "pyexpat", "readline"]
-
- def add_dir_to_list(dirlist, dir):
- """Add the directory 'dir' to the list 'dirlist' (at the front) if
-@@ -240,9 +240,15 @@
- return sys.platform
-
- def detect_modules(self):
-- # Ensure that /usr/local is always used
-- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-+ # Add the buildlink directories for pkgsrc
-+ if os.environ.has_key('BUILDLINK_DIR'):
-+ dir = os.environ['BUILDLINK_DIR']
-+ libdir = dir + '/lib'
-+ incdir = dir + '/include'
-+ if libdir not in self.compiler.library_dirs:
-+ self.compiler.library_dirs.insert(0, libdir)
-+ if incdir not in self.compiler.include_dirs:
-+ self.compiler.include_dirs.insert(0, incdir)
-
- # fink installs lots of goodies in /sw/... - make sure we
- # check there
-@@ -396,13 +402,13 @@
- # These represent audio samples or images as strings:
-
- # Disabled on 64-bit platforms
-- if sys.maxint != 9223372036854775807L:
-+# if sys.maxint != 9223372036854775807L:
- # Operations on audio samples
-- exts.append( Extension('audioop', ['audioop.c']) )
-+# exts.append( Extension('audioop', ['audioop.c']) )
- # Operations on images
-- exts.append( Extension('imageop', ['imageop.c']) )
-+# exts.append( Extension('imageop', ['imageop.c']) )
- # Read SGI RGB image files (but coded portably)
-- exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
-+# exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
-
- # readline
- if self.compiler.find_library_file(lib_dirs, 'readline'):
-@@ -436,9 +442,7 @@
- depends = ['socketmodule.h']) )
- # Detect SSL support for the socket module (via _ssl)
- ssl_incs = find_file('openssl/ssl.h', inc_dirs,
-- ['/usr/local/ssl/include',
-- '/usr/contrib/ssl/include/'
-- ]
-+ []
- )
- if ssl_incs is not None:
- krb5_h = find_file('krb5.h', inc_dirs,
-@@ -446,9 +450,7 @@
- if krb5_h:
- ssl_incs += krb5_h
- ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
-- ['/usr/local/ssl/lib',
-- '/usr/contrib/ssl/lib/'
-- ] )
-+ [] )
-
- if (ssl_incs is not None and
- ssl_libs is not None):
-@@ -1128,7 +1130,7 @@
- ext_modules=[Extension('struct', ['structmodule.c'])],
-
- # Scripts to install
-- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle']
-+ scripts = ['Tools/scripts/pydoc2.3']
- )
-
- # --install-platlib
diff --git a/lang/python23/patches/patch-ab b/lang/python23/patches/patch-ab
new file mode 100644
index 00000000000..b3c51270615
--- /dev/null
+++ b/lang/python23/patches/patch-ab
@@ -0,0 +1,26 @@
+$NetBSD: patch-ab,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Include/py_curses.h.orig 2003-06-29 17:46:21.000000000 +0200
++++ Include/py_curses.h
+@@ -39,6 +39,21 @@
+ #endif
+ #endif
+
++#ifdef __NetBSD__
++/*
++** On NetBSD, [n]curses.h and stdlib.h/wchar.h use different guards
++** against multiple definition of wchar_t and wint_t.
++*/
++#ifdef _XOPEN_SOURCE_EXTENDED
++#ifndef _WCHAR_T
++#define _WCHAR_T
++#endif
++#ifndef _WINT_T
++#define _WINT_T
++#endif
++#endif
++#endif
++
+ #ifdef HAVE_NCURSES_H
+ #include <ncurses.h>
+ #else
diff --git a/lang/python23/patches/patch-ac b/lang/python23/patches/patch-ac
new file mode 100644
index 00000000000..d062928ce91
--- /dev/null
+++ b/lang/python23/patches/patch-ac
@@ -0,0 +1,13 @@
+$NetBSD: patch-ac,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Include/weakrefobject.h.orig 2002-08-12 09:21:58.000000000 +0200
++++ Include/weakrefobject.h
+@@ -39,6 +39,8 @@ PyAPI_FUNC(PyObject *) PyWeakref_GetObje
+
+ PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
+
++PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
++
+ #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
+
+
diff --git a/lang/python23/patches/patch-ad b/lang/python23/patches/patch-ad
new file mode 100644
index 00000000000..e1730705004
--- /dev/null
+++ b/lang/python23/patches/patch-ad
@@ -0,0 +1,23 @@
+$NetBSD: patch-ad,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Lib/distutils/command/build_ext.py.orig 2002-11-19 14:12:28.000000000 +0100
++++ Lib/distutils/command/build_ext.py
+@@ -475,8 +475,18 @@ class build_ext (Command):
+ # that go into the mix.
+ if ext.extra_objects:
+ objects.extend(ext.extra_objects)
++
++ # Two possible sources for extra linker arguments:
++ # - 'extra_link_args' in Extension object
++ # - LDFLAGS environment variable
++ # The environment variable should take precedence, and
++ # any sensible compiler will give precedence to later
++ # command line args. Hence we combine them in order:
+ extra_args = ext.extra_link_args or []
+
++ if os.environ.has_key('LDFLAGS'):
++ extra_args.extend(string.split(os.environ['LDFLAGS']))
++
+ # Detect target language, if not provided
+ language = ext.language or self.compiler.detect_language(sources)
+
diff --git a/lang/python23/patches/patch-ae b/lang/python23/patches/patch-ae
index 9bd772a6351..e3e2b097710 100644
--- a/lang/python23/patches/patch-ae
+++ b/lang/python23/patches/patch-ae
@@ -1,23 +1,13 @@
-$NetBSD: patch-ae,v 1.1.1.1 2003/08/04 08:25:23 drochner Exp $
+$NetBSD: patch-ae,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Lib/distutils/command/build_ext.py.orig 2002-11-19 14:12:28.000000000 +0100
-+++ Lib/distutils/command/build_ext.py 2003-08-03 13:20:35.000000000 +0200
-@@ -475,8 +475,18 @@
- # that go into the mix.
- if ext.extra_objects:
- objects.extend(ext.extra_objects)
-+
-+ # Two possible sources for extra linker arguments:
-+ # - 'extra_link_args' in Extension object
-+ # - LDFLAGS environment variable
-+ # The environment variable should take precedence, and
-+ # any sensible compiler will give precedence to later
-+ # command line args. Hence we combine them in order:
- extra_args = ext.extra_link_args or []
-
-+ if os.environ.has_key('LDFLAGS'):
-+ extra_args.extend(string.split(os.environ['LDFLAGS']))
-+
- # Detect target language, if not provided
- language = ext.language or self.compiler.detect_language(sources)
-
+--- Lib/distutils/command/build_scripts.py.orig 2003-06-27 21:33:38.000000000 +0200
++++ Lib/distutils/command/build_scripts.py
+@@ -99,7 +99,7 @@ class build_scripts (Command):
+ outf.write("#!%s%s\n" %
+ (os.path.join(
+ sysconfig.get_config_var("BINDIR"),
+- "python" + sysconfig.get_config_var("EXE")),
++ "python%s" % sys.version[:3] + sysconfig.get_config_var("EXE")),
+ post_interp))
+ outf.writelines(f.readlines())
+ outf.close()
diff --git a/lang/python23/patches/patch-bb b/lang/python23/patches/patch-af
index 793aa6b1789..8401fc8422e 100644
--- a/lang/python23/patches/patch-bb
+++ b/lang/python23/patches/patch-af
@@ -1,8 +1,8 @@
-$NetBSD: patch-bb,v 1.1.1.1 2003/08/04 08:25:23 drochner Exp $
+$NetBSD: patch-af,v 1.1 2003/12/08 21:13:56 recht Exp $
--- Lib/test/test_fcntl.py.orig 2002-07-23 21:03:51.000000000 +0200
-+++ Lib/test/test_fcntl.py 2003-08-03 12:50:25.000000000 +0200
-@@ -24,7 +24,7 @@
++++ Lib/test/test_fcntl.py
+@@ -24,7 +24,7 @@ if sys.platform in ('netbsd1', 'Darwin1.
'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
'bsdos2', 'bsdos3', 'bsdos4',
'openbsd', 'openbsd2', 'openbsd3'):
diff --git a/lang/python23/patches/patch-ag b/lang/python23/patches/patch-ag
new file mode 100644
index 00000000000..a1cbd0406a6
--- /dev/null
+++ b/lang/python23/patches/patch-ag
@@ -0,0 +1,216 @@
+$NetBSD: patch-ag,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Lib/test/test_weakref.py.orig 2003-07-14 23:37:17.000000000 +0200
++++ Lib/test/test_weakref.py
+@@ -299,6 +299,211 @@ class ReferencesTestCase(TestBase):
+ self.fail("exception not properly restored")
+
+
++ def test_callback_in_cycle_1(self):
++ import gc
++
++ class J(object):
++ pass
++
++ class II(object):
++ def acallback(self, ignore):
++ self.J
++
++ I = II()
++ I.J = J
++ I.wr = weakref.ref(J, I.acallback)
++
++ # Now J and II are each in a self-cycle (as all new-style class
++ # objects are, since their __mro__ points back to them). I holds
++ # both a weak reference (I.wr) and a strong reference (I.J) to class
++ # J. I is also in a cycle (I.wr points to a weakref that references
++ # I.acallback). When we del these three, they all become trash, but
++ # the cycles prevent any of them from getting cleaned up immediately.
++ # Instead they have to wait for cyclic gc to deduce that they're
++ # trash.
++ #
++ # gc used to call tp_clear on all of them, and the order in which
++ # it does that is pretty accidental. The exact order in which we
++ # built up these things manages to provoke gc into running tp_clear
++ # in just the right order (I last). Calling tp_clear on II leaves
++ # behind an insane class object (its __mro__ becomes NULL). Calling
++ # tp_clear on J breaks its self-cycle, but J doesn't get deleted
++ # just then because of the strong reference from I.J. Calling
++ # tp_clear on I starts to clear I's __dict__, and just happens to
++ # clear I.J first -- I.wr is still intact. That removes the last
++ # reference to J, which triggers the weakref callback. The callback
++ # tries to do "self.J", and instances of new-style classes look up
++ # attributes ("J") in the class dict first. The class (II) wants to
++ # search II.__mro__, but that's NULL. The result was a segfault in
++ # a release build, and an assert failure in a debug build.
++ del I, J, II
++ gc.collect()
++
++ def test_callback_in_cycle_2(self):
++ import gc
++
++ # This is just like test_callback_in_cycle_1, except that II is an
++ # old-style class. The symptom is different then: an instance of an
++ # old-style class looks in its own __dict__ first. 'J' happens to
++ # get cleared from I.__dict__ before 'wr', and 'J' was never in II's
++ # __dict__, so the attribute isn't found. The difference is that
++ # the old-style II doesn't have a NULL __mro__ (it doesn't have any
++ # __mro__), so no segfault occurs. Instead it got:
++ # test_callback_in_cycle_2 (__main__.ReferencesTestCase) ...
++ # Exception exceptions.AttributeError:
++ # "II instance has no attribute 'J'" in <bound method II.acallback
++ # of <?.II instance at 0x00B9B4B8>> ignored
++
++ class J(object):
++ pass
++
++ class II:
++ def acallback(self, ignore):
++ self.J
++
++ I = II()
++ I.J = J
++ I.wr = weakref.ref(J, I.acallback)
++
++ del I, J, II
++ gc.collect()
++
++ def test_callback_in_cycle_3(self):
++ import gc
++
++ # This one broke the first patch that fixed the last two. In this
++ # case, the objects reachable from the callback aren't also reachable
++ # from the object (c1) *triggering* the callback: you can get to
++ # c1 from c2, but not vice-versa. The result was that c2's __dict__
++ # got tp_clear'ed by the time the c2.cb callback got invoked.
++
++ class C:
++ def cb(self, ignore):
++ self.me
++ self.c1
++ self.wr
++
++ c1, c2 = C(), C()
++
++ c2.me = c2
++ c2.c1 = c1
++ c2.wr = weakref.ref(c1, c2.cb)
++
++ del c1, c2
++ gc.collect()
++
++ def test_callback_in_cycle_4(self):
++ import gc
++
++ # Like test_callback_in_cycle_3, except c2 and c1 have different
++ # classes. c2's class (C) isn't reachable from c1 then, so protecting
++ # objects reachable from the dying object (c1) isn't enough to stop
++ # c2's class (C) from getting tp_clear'ed before c2.cb is invoked.
++ # The result was a segfault (C.__mro__ was NULL when the callback
++ # tried to look up self.me).
++
++ class C(object):
++ def cb(self, ignore):
++ self.me
++ self.c1
++ self.wr
++
++ class D:
++ pass
++
++ c1, c2 = D(), C()
++
++ c2.me = c2
++ c2.c1 = c1
++ c2.wr = weakref.ref(c1, c2.cb)
++
++ del c1, c2, C, D
++ gc.collect()
++
++ def test_callback_in_cycle_resurrection(self):
++ import gc
++
++ # Do something nasty in a weakref callback: resurrect objects
++ # from dead cycles. For this to be attempted, the weakref and
++ # its callback must also be part of the cyclic trash (else the
++ # objects reachable via the callback couldn't be in cyclic trash
++ # to begin with -- the callback would act like an external root).
++ # But gc clears trash weakrefs with callbacks early now, which
++ # disables the callbacks, so the callbacks shouldn't get called
++ # at all (and so nothing actually gets resurrected).
++
++ alist = []
++ class C(object):
++ def __init__(self, value):
++ self.attribute = value
++
++ def acallback(self, ignore):
++ alist.append(self.c)
++
++ c1, c2 = C(1), C(2)
++ c1.c = c2
++ c2.c = c1
++ c1.wr = weakref.ref(c2, c1.acallback)
++ c2.wr = weakref.ref(c1, c2.acallback)
++
++ def C_went_away(ignore):
++ alist.append("C went away")
++ wr = weakref.ref(C, C_went_away)
++
++ del c1, c2, C # make them all trash
++ self.assertEqual(alist, []) # del isn't enough to reclaim anything
++
++ gc.collect()
++ # c1.wr and c2.wr were part of the cyclic trash, so should have
++ # been cleared without their callbacks executing. OTOH, the weakref
++ # to C is bound to a function local (wr), and wasn't trash, so that
++ # callback should have been invoked when C went away.
++ self.assertEqual(alist, ["C went away"])
++ # The remaining weakref should be dead now (its callback ran).
++ self.assertEqual(wr(), None)
++
++ del alist[:]
++ gc.collect()
++ self.assertEqual(alist, [])
++
++ def test_callbacks_on_callback(self):
++ import gc
++
++ # Set up weakref callbacks *on* weakref callbacks.
++ alist = []
++ def safe_callback(ignore):
++ alist.append("safe_callback called")
++
++ class C(object):
++ def cb(self, ignore):
++ alist.append("cb called")
++
++ c, d = C(), C()
++ c.other = d
++ d.other = c
++ callback = c.cb
++ c.wr = weakref.ref(d, callback) # this won't trigger
++ d.wr = weakref.ref(callback, d.cb) # ditto
++ external_wr = weakref.ref(callback, safe_callback) # but this will
++ self.assert_(external_wr() is callback)
++
++ # The weakrefs attached to c and d should get cleared, so that
++ # C.cb is never called. But external_wr isn't part of the cyclic
++ # trash, and no cyclic trash is reachable from it, so safe_callback
++ # should get invoked when the bound method object callback (c.cb)
++ # -- which is itself a callback, and also part of the cyclic trash --
++ # gets reclaimed at the end of gc.
++
++ del callback, c, d, C
++ self.assertEqual(alist, []) # del isn't enough to clean up cycles
++ gc.collect()
++ self.assertEqual(alist, ["safe_callback called"])
++ self.assertEqual(external_wr(), None)
++
++ del alist[:]
++ gc.collect()
++ self.assertEqual(alist, [])
++
+ class Object:
+ def __init__(self, arg):
+ self.arg = arg
diff --git a/lang/python23/patches/patch-ah b/lang/python23/patches/patch-ah
new file mode 100644
index 00000000000..fc71f6a103b
--- /dev/null
+++ b/lang/python23/patches/patch-ah
@@ -0,0 +1,22 @@
+$NetBSD: patch-ah,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Makefile.pre.in.orig 2003-09-20 12:50:28.000000000 +0200
++++ Makefile.pre.in
+@@ -56,7 +56,7 @@ MAKESETUP= $(srcdir)/Modules/makese
+ OPT= @OPT@
+ BASECFLAGS= @BASECFLAGS@
+ CFLAGS= $(BASECFLAGS) $(OPT)
+-CPPFLAGS= -I. -I$(srcdir)/Include
++CPPFLAGS+= -I. -I$(srcdir)/Include
+ LDFLAGS= @LDFLAGS@
+ LDLAST= @LDLAST@
+ SGI_ABI= @SGI_ABI@
+@@ -305,7 +305,7 @@ all: $(BUILDPYTHON) oldsharedmods share
+ $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
+ $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
+ Modules/$(MAINOBJ) \
+- $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) ${LINK_ALL_LIBGCC_HACK}
+
+ platform: $(BUILDPYTHON)
+ $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
diff --git a/lang/python23/patches/patch-ai b/lang/python23/patches/patch-ai
index ff91a1097dc..3a38ba3400b 100644
--- a/lang/python23/patches/patch-ai
+++ b/lang/python23/patches/patch-ai
@@ -1,22 +1,21 @@
-$NetBSD: patch-ai,v 1.2 2003/08/06 11:05:27 drochner Exp $
+$NetBSD: patch-ai,v 1.3 2003/12/08 21:13:56 recht Exp $
---- Makefile.pre.in.orig 2003-07-13 12:10:42.000000000 +0200
-+++ Makefile.pre.in 2003-08-06 12:53:27.000000000 +0200
-@@ -56,7 +56,7 @@
- OPT= @OPT@
- BASECFLAGS= @BASECFLAGS@
- CFLAGS= $(BASECFLAGS) $(OPT)
--CPPFLAGS= -I. -I$(srcdir)/Include
-+CPPFLAGS+= -I. -I$(srcdir)/Include
- LDFLAGS= @LDFLAGS@
- LDLAST= @LDLAST@
- SGI_ABI= @SGI_ABI@
-@@ -305,7 +305,7 @@
- $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
- $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
- Modules/$(MAINOBJ) \
-- $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
-+ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) ${LINK_ALL_LIBGCC_HACK}
+--- Modules/_sre.c.orig 2003-06-26 16:41:08.000000000 +0200
++++ Modules/_sre.c
+@@ -71,9 +71,14 @@ static char copyright[] =
+ Win64 (MS_WIN64), Linux64 (__LP64__), Monterey (64-bit AIX) (_LP64) */
+ /* FIXME: maybe the limit should be 40000 / sizeof(void*) ? */
+ #define USE_RECURSION_LIMIT 7500
+-#else
- platform: $(BUILDPYTHON)
- $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+-#if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__)
++#elif defined(__FreeBSD__)
++/* FreeBSD/amd64 and /sparc64 requires even smaller limit */
++#if defined(__amd64__)
++#define USE_RECURSION_LIMIT 6000
++#elif defined(__sparc64__)
++#define USE_RECURSION_LIMIT 3000
++#elif defined(__GNUC__) && defined(WITH_THREAD)
+ /* the pthreads library on FreeBSD has a fixed 1MB stack size for the
+ * initial (or "primary") thread, which is insufficient for the default
+ * recursion limit. gcc 3.x at the default optimisation
diff --git a/lang/python23/patches/patch-aj b/lang/python23/patches/patch-aj
index a1f281a79ff..19948262988 100644
--- a/lang/python23/patches/patch-aj
+++ b/lang/python23/patches/patch-aj
@@ -1,13 +1,198 @@
-$NetBSD: patch-aj,v 1.1.1.1 2003/08/04 08:25:23 drochner Exp $
+$NetBSD: patch-aj,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Lib/distutils/command/build_scripts.py.orig 2003-08-03 12:32:35.000000000 +0200
-+++ Lib/distutils/command/build_scripts.py 2003-08-03 12:34:50.000000000 +0200
-@@ -99,7 +99,7 @@
- outf.write("#!%s%s\n" %
- (os.path.join(
- sysconfig.get_config_var("BINDIR"),
-- "python" + sysconfig.get_config_var("EXE")),
-+ "python2.3" + sysconfig.get_config_var("EXE")),
- post_interp))
- outf.writelines(f.readlines())
- outf.close()
+--- Modules/gcmodule.c.orig 2003-04-17 19:29:21.000000000 +0200
++++ Modules/gcmodule.c
+@@ -377,13 +377,17 @@ has_finalizer(PyObject *op)
+ return 0;
+ }
+
+-/* Move the objects in unreachable with __del__ methods into finalizers.
+- * The objects remaining in unreachable do not have __del__ methods, and
+- * gc_refs remains GC_TENTATIVELY_UNREACHABLE for them. The objects
+- * moved into finalizers have gc_refs changed to GC_REACHABLE.
++/* Move the objects in unreachable with __del__ methods into finalizers,
++ * and weakrefs with callbacks into wr_callbacks.
++ * The objects remaining in unreachable do not have __del__ methods, and are
++ * not weakrefs with callbacks.
++ * The objects moved have gc_refs changed to GC_REACHABLE; the objects
++ * remaining in unreachable are left at GC_TENTATIVELY_UNREACHABLE.
+ */
+ static void
+-move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
++move_troublemakers(PyGC_Head *unreachable,
++ PyGC_Head *finalizers,
++ PyGC_Head *wr_callbacks)
+ {
+ PyGC_Head *gc = unreachable->gc.gc_next;
+
+@@ -398,6 +402,12 @@ move_finalizers(PyGC_Head *unreachable,
+ gc_list_append(gc, finalizers);
+ gc->gc.gc_refs = GC_REACHABLE;
+ }
++ else if (PyWeakref_Check(op) &&
++ ((PyWeakReference *)op)->wr_callback) {
++ gc_list_remove(gc);
++ gc_list_append(gc, wr_callbacks);
++ gc->gc.gc_refs = GC_REACHABLE;
++ }
+ gc = next;
+ }
+ }
+@@ -434,6 +444,93 @@ move_finalizer_reachable(PyGC_Head *fina
+ }
+ }
+
++/* Clear all trash weakrefs with callbacks. This clears weakrefs first,
++ * which has the happy result of disabling the callbacks without executing
++ * them. A nasty technical complication: a weakref callback can itself be
++ * the target of a weakref, in which case decrefing the callback can cause
++ * another callback to trigger. But we can't allow arbitrary Python code to
++ * get executed at this point (the callback on the callback may try to muck
++ * with other cyclic trash we're trying to collect, even resurrecting it
++ * while we're in the middle of doing tp_clear() on the trash).
++ *
++ * The private _PyWeakref_ClearRef() function exists so that we can clear
++ * the reference in a weakref without triggering a callback on the callback.
++ *
++ * We have to save the callback objects and decref them later. But we can't
++ * allocate new memory to save them (if we can't get new memory, we're dead).
++ * So we grab a new reference on the clear'ed weakref, which prevents the
++ * rest of gc from reclaiming it. _PyWeakref_ClearRef() leaves the
++ * weakref's wr_callback member intact.
++ *
++ * In the end, then, wr_callbacks consists of cleared weakrefs that are
++ * immune from collection. Near the end of gc, after collecting all the
++ * cyclic trash, we call release_weakrefs(). That releases our references
++ * to the cleared weakrefs, which in turn may trigger callbacks on their
++ * callbacks.
++ */
++static void
++clear_weakrefs(PyGC_Head *wr_callbacks)
++{
++ PyGC_Head *gc = wr_callbacks->gc.gc_next;
++
++ for (; gc != wr_callbacks; gc = gc->gc.gc_next) {
++ PyObject *op = FROM_GC(gc);
++ PyWeakReference *wr;
++
++ assert(IS_REACHABLE(op));
++ assert(PyWeakref_Check(op));
++ wr = (PyWeakReference *)op;
++ assert(wr->wr_callback != NULL);
++ Py_INCREF(op);
++ _PyWeakref_ClearRef(wr);
++ }
++}
++
++/* Called near the end of gc. This gives up the references we own to
++ * cleared weakrefs, allowing them to get collected, and in turn decref'ing
++ * their callbacks.
++ *
++ * If a callback object is itself the target of a weakref callback,
++ * decref'ing the callback object may trigger that other callback. If
++ * that other callback was part of the cyclic trash in this generation,
++ * that won't happen, since we cleared *all* trash-weakref callbacks near
++ * the start of gc. If that other callback was not part of the cyclic trash
++ * in this generation, then it acted like an external root to this round
++ * of gc, so all the objects reachable from that callback are still alive.
++ *
++ * Giving up the references to the weakref objects will probably make
++ * them go away too. However, if a weakref is reachable from finalizers,
++ * it won't go away. We move it to the old generation then. Since a
++ * weakref object doesn't have a finalizer, that's the right thing to do (it
++ * doesn't belong in gc.garbage).
++ *
++ * We return the number of weakref objects freed (those not appended to old).
++ */
++static int
++release_weakrefs(PyGC_Head *wr_callbacks, PyGC_Head *old)
++{
++ int num_freed = 0;
++
++ while (! gc_list_is_empty(wr_callbacks)) {
++ PyGC_Head *gc = wr_callbacks->gc.gc_next;
++ PyObject *op = FROM_GC(gc);
++ PyWeakReference *wr = (PyWeakReference *)op;
++
++ assert(IS_REACHABLE(op));
++ assert(PyWeakref_Check(op));
++ assert(wr->wr_callback != NULL);
++ Py_DECREF(op);
++ if (wr_callbacks->gc.gc_next == gc) {
++ /* object is still alive -- move it */
++ gc_list_remove(gc);
++ gc_list_append(gc, old);
++ }
++ else
++ ++num_freed;
++ }
++ return num_freed;
++}
++
+ static void
+ debug_instance(char *msg, PyInstanceObject *inst)
+ {
+@@ -535,8 +632,9 @@ collect(int generation)
+ long n = 0; /* # unreachable objects that couldn't be collected */
+ PyGC_Head *young; /* the generation we are examining */
+ PyGC_Head *old; /* next older generation */
+- PyGC_Head unreachable;
+- PyGC_Head finalizers;
++ PyGC_Head unreachable; /* non-problematic unreachable trash */
++ PyGC_Head finalizers; /* objects with, & reachable from, __del__ */
++ PyGC_Head wr_callbacks; /* weakrefs with callbacks */
+ PyGC_Head *gc;
+
+ if (delstr == NULL) {
+@@ -597,20 +695,33 @@ collect(int generation)
+ /* All objects in unreachable are trash, but objects reachable from
+ * finalizers can't safely be deleted. Python programmers should take
+ * care not to create such things. For Python, finalizers means
+- * instance objects with __del__ methods.
++ * instance objects with __del__ methods. Weakrefs with callbacks
++ * can call arbitrary Python code, so those are special-cased too.
+ *
+- * Move unreachable objects with finalizers into a different list.
++ * Move unreachable objects with finalizers, and weakrefs with
++ * callbacks, into different lists.
+ */
+ gc_list_init(&finalizers);
+- move_finalizers(&unreachable, &finalizers);
++ gc_list_init(&wr_callbacks);
++ move_troublemakers(&unreachable, &finalizers, &wr_callbacks);
++ /* Clear the trash weakrefs with callbacks. This prevents their
++ * callbacks from getting invoked (when a weakref goes away, so does
++ * its callback).
++ * We do this even if the weakrefs are reachable from finalizers.
++ * If we didn't, breaking cycles in unreachable later could trigger
++ * deallocation of objects in finalizers, which could in turn
++ * cause callbacks to trigger. This may not be ideal behavior.
++ */
++ clear_weakrefs(&wr_callbacks);
+ /* finalizers contains the unreachable objects with a finalizer;
+- * unreachable objects reachable only *from* those are also
+- * uncollectable, and we move those into the finalizers list too.
++ * unreachable objects reachable *from* those are also uncollectable,
++ * and we move those into the finalizers list too.
+ */
+ move_finalizer_reachable(&finalizers);
+
+ /* Collect statistics on collectable objects found and print
+- * debugging information. */
++ * debugging information.
++ */
+ for (gc = unreachable.gc.gc_next; gc != &unreachable;
+ gc = gc->gc.gc_next) {
+ m++;
+@@ -624,6 +735,11 @@ collect(int generation)
+ */
+ delete_garbage(&unreachable, old);
+
++ /* Now that we're done analyzing stuff and breaking cycles, let
++ * delayed weakref callbacks run.
++ */
++ m += release_weakrefs(&wr_callbacks, old);
++
+ /* Collect statistics on uncollectable objects found and print
+ * debugging information. */
+ for (gc = finalizers.gc.gc_next;
diff --git a/lang/python23/patches/patch-ak b/lang/python23/patches/patch-ak
new file mode 100644
index 00000000000..57c98d35816
--- /dev/null
+++ b/lang/python23/patches/patch-ak
@@ -0,0 +1,68 @@
+$NetBSD: patch-ak,v 1.1 2003/12/08 21:13:56 recht Exp $
+
+--- Objects/weakrefobject.c.orig 2003-07-14 23:46:23.000000000 +0200
++++ Objects/weakrefobject.c
+@@ -53,17 +53,43 @@ clear_weakref(PyWeakReference *self)
+ if (*list == self)
+ *list = self->wr_next;
+ self->wr_object = Py_None;
+- self->wr_callback = NULL;
+ if (self->wr_prev != NULL)
+ self->wr_prev->wr_next = self->wr_next;
+ if (self->wr_next != NULL)
+ self->wr_next->wr_prev = self->wr_prev;
+ self->wr_prev = NULL;
+ self->wr_next = NULL;
+- Py_XDECREF(callback);
++ }
++ if (callback != NULL) {
++ Py_DECREF(callback);
++ self->wr_callback = NULL;
+ }
+ }
+
++/* Cyclic gc uses this to *just* clear the passed-in reference, leaving
++ * the callback intact and uncalled. It must be possible to call self's
++ * tp_dealloc() after calling this, so self has to be left in a sane enough
++ * state for that to work. We expect tp_dealloc to decref the callback
++ * then. The reason for not letting clear_weakref() decref the callback
++ * right now is that if the callback goes away, that may in turn trigger
++ * another callback (if a weak reference to the callback exists) -- running
++ * arbitrary Python code in the middle of gc is a disaster. The convolution
++ * here allows gc to delay triggering such callbacks until the world is in
++ * a sane state again.
++ */
++void
++_PyWeakref_ClearRef(PyWeakReference *self)
++{
++ PyObject *callback;
++
++ assert(self != NULL);
++ assert(PyWeakref_Check(self));
++ /* Preserve and restore the callback around clear_weakref. */
++ callback = self->wr_callback;
++ self->wr_callback = NULL;
++ clear_weakref(self);
++ self->wr_callback = callback;
++}
+
+ static void
+ weakref_dealloc(PyWeakReference *self)
+@@ -117,7 +143,7 @@ weakref_hash(PyWeakReference *self)
+ self->hash = PyObject_Hash(PyWeakref_GET_OBJECT(self));
+ return self->hash;
+ }
+-
++
+
+ static PyObject *
+ weakref_repr(PyWeakReference *self)
+@@ -324,7 +350,7 @@ WRAP_BINARY(proxy_iand, PyNumber_InPlace
+ WRAP_BINARY(proxy_ixor, PyNumber_InPlaceXor)
+ WRAP_BINARY(proxy_ior, PyNumber_InPlaceOr)
+
+-static int
++static int
+ proxy_nonzero(PyWeakReference *proxy)
+ {
+ PyObject *o = PyWeakref_GET_OBJECT(proxy);
diff --git a/lang/python23/patches/patch-al b/lang/python23/patches/patch-al
index 8c3c21b987d..d7533b5b752 100644
--- a/lang/python23/patches/patch-al
+++ b/lang/python23/patches/patch-al
@@ -1,45 +1,21 @@
-$NetBSD: patch-al,v 1.3 2003/09/10 00:11:04 recht Exp $
+$NetBSD: patch-al,v 1.4 2003/12/08 21:13:56 recht Exp $
---- pyconfig.h.in.orig 2003-07-22 17:20:49.000000000 +0200
-+++ pyconfig.h.in 2003-09-10 01:01:29.000000000 +0200
-@@ -835,6 +835,13 @@
- /* Define _OSF_SOURCE to get the makedev macro. */
- #undef _OSF_SOURCE
-
-+/* These defines disable needed library functions on NetBSD < 1.6T */
-+/* ( _NETBSD_SOURCE doesn't exist prior to 1.6T ) */
-+#if defined(__NetBSD__)
-+#include <sys/param.h>
-+#endif
-+#if !defined(__NetBSD__) || __NetBSD_Version__ > 106200000
-+
- /* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
- #undef _POSIX_1_SOURCE
-@@ -845,18 +852,20 @@
- /* Define to 1 if you need to in order for `stat' and other things to work. */
- #undef _POSIX_SOURCE
-
--/* Define if you have POSIX threads, and your system does not define that. */
--#undef _POSIX_THREADS
--
--/* Define to force use of thread-safe errno, h_errno, and other functions */
--#undef _REENTRANT
--
- /* Define to the level of X/Open that your system supports */
- #undef _XOPEN_SOURCE
-
- /* Define to activate Unix95-and-earlier features */
- #undef _XOPEN_SOURCE_EXTENDED
-
-+#endif /* __NetBSD_Version__ */
-+
-+/* Define if you have POSIX threads, and your system does not define that. */
-+#undef _POSIX_THREADS
-+
-+/* Define to force use of thread-safe errno, h_errno, and other functions */
-+#undef _REENTRANT
-+
- /* Define on FreeBSD to activate all library features */
- #undef __BSD_VISIBLE
+--- configure.orig 2003-09-27 10:58:55.000000000 +0200
++++ configure 2003-12-08 21:34:21.000000000 +0100
+@@ -1440,6 +1440,8 @@
+ # Reconfirmed for OpenBSD 3.3 by Zachary Hamm.
+ OpenBSD/2.* | OpenBSD/3.[0123])
+ define_xopen_source=no;;
++ NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S])
++ define_xopen_source=no;;
+ # On Solaris 2.6, sys/wait.h is inconsistent in the usage
+ # of union __?sigval. Reported by Stuart Bishop.
+ SunOS/5.6)
+@@ -13837,6 +13839,7 @@
+ /* end confdefs.h. */
+ #include "confdefs.h"
++#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
diff --git a/lang/python23/patches/patch-am b/lang/python23/patches/patch-am
index ea98e493948..2accab796b4 100644
--- a/lang/python23/patches/patch-am
+++ b/lang/python23/patches/patch-am
@@ -1,26 +1,121 @@
-$NetBSD: patch-am,v 1.1 2003/09/14 14:04:31 recht Exp $
+$NetBSD: patch-am,v 1.2 2003/12/08 21:13:56 recht Exp $
---- Include/py_curses.h.orig 2003-09-14 13:55:07.000000000 +0200
-+++ Include/py_curses.h 2003-09-14 14:10:49.000000000 +0200
-@@ -39,6 +39,21 @@
- #endif
- #endif
-
-+#ifdef __NetBSD__
-+/*
-+** On NetBSD, [n]curses.h and stdlib.h/wchar.h use different guards
-+** against multiple definition of wchar_t and wint_t.
-+*/
-+#ifdef _XOPEN_SOURCE_EXTENDED
-+#ifndef _WCHAR_T
-+#define _WCHAR_T
-+#endif
-+#ifndef _WINT_T
-+#define _WINT_T
-+#endif
-+#endif
-+#endif
-+
- #ifdef HAVE_NCURSES_H
- #include <ncurses.h>
- #else
+--- setup.py.orig 2003-09-22 03:19:45.000000000 +0200
++++ setup.py 2003-12-08 21:33:30.000000000 +0100
+@@ -15,7 +15,7 @@
+ from distutils.command.install_lib import install_lib
+
+ # This global variable is used to hold the list of modules to be disabled.
+-disabled_module_list = []
++disabled_module_list = ["_bsddb", "_curses", "_curses_panel", "_tkinter", "gdbm", "mpz", "pyexpat", "readline"]
+
+ def add_dir_to_list(dirlist, dir):
+ """Add the directory 'dir' to the list 'dirlist' (at the front) if
+@@ -240,9 +240,15 @@
+ return sys.platform
+
+ def detect_modules(self):
+- # Ensure that /usr/local is always used
+- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++ # Add the buildlink directories for pkgsrc
++ if os.environ.has_key('BUILDLINK_DIR'):
++ dir = os.environ['BUILDLINK_DIR']
++ libdir = dir + '/lib'
++ incdir = dir + '/include'
++ if libdir not in self.compiler.library_dirs:
++ self.compiler.library_dirs.insert(0, libdir)
++ if incdir not in self.compiler.include_dirs:
++ self.compiler.include_dirs.insert(0, incdir)
+
+ # fink installs lots of goodies in /sw/... - make sure we
+ # check there
+@@ -436,9 +442,7 @@
+ depends = ['socketmodule.h']) )
+ # Detect SSL support for the socket module (via _ssl)
+ ssl_incs = find_file('openssl/ssl.h', inc_dirs,
+- ['/usr/local/ssl/include',
+- '/usr/contrib/ssl/include/'
+- ]
++ []
+ )
+ if ssl_incs is not None:
+ krb5_h = find_file('krb5.h', inc_dirs,
+@@ -446,9 +450,7 @@
+ if krb5_h:
+ ssl_incs += krb5_h
+ ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+- ['/usr/local/ssl/lib',
+- '/usr/contrib/ssl/lib/'
+- ] )
++ [] )
+
+ if (ssl_incs is not None and
+ ssl_libs is not None):
+@@ -562,9 +564,11 @@
+ include_dirs=db_incs,
+ libraries=dblibs))
+ else:
+- db_incs = None
+- dblibs = []
+- dblib_dir = None
++ db_incs =['%%DB185_INCS%%']
++ dblibs = ['%%DB185_LIBS%%']
++ dblib_dir = ['%%DB185_LIBDIR%%']
++ if len(dblibs) > 0 and dblibs[0] == '':
++ dblibs = []
+
+
+ # Look for Berkeley db 1.85. Note that it is built as a different
+@@ -573,21 +577,30 @@
+ # accidentally building this module with a later version of the
+ # underlying db library. May BSD-ish Unixes incorporate db 1.85
+ # symbols into libc and place the include file in /usr/include.
+- f = "/usr/include/db.h"
++ f = "%%DB185_H%%"
+ if os.path.exists(f):
+ data = open(f).read()
+ m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
+ if m is not None:
++ bsddb185_define_macros = []
++ if f.split("/")[-1] == "db_185.h":
++ bsddb185_define_macros=[('HAVE_DB_185_H',1)]
+ # bingo - old version used hash file format version 2
+ ### XXX this should be fixed to not be platform-dependent
+ ### but I don't have direct access to an osf1 platform and
+ ### seemed to be muffing the search somehow
+- libraries = platform == "osf1" and ['db'] or None
++ #libraries = platform == "osf1" and ['db'] or None
++ libraries = dblibs
+ if libraries is not None:
+ exts.append(Extension('bsddb185', ['bsddbmodule.c'],
++ library_dirs=dblib_dir,
++ runtime_library_dirs=dblib_dir,
++ include_dirs=db_incs,
++ define_macros=bsddb185_define_macros,
+ libraries=libraries))
+ else:
+- exts.append(Extension('bsddb185', ['bsddbmodule.c']))
++ exts.append(Extension('bsddb185', ['bsddbmodule.c'],
++ define_macros=bsddb185_define_macros))
+
+ # The standard Unix dbm module:
+ if platform not in ['cygwin']:
+@@ -765,7 +778,7 @@
+ # Linux-specific modules
+ exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
+
+- if platform in ('linux2', 'freebsd4'):
++ if platform in ('linux2', 'freebsd4', 'freebsd5'):
+ exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
+
+ if platform == 'sunos5':
+@@ -1135,7 +1148,7 @@
+ ext_modules=[Extension('struct', ['structmodule.c'])],
+
+ # Scripts to install
+- scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle']
++ scripts = ['Tools/scripts/pydoc2.3']
+ )
+
+ # --install-platlib
diff --git a/lang/python23/patches/patch-bc b/lang/python23/patches/patch-bc
deleted file mode 100644
index 5314c647014..00000000000
--- a/lang/python23/patches/patch-bc
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD: patch-bc,v 1.1 2003/09/10 00:11:04 recht Exp $
-
---- configure.orig Thu Jul 24 00:17:27 2003
-+++ configure
-@@ -1365,6 +1365,8 @@ case $ac_sys_system/$ac_sys_release in
- # Reconfirmed for OpenBSD 3.3 by Zachary Hamm.
- OpenBSD/2.* | OpenBSD/3.[0123])
- define_xopen_source=no;;
-+ NetBSD/1.5 | NetBSD/1.5.*)
-+ define_xopen_source=no;;
- # On Solaris 2.6, sys/wait.h is inconsistent in the usage
- # of union __?sigval. Reported by Stuart Bishop.
- SunOS/5.6)
-@@ -13079,6 +13081,7 @@ cat >conftest.$ac_ext <<_ACEOF
- #include "confdefs.h"
-
- #include "confdefs.h"
-+#include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>