Updates and garbage collect all three Python ports:

2.4.4 => 2.4.8
    2.5.2 => 2.5.4
    2.6 => 2.6.1

Python 2.4 and 2.5 lose their build knobs to match 2.6.

Removes no longer needed Python 2.5 security patches backported
from the release25-maint SVN branch.

Remove the -bz2 subpackage from all three versions. It is silly
to make a subpackage to avoid depending on something tiny and
compatibly licensed.

Python 2.4 and 2.5 lose their -expat subpackages; expat has been
in base for some time.

Python 2.5 loses its sqlite subpackge. Again, sqlite is tiny,
compatibly licensed and is depended upon by more and more
applications. This brings it into line with the 2.6 version.

Rework all three version's handling of setup.py. Rather than regex
replacing LOCALBASE and X11BASE into setup.py post-configure, these
are passed in though environment variables. Will save hours of
frustrated cursing familiar to anyone who has accidently used the
update-patches target after configure and had to go back and redo
all the substitutions.

Rework the patching of setup.py for 2.4 and 2.5 to be more like
what we do for 2.6. I.e. keep the diff minimal and avoid deleting
huge blocks of code, so the diff has a chance of applying without
massive hand-editing each patch release.

Fix .py paths in installed .pyc files (patch from eric@)

feedback from several, particularly eric@, ajacoutot@ and Ingo
Schwarze; "get it in" ajacoutot@
This commit is contained in:
djm 2009-01-01 21:03:27 +00:00
parent d335af44e7
commit d71b9a7269
71 changed files with 739 additions and 2191 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.19 2008/10/21 20:13:07 steven Exp $
# $OpenBSD: Makefile,v 1.20 2009/01/01 21:03:27 djm Exp $
VERSION= 2.4
PATCHLEVEL= .4
PKG_PATCHLEVEL= p8
PATCHLEVEL= .6
#PKG_PATCHLEVEL=
SHARED_LIBS= python2.4 1.0
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "sparc64"

View File

@ -1,5 +1,5 @@
MD5 (Python-2.4.4.tgz) = gtAAYXuq7yaa1XlcWV/cWA==
RMD160 (Python-2.4.4.tgz) = NXEYT703D9Npp8ncY3Q8UCOLGoU=
SHA1 (Python-2.4.4.tgz) = Ej18+Ik05Qw9g0pD72CA8lkDR9M=
SHA256 (Python-2.4.4.tgz) = kr5uIMvDER2d0MAW1y73kUwjuHncUt97oo35evvxLi4=
SIZE (Python-2.4.4.tgz) = 9531474
MD5 (Python-2.4.6.tgz) = dWSysUKxuDRc1TWLeqqkgg==
RMD160 (Python-2.4.6.tgz) = qF+kAFXMBVJgYfKz5nD8LjDr47A=
SHA1 (Python-2.4.6.tgz) = REPnZG1iLTWUL04sM0LyUYKZFes=
SHA256 (Python-2.4.6.tgz) = sD8mnoJpJ/Bclmz09EFPPJPuIxSWCFnn+DdeJOgviwI=
SIZE (Python-2.4.6.tgz) = 9550168

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-Lib_test_test_timeout_py,v 1.2 2006/11/01 20:38:37 alek Exp $
--- Lib/test/test_timeout.py.orig Sat Mar 18 03:47:38 2006
+++ Lib/test/test_timeout.py Fri Oct 20 10:26:08 2006
@@ -108,7 +108,7 @@ class TimeoutTestCase(unittest.TestCase)
$OpenBSD: patch-Lib_test_test_timeout_py,v 1.3 2009/01/01 21:03:27 djm Exp $
--- Lib/test/test_timeout.py.orig Sat Mar 18 13:47:38 2006
+++ Lib/test/test_timeout.py Fri Dec 26 12:27:16 2008
@@ -108,7 +108,7 @@ class TimeoutTestCase(unittest.TestCase):
def testConnectTimeout(self):
# Test connect() timeout

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-Makefile_pre_in,v 1.3 2006/11/01 20:38:37 alek Exp $
--- Makefile.pre.in.orig Sun Oct 8 19:41:25 2006
+++ Makefile.pre.in Sat Oct 21 15:06:35 2006
@@ -315,7 +315,7 @@ all: $(BUILDPYTHON) oldsharedmods share
$OpenBSD: patch-Makefile_pre_in,v 1.4 2009/01/01 21:03:27 djm Exp $
--- Makefile.pre.in.orig Mon Oct 9 03:41:25 2006
+++ Makefile.pre.in Fri Dec 26 12:27:16 2008
@@ -315,7 +315,7 @@ all: $(BUILDPYTHON) oldsharedmods sharedmods
$(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
Modules/$(MAINOBJ) \

View File

@ -0,0 +1,44 @@
$OpenBSD: patch-Modules__bsddb_c,v 1.1 2009/01/01 21:03:27 djm Exp $
--- Modules/_bsddb.c.orig Fri Dec 26 12:49:59 2008
+++ Modules/_bsddb.c Fri Dec 26 12:52:07 2008
@@ -2465,11 +2465,7 @@ int DB_length(DBObject* self)
if (self->haveStat) { /* Has the stat function been called recently? If
so, we can use the cached value. */
-#if (DBVER <= 32)
- flags = DB_CACHED_COUNTS;
-#else
flags = DB_FAST_STAT;
-#endif
}
MYDB_BEGIN_ALLOW_THREADS;
@@ -3841,7 +3837,7 @@ DBEnv_set_lk_max(DBEnvObject* self, PyObject* args)
CHECK_ENV_NOT_CLOSED(self);
MYDB_BEGIN_ALLOW_THREADS;
- err = self->db_env->set_lk_max(self->db_env, max);
+ err = self->db_env->set_lk_max_locks(self->db_env, max);
MYDB_END_ALLOW_THREADS;
RETURN_IF_ERR();
RETURN_NONE();
@@ -5039,7 +5035,9 @@ DL_EXPORT(void) init_bsddb(void)
ADD_INT(d, DB_AFTER);
ADD_INT(d, DB_APPEND);
ADD_INT(d, DB_BEFORE);
+#if (DBVER < 45)
ADD_INT(d, DB_CACHED_COUNTS);
+#endif
#if (DBVER >= 41)
_addIntToDict(d, "DB_CHECKPOINT", 0);
#else
@@ -5074,7 +5072,9 @@ DL_EXPORT(void) init_bsddb(void)
ADD_INT(d, DB_POSITION);
ADD_INT(d, DB_PREV);
ADD_INT(d, DB_PREV_NODUP);
+#if (DBVER < 45)
ADD_INT(d, DB_RECORDCOUNT);
+#endif
ADD_INT(d, DB_SET);
ADD_INT(d, DB_SET_RANGE);
ADD_INT(d, DB_SET_RECNO);

View File

@ -0,0 +1,82 @@
$OpenBSD: patch-Modules_ossaudiodev_c,v 1.1 2009/01/01 21:03:27 djm Exp $
--- Modules/ossaudiodev.c.orig Wed Oct 4 20:23:57 2006
+++ Modules/ossaudiodev.c Fri Dec 26 12:44:22 2008
@@ -30,7 +30,7 @@
#endif
#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include <soundcard.h>
#if defined(linux)
@@ -1028,6 +1028,7 @@ initossaudiodev(void)
/* Expose all the ioctl numbers for masochists who like to do this
stuff directly. */
+#ifdef SNDCTL_COPR_HALT
_EXPORT_INT(m, SNDCTL_COPR_HALT);
_EXPORT_INT(m, SNDCTL_COPR_LOAD);
_EXPORT_INT(m, SNDCTL_COPR_RCODE);
@@ -1038,6 +1039,7 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_COPR_SENDMSG);
_EXPORT_INT(m, SNDCTL_COPR_WCODE);
_EXPORT_INT(m, SNDCTL_COPR_WDATA);
+#endif
#ifdef SNDCTL_DSP_BIND_CHANNEL
_EXPORT_INT(m, SNDCTL_DSP_BIND_CHANNEL);
#endif
@@ -1080,18 +1082,25 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_DSP_STEREO);
_EXPORT_INT(m, SNDCTL_DSP_SUBDIVIDE);
_EXPORT_INT(m, SNDCTL_DSP_SYNC);
+#ifdef SNDCTL_FM_4OP_ENABLE
_EXPORT_INT(m, SNDCTL_FM_4OP_ENABLE);
_EXPORT_INT(m, SNDCTL_FM_LOAD_INSTR);
+#endif
+#ifdef SNDCTL_MIDI_INFO
_EXPORT_INT(m, SNDCTL_MIDI_INFO);
_EXPORT_INT(m, SNDCTL_MIDI_MPUCMD);
_EXPORT_INT(m, SNDCTL_MIDI_MPUMODE);
_EXPORT_INT(m, SNDCTL_MIDI_PRETIME);
+#endif
+#ifdef SNDCTL_SEQ_CTRLRATE
_EXPORT_INT(m, SNDCTL_SEQ_CTRLRATE);
_EXPORT_INT(m, SNDCTL_SEQ_GETINCOUNT);
_EXPORT_INT(m, SNDCTL_SEQ_GETOUTCOUNT);
+#endif
#ifdef SNDCTL_SEQ_GETTIME
_EXPORT_INT(m, SNDCTL_SEQ_GETTIME);
#endif
+#ifdef SNDCTL_SEQ_NRMIDIS
_EXPORT_INT(m, SNDCTL_SEQ_NRMIDIS);
_EXPORT_INT(m, SNDCTL_SEQ_NRSYNTHS);
_EXPORT_INT(m, SNDCTL_SEQ_OUTOFBAND);
@@ -1102,17 +1111,21 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_SEQ_SYNC);
_EXPORT_INT(m, SNDCTL_SEQ_TESTMIDI);
_EXPORT_INT(m, SNDCTL_SEQ_THRESHOLD);
+#endif
#ifdef SNDCTL_SYNTH_CONTROL
_EXPORT_INT(m, SNDCTL_SYNTH_CONTROL);
#endif
#ifdef SNDCTL_SYNTH_ID
_EXPORT_INT(m, SNDCTL_SYNTH_ID);
#endif
+#ifdef SNDCTL_SYNTH_INFO
_EXPORT_INT(m, SNDCTL_SYNTH_INFO);
_EXPORT_INT(m, SNDCTL_SYNTH_MEMAVL);
+#endif
#ifdef SNDCTL_SYNTH_REMOVESAMPLE
_EXPORT_INT(m, SNDCTL_SYNTH_REMOVESAMPLE);
#endif
+#ifdef SNDCTL_TMR_CONTINUE
_EXPORT_INT(m, SNDCTL_TMR_CONTINUE);
_EXPORT_INT(m, SNDCTL_TMR_METRONOME);
_EXPORT_INT(m, SNDCTL_TMR_SELECT);
@@ -1121,4 +1134,5 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_TMR_STOP);
_EXPORT_INT(m, SNDCTL_TMR_TEMPO);
_EXPORT_INT(m, SNDCTL_TMR_TIMEBASE);
+#endif
}

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-Modules_posixmodule_c,v 1.2 2006/11/01 20:38:37 alek Exp $
--- Modules/posixmodule.c.orig Mon Oct 9 21:29:06 2006
+++ Modules/posixmodule.c Sat Oct 21 15:06:38 2006
@@ -805,7 +805,7 @@ statresult_new(PyTypeObject *type, PyObj
$OpenBSD: patch-Modules_posixmodule_c,v 1.3 2009/01/01 21:03:27 djm Exp $
--- Modules/posixmodule.c.orig Tue Oct 10 05:29:06 2006
+++ Modules/posixmodule.c Fri Dec 26 12:27:16 2008
@@ -805,7 +805,7 @@ statresult_new(PyTypeObject *type, PyObject *args, PyO
/* If true, st_?time is float. */
@ -10,7 +10,7 @@ $OpenBSD: patch-Modules_posixmodule_c,v 1.2 2006/11/01 20:38:37 alek Exp $
PyDoc_STRVAR(stat_float_times__doc__,
"stat_float_times([newval]) -> oldval\n\n\
@@ -5417,6 +5417,10 @@ posix_read(PyObject *self, PyObject *arg
@@ -5417,6 +5417,10 @@ posix_read(PyObject *self, PyObject *args)
PyObject *buffer;
if (!PyArg_ParseTuple(args, "ii:read", &fd, &size))
return NULL;

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-Modules_socketmodule_c,v 1.4 2006/11/01 20:38:37 alek Exp $
--- Modules/socketmodule.c.orig Tue Oct 10 18:20:41 2006
+++ Modules/socketmodule.c Sat Oct 21 15:06:39 2006
$OpenBSD: patch-Modules_socketmodule_c,v 1.5 2009/01/01 21:03:27 djm Exp $
--- Modules/socketmodule.c.orig Wed Oct 11 02:20:41 2006
+++ Modules/socketmodule.c Fri Dec 26 12:27:16 2008
@@ -72,9 +72,6 @@ Local naming conventions:
#include "Python.h"
@ -11,7 +11,7 @@ $OpenBSD: patch-Modules_socketmodule_c,v 1.4 2006/11/01 20:38:37 alek Exp $
/* Socket object documentation */
PyDoc_STRVAR(sock_doc,
"socket([family[, type[, proto]]]) -> socket object\n\
@@ -1807,10 +1804,15 @@ internal_connect(PySocketSockObject *s,
@@ -1807,10 +1804,15 @@ internal_connect(PySocketSockObject *s, struct sockadd
if (s->sock_timeout > 0.0) {
if (res < 0 && errno == EINPROGRESS && IS_SELECTABLE(s)) {
@ -30,7 +30,7 @@ $OpenBSD: patch-Modules_socketmodule_c,v 1.4 2006/11/01 20:38:37 alek Exp $
}
}
@@ -3307,7 +3309,7 @@ socket_inet_aton(PyObject *self, PyObjec
@@ -3307,7 +3309,7 @@ socket_inet_aton(PyObject *self, PyObject *args)
#if !defined(HAVE_INET_ATON) || defined(USE_INET_ATON_WEAKLINK)
/* Have to use inet_addr() instead */

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure_in,v 1.7 2007/01/10 16:57:56 steven Exp $
--- configure.in.orig Tue Oct 17 18:03:36 2006
+++ configure.in Sat Oct 21 15:13:55 2006
$OpenBSD: patch-configure_in,v 1.8 2009/01/01 21:03:27 djm Exp $
--- configure.in.orig Wed Oct 18 02:03:36 2006
+++ configure.in Fri Dec 26 12:27:20 2008
@@ -197,7 +197,7 @@ case $ac_sys_system/$ac_sys_release in
# On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
# even though select is a POSIX function. Reported by J. Ribbens.
@ -10,7 +10,7 @@ $OpenBSD: patch-configure_in,v 1.7 2007/01/10 16:57:56 steven Exp $
define_xopen_source=no;;
# On Solaris 2.6, sys/wait.h is inconsistent in the usage
# of union __?sigval. Reported by Stuart Bishop.
@@ -1616,9 +1618,10 @@ AC_CHECK_LIB(dld, shl_load) # Dynamic li
@@ -1616,9 +1616,10 @@ AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-U
# only check for sem_ini if thread support is requested
if test "$with_threads" = "yes" -o -z "$with_threads"; then

View File

@ -1,223 +1,157 @@
$OpenBSD: patch-setup_py,v 1.3 2007/04/28 10:06:25 bernd Exp $
--- setup.py.orig Sun Oct 8 19:41:25 2006
+++ setup.py Tue Apr 24 14:01:43 2007
@@ -521,141 +521,13 @@ class PyBuildExt(build_ext):
# of available releases can be found at
$OpenBSD: patch-setup_py,v 1.4 2009/01/01 21:03:27 djm Exp $
--- setup.py.orig Mon Oct 9 03:41:25 2006
+++ setup.py Fri Dec 26 13:14:40 2008
@@ -17,6 +17,11 @@ 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 = []
+def usrlocal(p):
+ return os.path.join(os.environ['LOCALBASE'], p)
+def usrx11r6(p):
+ return os.path.join(os.environ['X11BASE'], p)
+
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
1) 'dir' is not already in 'dirlist'
@@ -240,8 +245,8 @@ class PyBuildExt(build_ext):
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_dir_to_list(self.compiler.library_dirs, usrlocal('lib'))
+ add_dir_to_list(self.compiler.include_dirs, usrlocal('include'))
# Add paths to popular package managers on OS X/darwin
if sys.platform == "darwin":
@@ -485,9 +490,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,
@@ -495,8 +498,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
@@ -522,9 +524,9 @@ class PyBuildExt(build_ext):
#
# http://www.sleepycat.com/update/index.html
-
- max_db_ver = (4, 4)
- min_db_ver = (3, 2)
+ max_db_ver = (4, 7)
min_db_ver = (3, 2)
- db_setup_debug = False # verbose debug prints from this script?
-
- # construct a list of paths to look for the header file in on
- # top of the normal inc_dirs.
- db_inc_paths = [
- '/usr/include/db4',
- '/usr/local/include/db4',
- '/opt/sfw/include/db4',
- '/sw/include/db4',
- '/usr/include/db3',
- '/usr/local/include/db3',
- '/opt/sfw/include/db3',
- '/sw/include/db3',
- ]
- # 4.x minor number specific paths
- for x in (0,1,2,3,4):
- db_inc_paths.append('/usr/include/db4%d' % x)
- db_inc_paths.append('/usr/include/db4.%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db4%d' % x)
- db_inc_paths.append('/pkg/db-4.%d/include' % x)
- db_inc_paths.append('/opt/db-4.%d/include' % x)
- # 3.x minor number specific paths
- for x in (2,3):
- db_inc_paths.append('/usr/include/db3%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db3%d' % x)
- db_inc_paths.append('/pkg/db-3.%d/include' % x)
- db_inc_paths.append('/opt/db-3.%d/include' % x)
-
- # Add some common subdirectories for Sleepycat DB to the list,
- # based on the standard include directories. This way DB3/4 gets
- # picked up when it is installed in a non-standard prefix and
- # the user has added that prefix into inc_dirs.
- std_variants = []
- for dn in inc_dirs:
- std_variants.append(os.path.join(dn, 'db3'))
- std_variants.append(os.path.join(dn, 'db4'))
- for x in (0,1,2,3,4):
- std_variants.append(os.path.join(dn, "db4%d"%x))
- std_variants.append(os.path.join(dn, "db4.%d"%x))
- for x in (2,3):
- std_variants.append(os.path.join(dn, "db3%d"%x))
- std_variants.append(os.path.join(dn, "db3.%d"%x))
-
- db_inc_paths = std_variants + db_inc_paths
-
- db_ver_inc_map = {}
-
- class db_found(Exception): pass
- try:
- # See whether there is a Sleepycat header in the standard
- # search path.
- for d in inc_dirs + db_inc_paths:
- f = os.path.join(d, "db.h")
- if db_setup_debug: print "db: looking for db.h in", f
- if os.path.exists(f):
- f = open(f).read()
- m = re.search(r"#define\WDB_VERSION_MAJOR\W(\d+)", f)
- if m:
- db_major = int(m.group(1))
- m = re.search(r"#define\WDB_VERSION_MINOR\W(\d+)", f)
- db_minor = int(m.group(1))
- db_ver = (db_major, db_minor)
-
- if ( (not db_ver_inc_map.has_key(db_ver)) and
- (db_ver <= max_db_ver and db_ver >= min_db_ver) ):
- # save the include directory with the db.h version
- # (first occurrance only)
- db_ver_inc_map[db_ver] = d
- print "db.h: found", db_ver, "in", d
- else:
- # we already found a header for this library version
- if db_setup_debug: print "db.h: ignoring", d
- else:
- # ignore this header, it didn't contain a version number
+ db_setup_debug = True # verbose debug prints from this script?
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.
@@ -570,6 +572,7 @@ class PyBuildExt(build_ext):
std_variants.append(os.path.join(dn, "db3.%d"%x))
db_inc_paths = std_variants + db_inc_paths
+ db_inc_paths = [ usrlocal('include/db4') ]
db_ver_inc_map = {}
@@ -600,7 +603,7 @@ class PyBuildExt(build_ext):
if db_setup_debug: print "db.h: ignoring", d
else:
# ignore this header, it didn't contain a version number
- if db_setup_debug: print "db.h: unsupported version", db_ver, "in", d
-
- db_found_vers = db_ver_inc_map.keys()
- db_found_vers.sort()
-
- while db_found_vers:
- db_ver = db_found_vers.pop()
- db_incdir = db_ver_inc_map[db_ver]
-
- # check lib directories parallel to the location of the header
- db_dirs_to_check = [
- os.path.join(db_incdir, '..', 'lib64'),
- os.path.join(db_incdir, '..', 'lib'),
- os.path.join(db_incdir, '..', '..', 'lib64'),
- os.path.join(db_incdir, '..', '..', 'lib'),
- ]
- db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
-
- # Look for a version specific db-X.Y before an ambiguoius dbX
- # XXX should we -ever- look for a dbX name? Do any
- # systems really not name their library by version and
- # symlink to more general names?
- for dblib in (('db-%d.%d' % db_ver),
- ('db%d%d' % db_ver),
- ('db%d' % db_ver[0])):
- dblib_file = self.compiler.find_library_file(
- db_dirs_to_check + lib_dirs, dblib )
- if dblib_file:
- dblib_dir = [ os.path.abspath(os.path.dirname(dblib_file)) ]
- raise db_found
- else:
- if db_setup_debug: print "db lib: ", dblib, "not found"
-
- except db_found:
- print "db lib: using", db_ver, dblib
- if db_setup_debug: print "db: lib dir", dblib_dir, "inc dir", db_incdir
- db_incs = [db_incdir]
- dblibs = [dblib]
- # We add the runtime_library_dirs argument because the
- # BerkeleyDB lib we're linking against often isn't in the
- # system dynamic library search path. This is usually
- # correct and most trouble free, but may cause problems in
- # some unusual system configurations (e.g. the directory
- # is on an NFS server that goes away).
+ if !!USE_BSDDB!!:
exts.append(Extension('_bsddb', ['_bsddb.c'],
- library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
- include_dirs=db_incs,
- libraries=dblibs))
- else:
- if db_setup_debug: print "db: no appropriate library found"
- db_incs = None
- dblibs = []
- dblib_dir = None
+ library_dirs=["!!LOCALBASE!!/lib/db4"],
+ runtime_library_dirs=["!!LOCALBASE!!/lib/db4"],
+ include_dirs=["!!LOCALBASE!!/include/db4"],
+ libraries=["db"]))
+ if db_setup_debug: print "db.h: no version in", d
-
# Look for Berkeley db 1.85. Note that it is built as a different
# module name so it can be included even when later versions are
# available. A very restrictive search is performed to avoid
@@ -704,7 +576,7 @@ class PyBuildExt(build_ext):
libraries=dblibs))
db_found_vers = db_ver_inc_map.keys()
db_found_vers.sort()
@@ -617,12 +620,14 @@ class PyBuildExt(build_ext):
os.path.join(db_incdir, '..', '..', 'lib'),
]
db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
+ db_dirs_to_check = [ usrlocal('lib/db4') ]
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
- if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
+ if !!USE_GDBM!!:
exts.append( Extension('gdbm', ['gdbmmodule.c'],
libraries = ['gdbm'] ) )
@@ -791,7 +663,7 @@ class PyBuildExt(build_ext):
libraries = ['z']) )
# Gustavo Niemeyer's bz2 module.
- if (self.compiler.find_library_file(lib_dirs, 'bz2')):
+ if !!USE_BZ2!!:
exts.append( Extension('bz2', ['bz2module.c'],
libraries = ['bz2']) )
@@ -806,19 +678,19 @@ class PyBuildExt(build_ext):
#
# More information on Expat can be found at www.libexpat.org.
#
- expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
- define_macros = [
- ('HAVE_EXPAT_CONFIG_H', '1'),
- ]
- exts.append(Extension('pyexpat',
- define_macros = define_macros,
- include_dirs = [expatinc],
- sources = ['pyexpat.c',
# Look for a version specific db-X.Y before an ambiguoius dbX
# XXX should we -ever- look for a dbX name? Do any
# systems really not name their library by version and
# symlink to more general names?
for dblib in (('db-%d.%d' % db_ver),
+ ('db'),
('db%d%d' % db_ver),
('db%d' % db_ver[0])):
dblib_file = self.compiler.find_library_file(
@@ -814,10 +819,8 @@ class PyBuildExt(build_ext):
define_macros = define_macros,
include_dirs = [expatinc],
sources = ['pyexpat.c',
- 'expat/xmlparse.c',
- 'expat/xmlrole.c',
- 'expat/xmltok.c',
- ],
- ))
+ if !!USE_EXPAT!!:
+ expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
+ define_macros = [
+ ('HAVE_EXPAT_CONFIG_H', '1'),
+ ]
+ exts.append(Extension('pyexpat',
+ define_macros = define_macros,
+ include_dirs = ["!!X11BASE!!/include", expatinc],
+ library_dirs = ["!!X11BASE!!/lib"],
+ sources = ['pyexpat.c',
+ ],
+ libraries = ["expat"]
+ ))
],
+ libraries = ['expat'],
))
# Hye-Shik Chang's CJKCodecs modules.
if have_unicode:
@@ -954,7 +826,16 @@ class PyBuildExt(build_ext):
self.extensions.extend(exts)
@@ -842,6 +845,9 @@ class PyBuildExt(build_ext):
# Call the method for detecting whether _tkinter can be compiled
- self.detect_tkinter(inc_dirs, lib_dirs)
+ if !!USE_TKINTER!!:
+ ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
+ define_macros=[('WITH_APPINIT', 1)],
+ include_dirs = ["!!LOCALBASE!!/include/tcl8.4",
+ "!!LOCALBASE!!/include/tk8.4",
+ "!!X11BASE!!/include"],
+ libraries = ["tk84", "tcl84", "X11"],
+ library_dirs = ["!!LOCALBASE!!/lib", "!!X11BASE!!/lib"],
+ )
+ self.extensions.append(ext)
if platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6'):
exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
+ if platform in ('openbsd4'):
+ exts.append( Extension('ossaudiodev', ['ossaudiodev.c'],
+ libraries=['ossaudio']) )
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
# The _tkinter module, using frameworks. Since frameworks are quite
@@ -1224,8 +1105,7 @@ def main():
if platform == 'sunos5':
# SunOS specific modules
@@ -996,7 +1002,7 @@ class PyBuildExt(build_ext):
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
+ include_dirs.append(usrx11r6('include'))
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@@ -1025,8 +1031,7 @@ class PyBuildExt(build_ext):
# The versions with dots are used on Unix, and the versions without
# dots on Windows, for detection by cygwin.
tcllib = tklib = tcl_includes = tk_includes = None
- for version in ['8.5', '85', '8.4', '84', '8.3', '83', '8.2',
- '82', '8.1', '81', '8.0', '80']:
+ for version in ['84']:
tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version)
tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version)
if tklib and tcllib:
@@ -1067,17 +1072,9 @@ class PyBuildExt(build_ext):
if platform == 'sunos5':
include_dirs.append('/usr/openwin/include')
added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
- # Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
+ elif True:
+ include_dirs.append(usrx11r6('include'))
+ added_lib_dirs.append(usrx11r6('lib'))
# If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin':
@@ -1224,8 +1221,7 @@ def main():
ext_modules=[Extension('struct', ['structmodule.c'])],
# Scripts to install

View File

@ -1 +0,0 @@
This package contains bzip2 compression module.

View File

@ -1,14 +0,0 @@
Python is an interpreted, interactive, object-oriented programming
language that combines remarkable power with very clear syntax. For
an introduction to programming in Python you are referred to the
Python Tutorial. The Python Library Reference documents built-in
and standard types, constants, functions and modules. Finally, the
Python Reference Manual describes the syntax and semantics of the
core language in (perhaps too) much detail.
Python's basic power can be extended with your own modules written
in C or C++. On most systems such modules may be dynamically loaded.
Python is also adaptable as an extension language for existing
applications. See the internal documentation for hints.
This package contains the Berkeley db module.

View File

@ -1 +0,0 @@
This package contains support for the expat XML parser.

View File

@ -13,12 +13,3 @@ dynamically loaded. Python is also adaptable as an
extension language for existing applications. See the
internal documentation for hints.
Flavors:
no_bsddb - do not build bsdb package
no_expat - do not build expat package
no_gdbm - do not build gdbm package
no_idle - do not build idle package
no_mpz - do not build mpz package
no_tests - do not build tests package
no_tkinter - do not build tkinter package
no_tools - do not build tools package

View File

@ -1,4 +0,0 @@
@comment $OpenBSD: PLIST-bz2,v 1.1 2006/11/01 20:38:37 alek Exp $
@option no-default-conflict
@conflict python-bz2->=2.4,<2.5
lib/python2.4/lib-dynload/bz2.so

View File

@ -1,4 +0,0 @@
@comment $OpenBSD: PLIST-expat,v 1.1 2005/12/17 12:33:00 alek Exp $
@option no-default-conflict
@conflict python-expat->=2.4,<2.5
lib/python2.4/lib-dynload/pyexpat.so

View File

@ -1,10 +1,12 @@
@comment $OpenBSD: PLIST-main,v 1.1 2006/11/24 20:48:23 steven Exp $
@comment $OpenBSD: PLIST-main,v 1.2 2009/01/01 21:03:27 djm Exp $
@option no-default-conflict
@conflict python->=2.4,<2.5
@conflict python-bz2->=2.4,<2.5
@conflict python-expat->=2.4,<2.5
@pkgpath lang/python/2.4
%%mm%%
bin/pydoc2.4
bin/python2.4
@bin bin/python2.4
include/python2.4/
include/python2.4/Python-ast.h
include/python2.4/Python.h
@ -1117,6 +1119,7 @@ lib/python2.4/lib-dynload/array.so
lib/python2.4/lib-dynload/audioop.so
lib/python2.4/lib-dynload/binascii.so
lib/python2.4/lib-dynload/bsddb185.so
lib/python2.4/lib-dynload/bz2.so
lib/python2.4/lib-dynload/cPickle.so
lib/python2.4/lib-dynload/cStringIO.so
lib/python2.4/lib-dynload/cmath.so
@ -1132,7 +1135,9 @@ lib/python2.4/lib-dynload/md5.so
lib/python2.4/lib-dynload/mmap.so
lib/python2.4/lib-dynload/nis.so
lib/python2.4/lib-dynload/operator.so
lib/python2.4/lib-dynload/ossaudiodev.so
lib/python2.4/lib-dynload/parser.so
lib/python2.4/lib-dynload/pyexpat.so
lib/python2.4/lib-dynload/readline.so
lib/python2.4/lib-dynload/regex.so
lib/python2.4/lib-dynload/resource.so

View File

@ -1,12 +1,10 @@
# $OpenBSD: Makefile,v 1.27 2008/10/19 07:13:45 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.28 2009/01/01 21:03:27 djm Exp $
VERSION= 2.5
PATCHLEVEL= .2
PKG_PATCHLEVEL= p7
PATCHLEVEL= .4
#PKG_PATCHLEVEL=
SHARED_LIBS= python2.5 1.0
# PSUBDIR= python/${VERSION}
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "sparc64"
PATCH_LIST= patch-* sup64-*
.endif

View File

@ -1,5 +1,5 @@
MD5 (Python-2.5.2.tgz) = P3yoqobGvSdUJtY7RuB5kg==
RMD160 (Python-2.5.2.tgz) = puLoGRBjmjYvJlry44FOe0fiEQo=
SHA1 (Python-2.5.2.tgz) = eoNck6kErk7LLSO1GD6U07kvgwU=
SHA256 (Python-2.5.2.tgz) = g0r+ioitr2I7Baxd1nAN1btdDVVT/HStUpNZo0luSuM=
SIZE (Python-2.5.2.tgz) = 11583114
MD5 (Python-2.5.4.tgz) = rUeyN3j2TtraqotVNJhu7Q==
RMD160 (Python-2.5.4.tgz) = mTXyxccGW19HxjnkUTa0sPhcvrk=
SHA1 (Python-2.5.4.tgz) = RPSm5cpUpDFtPZ2LgmU7KIi9u3k=
SHA256 (Python-2.5.4.tgz) = PTsgVhHuUDo4qUM9VkWlcWaEILshkkLH9Rr4XwVmTaY=
SIZE (Python-2.5.4.tgz) = 11604497

View File

@ -1,59 +0,0 @@
$OpenBSD: patch-Include_pymem_h,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Include/pymem.h.orig Thu Feb 14 22:26:18 2008
+++ Include/pymem.h Tue Aug 5 18:18:52 2008
@@ -67,8 +67,12 @@ PyAPI_FUNC(void) PyMem_Free(void *);
for malloc(0), which would be treated as an error. Some platforms
would return a pointer with no memory behind it, which would break
pymalloc. To solve these problems, allocate an extra byte. */
-#define PyMem_MALLOC(n) malloc((n) ? (n) : 1)
-#define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1)
+/* Returns NULL to indicate error if a negative size or size larger than
+ Py_ssize_t can represent is supplied. Helps prevents security holes. */
+#define PyMem_MALLOC(n) (((n) < 0 || (n) > PY_SSIZE_T_MAX) ? NULL \
+ : malloc((n) ? (n) : 1))
+#define PyMem_REALLOC(p, n) (((n) < 0 || (n) > PY_SSIZE_T_MAX) ? NULL \
+ : realloc((p), (n) ? (n) : 1))
#define PyMem_FREE free
#endif /* PYMALLOC_DEBUG */
@@ -77,24 +81,31 @@ PyAPI_FUNC(void) PyMem_Free(void *);
* Type-oriented memory interface
* ==============================
*
- * These are carried along for historical reasons. There's rarely a good
- * reason to use them anymore (you can just as easily do the multiply and
- * cast yourself).
+ * Allocate memory for n objects of the given type. Returns a new pointer
+ * or NULL if the request was too large or memory allocation failed. Use
+ * these macros rather than doing the multiplication yourself so that proper
+ * overflow checking is always done.
*/
#define PyMem_New(type, n) \
- ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \
+ ( ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
( (type *) PyMem_Malloc((n) * sizeof(type)) ) )
#define PyMem_NEW(type, n) \
- ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \
+ ( ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
( (type *) PyMem_MALLOC((n) * sizeof(type)) ) )
+/*
+ * The value of (p) is always clobbered by this macro regardless of success.
+ * The caller MUST check if (p) is NULL afterwards and deal with the memory
+ * error if so. This means the original value of (p) MUST be saved for the
+ * caller's memory error handler to not lose track of it.
+ */
#define PyMem_Resize(p, type, n) \
- ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \
- ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) )
+ ( (p) = ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
+ (type *) PyMem_Realloc((p), (n) * sizeof(type)) )
#define PyMem_RESIZE(p, type, n) \
- ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \
- ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) )
+ ( (p) = ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
+ (type *) PyMem_REALLOC((p), (n) * sizeof(type)) )
/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used
* anymore. They're just confusing aliases for PyMem_{Free,FREE} now.

View File

@ -1,22 +0,0 @@
$OpenBSD: patch-Lib_test_seq_tests_py,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Lib/test/seq_tests.py.orig Tue Nov 13 07:04:41 2007
+++ Lib/test/seq_tests.py Tue Aug 5 18:18:52 2008
@@ -307,11 +307,13 @@ class CommonTest(unittest.TestCase):
self.assertEqual(id(s), id(s*1))
def test_bigrepeat(self):
- x = self.type2test([0])
- x *= 2**16
- self.assertRaises(MemoryError, x.__mul__, 2**16)
- if hasattr(x, '__imul__'):
- self.assertRaises(MemoryError, x.__imul__, 2**16)
+ import sys
+ if sys.maxint <= 2147483647:
+ x = self.type2test([0])
+ x *= 2**16
+ self.assertRaises(MemoryError, x.__mul__, 2**16)
+ if hasattr(x, '__imul__'):
+ self.assertRaises(MemoryError, x.__imul__, 2**16)
def test_subscript(self):
a = self.type2test([10, 11])

View File

@ -1,154 +0,0 @@
$OpenBSD: patch-Lib_test_test_bigmem_py,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Lib/test/test_bigmem.py.orig Sat Dec 1 08:53:17 2007
+++ Lib/test/test_bigmem.py Tue Aug 5 18:18:52 2008
@@ -1,5 +1,5 @@
from test import test_support
-from test.test_support import bigmemtest, _1G, _2G
+from test.test_support import bigmemtest, _1G, _2G, _4G, precisionbigmemtest
import unittest
import operator
@@ -54,6 +54,22 @@ class StrTest(unittest.TestCase):
self.assertEquals(s[lpadsize:-rpadsize], SUBSTR)
self.assertEquals(s.strip(), SUBSTR.strip())
+ @precisionbigmemtest(size=_2G - 1, memuse=1)
+ def test_center_unicode(self, size):
+ SUBSTR = u' abc def ghi'
+ try:
+ s = SUBSTR.center(size)
+ except OverflowError:
+ pass # acceptable on 32-bit
+ else:
+ self.assertEquals(len(s), size)
+ lpadsize = rpadsize = (len(s) - len(SUBSTR)) // 2
+ if len(s) % 2:
+ lpadsize += 1
+ self.assertEquals(s[lpadsize:-rpadsize], SUBSTR)
+ self.assertEquals(s.strip(), SUBSTR.strip())
+ del s
+
@bigmemtest(minsize=_2G, memuse=2)
def test_count(self, size):
SUBSTR = ' abc def ghi'
@@ -70,11 +86,45 @@ class StrTest(unittest.TestCase):
s = '.' * size
self.assertEquals(len(s.decode('utf-8')), size)
+ def basic_encode_test(self, size, enc, c=u'.', expectedsize=None):
+ if expectedsize is None:
+ expectedsize = size
+
+ s = c * size
+ self.assertEquals(len(s.encode(enc)), expectedsize)
+
@bigmemtest(minsize=_2G + 2, memuse=3)
def test_encode(self, size):
- s = u'.' * size
- self.assertEquals(len(s.encode('utf-8')), size)
+ return self.basic_encode_test(size, 'utf-8')
+ @precisionbigmemtest(size=_4G / 6 + 2, memuse=2)
+ def test_encode_raw_unicode_escape(self, size):
+ try:
+ return self.basic_encode_test(size, 'raw_unicode_escape')
+ except MemoryError:
+ pass # acceptable on 32-bit
+
+ @precisionbigmemtest(size=_4G / 5 + 70, memuse=3)
+ def test_encode_utf7(self, size):
+ try:
+ return self.basic_encode_test(size, 'utf7')
+ except MemoryError:
+ pass # acceptable on 32-bit
+
+ @precisionbigmemtest(size=_2G-1, memuse=2)
+ def test_decodeascii(self, size):
+ return self.basic_encode_test(size, 'ascii', c='A')
+
+ @precisionbigmemtest(size=_4G / 5, memuse=6+2)
+ def test_unicode_repr_oflw(self, size):
+ try:
+ s = u"\uAAAA"*size
+ r = repr(s)
+ except MemoryError:
+ pass # acceptable on 32-bit
+ else:
+ self.failUnless(s == eval(r))
+
@bigmemtest(minsize=_2G, memuse=2)
def test_endswith(self, size):
SUBSTR = ' abc def ghi'
@@ -459,6 +509,11 @@ class StrTest(unittest.TestCase):
self.assertEquals(s.count('\\'), size)
self.assertEquals(s.count('0'), size * 2)
+ @bigmemtest(minsize=2**32 / 5, memuse=6+2)
+ def test_unicode_repr(self, size):
+ s = u"\uAAAA" * size
+ self.failUnless(len(repr(s)) > size)
+
# This test is meaningful even with size < 2G, as long as the
# doubled string is > 2G (but it tests more if both are > 2G :)
@bigmemtest(minsize=_1G + 2, memuse=3)
@@ -642,6 +697,35 @@ class TupleTest(unittest.TestCase):
def test_repeat_large(self, size):
return self.basic_test_repeat(size)
+ @bigmemtest(minsize=_1G - 1, memuse=12)
+ def test_repeat_large_2(self, size):
+ return self.basic_test_repeat(size)
+
+ @precisionbigmemtest(size=_1G - 1, memuse=9)
+ def test_from_2G_generator(self, size):
+ try:
+ t = tuple(xrange(size))
+ except MemoryError:
+ pass # acceptable on 32-bit
+ else:
+ count = 0
+ for item in t:
+ self.assertEquals(item, count)
+ count += 1
+ self.assertEquals(count, size)
+
+ @precisionbigmemtest(size=_1G - 25, memuse=9)
+ def test_from_almost_2G_generator(self, size):
+ try:
+ t = tuple(xrange(size))
+ count = 0
+ for item in t:
+ self.assertEquals(item, count)
+ count += 1
+ self.assertEquals(count, size)
+ except MemoryError:
+ pass # acceptable, expected on 32-bit
+
# Like test_concat, split in two.
def basic_test_repr(self, size):
t = (0,) * size
@@ -957,8 +1041,23 @@ class ListTest(unittest.TestCase):
self.assertEquals(l[:10], [1] * 10)
self.assertEquals(l[-10:], [5] * 10)
+class BufferTest(unittest.TestCase):
+
+ @precisionbigmemtest(size=_1G, memuse=4)
+ def test_repeat(self, size):
+ try:
+ b = buffer("AAAA")*size
+ except MemoryError:
+ pass # acceptable on 32-bit
+ else:
+ count = 0
+ for c in b:
+ self.assertEquals(c, 'A')
+ count += 1
+ self.assertEquals(count, size*4)
+
def test_main():
- test_support.run_unittest(StrTest, TupleTest, ListTest)
+ test_support.run_unittest(StrTest, TupleTest, ListTest, BufferTest)
if __name__ == '__main__':
if len(sys.argv) > 1:

View File

@ -1,46 +0,0 @@
$OpenBSD: patch-Lib_test_test_ioctl_py,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Lib/test/test_ioctl.py.orig Thu Sep 15 04:09:42 2005
+++ Lib/test/test_ioctl.py Tue Aug 5 18:18:52 2008
@@ -14,6 +14,11 @@ try:
except IOError:
raise TestSkipped("Unable to open /dev/tty")
+try:
+ import pty
+except ImportError:
+ pty = None
+
class IoctlTests(unittest.TestCase):
def test_ioctl(self):
# If this process has been put into the background, TIOCGPGRP returns
@@ -33,6 +38,30 @@ class IoctlTests(unittest.TestCase):
rpgrp = buf[0]
self.assertEquals(r, 0)
self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids))
+
+ def test_ioctl_signed_unsigned_code_param(self):
+ if not pty:
+ raise TestSkipped('pty module required')
+ mfd, sfd = pty.openpty()
+ try:
+ if termios.TIOCSWINSZ < 0:
+ set_winsz_opcode_maybe_neg = termios.TIOCSWINSZ
+ set_winsz_opcode_pos = termios.TIOCSWINSZ & 0xffffffffL
+ else:
+ set_winsz_opcode_pos = termios.TIOCSWINSZ
+ set_winsz_opcode_maybe_neg, = struct.unpack("i",
+ struct.pack("I", termios.TIOCSWINSZ))
+
+ # We're just testing that these calls do not raise exceptions.
+ saved_winsz = fcntl.ioctl(mfd, termios.TIOCGWINSZ, "\0"*8)
+ our_winsz = struct.pack("HHHH",80,25,0,0)
+ # test both with a positive and potentially negative ioctl code
+ new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_pos, our_winsz)
+ new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, our_winsz)
+ fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, saved_winsz)
+ finally:
+ os.close(mfd)
+ os.close(sfd)
def test_main():
run_unittest(IoctlTests)

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-Lib_test_test_strop_py,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Lib/test/test_strop.py.orig Wed Jul 31 09:27:12 2002
+++ Lib/test/test_strop.py Tue Aug 5 18:18:52 2008
@@ -115,6 +115,25 @@ class StropFunctionTestCase(unittest.TestCase):
strop.uppercase
strop.whitespace
+ @test_support.precisionbigmemtest(size=test_support._2G - 1, memuse=5)
+ def test_stropjoin_huge_list(self, size):
+ a = "A" * size
+ try:
+ r = strop.join([a, a], a)
+ except OverflowError:
+ pass
+ else:
+ self.assertEquals(len(r), len(a) * 3)
+
+ @test_support.precisionbigmemtest(size=test_support._2G - 1, memuse=1)
+ def test_stropjoin_huge_tup(self, size):
+ a = "A" * size
+ try:
+ r = strop.join((a, a), a)
+ except OverflowError:
+ pass # acceptable on 32-bit
+ else:
+ self.assertEquals(len(r), len(a) * 3)
transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'

View File

@ -1,63 +0,0 @@
$OpenBSD: patch-Lib_test_test_support_py,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Lib/test/test_support.py.orig Sun Jan 27 12:24:44 2008
+++ Lib/test/test_support.py Tue Aug 5 18:18:52 2008
@@ -33,6 +33,7 @@ verbose = 1 # Flag set to 0 by regrtest.p
use_resources = None # Flag set to [] by regrtest.py
max_memuse = 0 # Disable bigmem tests (they will still be run with
# small sizes, to make sure they work.)
+real_max_memuse = 0
# _original_stdout is meant to hold stdout at the time regrtest began.
# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever.
@@ -323,6 +324,7 @@ def run_with_locale(catstr, *locales):
_1M = 1024*1024
_1G = 1024 * _1M
_2G = 2 * _1G
+_4G = 4 * _1G
# Hack to get at the maximum value an internal index can take.
class _Dummy:
@@ -333,6 +335,7 @@ MAX_Py_ssize_t = _Dummy()[:]
def set_memlimit(limit):
import re
global max_memuse
+ global real_max_memuse
sizes = {
'k': 1024,
'm': _1M,
@@ -344,6 +347,7 @@ def set_memlimit(limit):
if m is None:
raise ValueError('Invalid memory limit %r' % (limit,))
memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()])
+ real_max_memuse = memlimit
if memlimit > MAX_Py_ssize_t:
memlimit = MAX_Py_ssize_t
if memlimit < _2G - 1:
@@ -384,6 +388,27 @@ def bigmemtest(minsize, memuse, overhead=5*_1M):
maxsize = max(maxsize - 50 * _1M, minsize)
return f(self, maxsize)
wrapper.minsize = minsize
+ wrapper.memuse = memuse
+ wrapper.overhead = overhead
+ return wrapper
+ return decorator
+
+def precisionbigmemtest(size, memuse, overhead=5*_1M):
+ def decorator(f):
+ def wrapper(self):
+ if not real_max_memuse:
+ maxsize = 5147
+ else:
+ maxsize = size
+
+ if real_max_memuse and real_max_memuse < maxsize * memuse:
+ if verbose:
+ sys.stderr.write("Skipping %s because of memory "
+ "constraint\n" % (f.__name__,))
+ return
+
+ return f(self, maxsize)
+ wrapper.size = size
wrapper.memuse = memuse
wrapper.overhead = overhead
return wrapper

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-Lib_test_test_threading_py,v 1.1 2009/01/01 21:03:27 djm Exp $
--- Lib/test/test_threading.py.orig Fri Dec 26 11:33:37 2008
+++ Lib/test/test_threading.py Fri Dec 26 11:34:33 2008
@@ -279,7 +279,8 @@ class ThreadJoinOnShutdown(unittest.TestCase):
return
# Skip platforms with known problems forking from a worker thread.
# See http://bugs.python.org/issue3863.
- if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'):
+ if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx',
+ 'openbsd4'):
print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread'
' due to known OS bugs on'), sys.platform
return

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-Lib_test_test_unicode_py,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Lib/test/test_unicode.py.orig Mon Jun 11 14:31:25 2007
+++ Lib/test/test_unicode.py Tue Aug 5 18:18:52 2008
@@ -532,6 +532,9 @@ class UnicodeTest(
self.assertEqual(unicode('+3ADYAA-', 'utf-7', 'replace'), u'\ufffd')
+ # Issue #2242: crash on some Windows/MSVC versions
+ self.assertRaises(UnicodeDecodeError, '+\xc1'.decode, 'utf-7')
+
def test_codecs_utf8(self):
self.assertEqual(u''.encode('utf-8'), '')
self.assertEqual(u'\u20ac'.encode('utf-8'), '\xe2\x82\xac')

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-Lib_test_test_zlib_py,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Lib/test/test_zlib.py.orig Mon Jun 12 13:33:09 2006
+++ Lib/test/test_zlib.py Tue Aug 5 18:18:52 2008
@@ -71,6 +71,11 @@ class ExceptionTestCase(unittest.TestCase):
# verify failure on building decompress object with bad params
self.assertRaises(ValueError, zlib.decompressobj, 0)
+ def test_decompressobj_badflush(self):
+ # verify failure on calling decompressobj.flush with bad params
+ self.assertRaises(ValueError, zlib.decompressobj().flush, 0)
+ self.assertRaises(ValueError, zlib.decompressobj().flush, -1)
+
class CompressTestCase(unittest.TestCase):

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-Makefile_pre_in,v 1.5 2008/06/09 12:34:55 espie Exp $
--- Makefile.pre.in.orig Wed Dec 5 21:43:57 2007
+++ Makefile.pre.in Mon Jun 9 14:23:39 2008
$OpenBSD: patch-Makefile_pre_in,v 1.6 2009/01/01 21:03:27 djm Exp $
--- Makefile.pre.in.orig Mon Sep 22 10:22:44 2008
+++ Makefile.pre.in Mon Dec 15 20:13:03 2008
@@ -332,6 +332,8 @@ LIBRARY_OBJS= \
#########################################################################
# Rules
@ -20,7 +20,7 @@ $OpenBSD: patch-Makefile_pre_in,v 1.5 2008/06/09 12:34:55 espie Exp $
$(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
@@ -376,6 +379,11 @@ libpython$(VERSION).so: $(LIBRARY_OBJS)
libpython$(VERSION).sl: $(LIBRARY_OBJS)
$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
$(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
+# This rule for OpenBSD...
+$(LDLIBRARY): $(LIBRARY)

View File

@ -1,108 +0,0 @@
$OpenBSD: patch-Modules__hashopenssl_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/_hashopenssl.c.orig Tue May 30 07:04:52 2006
+++ Modules/_hashopenssl.c Tue Aug 5 21:04:47 2008
@@ -19,7 +19,9 @@
/* EVP is the preferred interface to hashing in OpenSSL */
#include <openssl/evp.h>
+#define MUNCH_SIZE INT_MAX
+
#ifndef HASH_OBJ_CONSTRUCTOR
#define HASH_OBJ_CONSTRUCTOR 0
#endif
@@ -164,9 +166,18 @@ EVP_update(EVPobject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
return NULL;
+ if (len > 0 && len <= MUNCH_SIZE) {
EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
unsigned int));
-
+ } else {
+ Py_ssize_t offset = 0;
+ while (len) {
+ unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
+ EVP_DigestUpdate(&self->ctx, cp + offset, process);
+ len -= process;
+ offset += process;
+ }
+ }
Py_INCREF(Py_None);
return Py_None;
}
@@ -255,10 +266,21 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject
self->name = name_obj;
Py_INCREF(self->name);
- if (cp && len)
+ if (cp && len) {
+ if (len > 0 && len <= MUNCH_SIZE) {
EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
unsigned int));
-
+ } else {
+ Py_ssize_t offset = 0;
+ while (len) {
+ unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
+ EVP_DigestUpdate(&self->ctx, cp + offset, process);
+ len -= process;
+ offset += process;
+ }
+ }
+ }
+
return 0;
}
#endif
@@ -328,7 +350,7 @@ static PyTypeObject EVPtype = {
static PyObject *
EVPnew(PyObject *name_obj,
const EVP_MD *digest, const EVP_MD_CTX *initial_ctx,
- const unsigned char *cp, unsigned int len)
+ const unsigned char *cp, Py_ssize_t len)
{
EVPobject *self;
@@ -346,8 +368,20 @@ EVPnew(PyObject *name_obj,
EVP_DigestInit(&self->ctx, digest);
}
- if (cp && len)
- EVP_DigestUpdate(&self->ctx, cp, len);
+ if (cp && len) {
+ if (len > 0 && len <= MUNCH_SIZE) {
+ EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
+ unsigned int));
+ } else {
+ Py_ssize_t offset = 0;
+ while (len) {
+ unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
+ EVP_DigestUpdate(&self->ctx, cp + offset, process);
+ len -= process;
+ offset += process;
+ }
+ }
+ }
return (PyObject *)self;
}
@@ -384,8 +418,7 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdi
digest = EVP_get_digestbyname(name);
- return EVPnew(name_obj, digest, NULL, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
- unsigned int));
+ return EVPnew(name_obj, digest, NULL, cp, len);
}
/*
@@ -410,7 +443,7 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdi
CONST_ ## NAME ## _name_obj, \
NULL, \
CONST_new_ ## NAME ## _ctx_p, \
- cp, Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int)); \
+ cp, len); \
}
/* a PyMethodDef structure for the constructor */

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-Modules_almodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/almodule.c.orig Mon Sep 25 16:53:42 2006
+++ Modules/almodule.c Tue Aug 5 18:18:52 2008
@@ -1633,9 +1633,11 @@ al_QueryValues(PyObject *self, PyObject *args)
if (nvals < 0)
goto cleanup;
if (nvals > setsize) {
+ ALvalue *old_return_set = return_set;
setsize = nvals;
PyMem_RESIZE(return_set, ALvalue, setsize);
if (return_set == NULL) {
+ return_set = old_return_set;
PyErr_NoMemory();
goto cleanup;
}

View File

@ -1,34 +0,0 @@
$OpenBSD: patch-Modules_arraymodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/arraymodule.c.orig Sat Feb 16 06:11:46 2008
+++ Modules/arraymodule.c Tue Aug 5 18:18:52 2008
@@ -816,6 +816,7 @@ static int
array_do_extend(arrayobject *self, PyObject *bb)
{
Py_ssize_t size;
+ char *old_item;
if (!array_Check(bb))
return array_iter_extend(self, bb);
@@ -831,10 +832,11 @@ array_do_extend(arrayobject *self, PyObject *bb)
return -1;
}
size = self->ob_size + b->ob_size;
+ old_item = self->ob_item;
PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize);
if (self->ob_item == NULL) {
- PyObject_Del(self);
- PyErr_NoMemory();
+ self->ob_item = old_item;
+ PyErr_NoMemory();
return -1;
}
memcpy(self->ob_item + self->ob_size*self->ob_descr->itemsize,
@@ -886,7 +888,7 @@ array_inplace_repeat(arrayobject *self, Py_ssize_t n)
if (size > PY_SSIZE_T_MAX / n) {
return PyErr_NoMemory();
}
- PyMem_Resize(items, char, n * size);
+ PyMem_RESIZE(items, char, n * size);
if (items == NULL)
return PyErr_NoMemory();
p = items;

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-Modules_fcntlmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/fcntlmodule.c.orig Sun Jul 30 01:43:13 2006
+++ Modules/fcntlmodule.c Tue Aug 5 18:18:52 2008
@@ -97,11 +97,20 @@ fcntl_ioctl(PyObject *self, PyObject *args)
{
#define IOCTL_BUFSZ 1024
int fd;
- /* In PyArg_ParseTuple below, use the unsigned int 'I' format for
- the signed int 'code' variable, because Python turns 0x8000000
- into a large positive number (PyLong, or PyInt on 64-bit
- platforms,) whereas C expects it to be a negative int */
- int code;
+ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
+ format for the 'code' parameter because Python turns 0x8000000
+ into either a large positive number (PyLong or PyInt on 64-bit
+ platforms) or a negative number on others (32-bit PyInt)
+ whereas the system expects it to be a 32bit bit field value
+ regardless of it being passed as an int or unsigned long on
+ various platforms. See the termios.TIOCSWINSZ constant across
+ platforms for an example of thise.
+
+ If any of the 64bit platforms ever decide to use more than 32bits
+ in their unsigned long ioctl codes this will break and need
+ special casing based on the platform being built on.
+ */
+ unsigned int code;
int arg;
int ret;
char *str;

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-Modules_gcmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/gcmodule.c.orig Tue Oct 10 05:42:33 2006
+++ Modules/gcmodule.c Tue Aug 5 18:18:52 2008
@@ -1318,7 +1318,10 @@ PyObject *
_PyObject_GC_Malloc(size_t basicsize)
{
PyObject *op;
- PyGC_Head *g = (PyGC_Head *)PyObject_MALLOC(
+ PyGC_Head *g;
+ if (basicsize > PY_SSIZE_T_MAX - sizeof(PyGC_Head))
+ return PyErr_NoMemory();
+ g = (PyGC_Head *)PyObject_MALLOC(
sizeof(PyGC_Head) + basicsize);
if (g == NULL)
return PyErr_NoMemory();
@@ -1361,6 +1364,8 @@ _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems
{
const size_t basicsize = _PyObject_VAR_SIZE(op->ob_type, nitems);
PyGC_Head *g = AS_GC(op);
+ if (basicsize > PY_SSIZE_T_MAX - sizeof(PyGC_Head))
+ return (PyVarObject *)PyErr_NoMemory();
g = (PyGC_Head *)PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize);
if (g == NULL)
return (PyVarObject *)PyErr_NoMemory();

View File

@ -1,218 +0,0 @@
$OpenBSD: patch-Modules_imageop_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/imageop.c.orig Thu Jan 19 17:09:39 2006
+++ Modules/imageop.c Tue Aug 5 18:18:52 2008
@@ -78,7 +78,7 @@ imageop_crop(PyObject *self, PyObject *args)
char *cp, *ncp;
short *nsp;
Py_Int32 *nlp;
- int len, size, x, y, newx1, newx2, newy1, newy2;
+ int len, size, x, y, newx1, newx2, newy1, newy2, nlen;
int ix, iy, xstep, ystep;
PyObject *rv;
@@ -90,13 +90,19 @@ imageop_crop(PyObject *self, PyObject *args)
PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
return 0;
}
- if ( len != size*x*y ) {
+ if (( len != size*x*y ) ||
+ ( size != ((len / x) / y) )) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
xstep = (newx1 < newx2)? 1 : -1;
ystep = (newy1 < newy2)? 1 : -1;
+ nlen = (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size;
+ if ( size != ((nlen / (abs(newx2-newx1)+1)) / (abs(newy2-newy1)+1)) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
rv = PyString_FromStringAndSize(NULL,
(abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size);
if ( rv == 0 )
@@ -132,7 +138,7 @@ imageop_scale(PyObject *self, PyObject *args)
char *cp, *ncp;
short *nsp;
Py_Int32 *nlp;
- int len, size, x, y, newx, newy;
+ int len, size, x, y, newx, newy, nlen;
int ix, iy;
int oix, oiy;
PyObject *rv;
@@ -145,12 +151,18 @@ imageop_scale(PyObject *self, PyObject *args)
PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
return 0;
}
- if ( len != size*x*y ) {
+ if ( ( len != size*x*y ) ||
+ ( size != ((len / x) / y) ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
+ nlen = newx*newy*size;
+ if ( size != ((nlen / newx) / newy) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
- rv = PyString_FromStringAndSize(NULL, newx*newy*size);
+ rv = PyString_FromStringAndSize(NULL, nlen);
if ( rv == 0 )
return 0;
ncp = (char *)PyString_AsString(rv);
@@ -190,7 +202,8 @@ imageop_tovideo(PyObject *self, PyObject *args)
PyErr_SetString(ImageopError, "Size should be 1 or 4");
return 0;
}
- if ( maxx*maxy*width != len ) {
+ if ( ( maxx*maxy*width != len ) ||
+ ( maxx != ((len / maxy) / width) ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -240,7 +253,8 @@ imageop_grey2mono(PyObject *self, PyObject *args)
if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -281,7 +295,8 @@ imageop_grey2grey4(PyObject *self, PyObject *args)
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -320,7 +335,8 @@ imageop_grey2grey2(PyObject *self, PyObject *args)
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -358,7 +374,8 @@ imageop_dither2mono(PyObject *self, PyObject *args)
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -404,7 +421,8 @@ imageop_dither2grey2(PyObject *self, PyObject *args)
if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
return 0;
- if ( x*y != len ) {
+ if ( ( x*y != len ) ||
+ ( x != len / y ) ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
@@ -443,7 +461,11 @@ imageop_mono2grey(PyObject *self, PyObject *args)
if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) )
return 0;
- nlen = x*y;
+ nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( (nlen+7)/8 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -481,6 +503,10 @@ imageop_grey22grey(PyObject *self, PyObject *args)
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( (nlen+3)/4 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -517,6 +543,10 @@ imageop_grey42grey(PyObject *self, PyObject *args)
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( (nlen+1)/2 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -554,6 +584,10 @@ imageop_rgb2rgb8(PyObject *self, PyObject *args)
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen*4 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -598,10 +632,19 @@ imageop_rgb82rgb(PyObject *self, PyObject *args)
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
}
+
+ if ( nlen / x != y || nlen > INT_MAX / 4) {
+ PyErr_SetString(ImageopError, "Image is too large");
+ return 0;
+ }
rv = PyString_FromStringAndSize(NULL, nlen*4);
if ( rv == 0 )
@@ -648,6 +691,10 @@ imageop_rgb2grey(PyObject *self, PyObject *args)
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen*4 != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
return 0;
@@ -693,8 +740,17 @@ imageop_grey2rgb(PyObject *self, PyObject *args)
return 0;
nlen = x*y;
+ if ( x != (nlen / y) ) {
+ PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
if ( nlen != len ) {
PyErr_SetString(ImageopError, "String has incorrect length");
+ return 0;
+ }
+
+ if ( nlen / x != y || nlen > INT_MAX / 4) {
+ PyErr_SetString(ImageopError, "Image is too large");
return 0;
}

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-Modules_mmapmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/mmapmodule.c.orig Tue Aug 22 23:57:07 2006
+++ Modules/mmapmodule.c Tue Aug 5 18:18:52 2008
@@ -223,7 +223,7 @@ mmap_read_method(mmap_object *self,
return(NULL);
/* silently 'adjust' out-of-range requests */
- if ((self->pos + num_bytes) > self->size) {
+ if (num_bytes > self->size - self->pos) {
num_bytes -= (self->pos+num_bytes) - self->size;
}
result = Py_BuildValue("s#", self->data+self->pos, num_bytes);

View File

@ -0,0 +1,82 @@
$OpenBSD: patch-Modules_ossaudiodev_c,v 1.1 2009/01/01 21:03:27 djm Exp $
--- Modules/ossaudiodev.c.orig Wed Oct 4 20:23:57 2006
+++ Modules/ossaudiodev.c Mon Dec 15 22:50:41 2008
@@ -30,7 +30,7 @@
#endif
#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include <soundcard.h>
#if defined(linux)
@@ -1042,6 +1042,7 @@ initossaudiodev(void)
/* Expose all the ioctl numbers for masochists who like to do this
stuff directly. */
+#ifdef SNDCTL_COPR_HALT
_EXPORT_INT(m, SNDCTL_COPR_HALT);
_EXPORT_INT(m, SNDCTL_COPR_LOAD);
_EXPORT_INT(m, SNDCTL_COPR_RCODE);
@@ -1052,6 +1053,7 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_COPR_SENDMSG);
_EXPORT_INT(m, SNDCTL_COPR_WCODE);
_EXPORT_INT(m, SNDCTL_COPR_WDATA);
+#endif
#ifdef SNDCTL_DSP_BIND_CHANNEL
_EXPORT_INT(m, SNDCTL_DSP_BIND_CHANNEL);
#endif
@@ -1094,18 +1096,25 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_DSP_STEREO);
_EXPORT_INT(m, SNDCTL_DSP_SUBDIVIDE);
_EXPORT_INT(m, SNDCTL_DSP_SYNC);
+#ifdef SNDCTL_FM_4OP_ENABLE
_EXPORT_INT(m, SNDCTL_FM_4OP_ENABLE);
_EXPORT_INT(m, SNDCTL_FM_LOAD_INSTR);
+#endif
+#ifdef SNDCTL_MIDI_INFO
_EXPORT_INT(m, SNDCTL_MIDI_INFO);
_EXPORT_INT(m, SNDCTL_MIDI_MPUCMD);
_EXPORT_INT(m, SNDCTL_MIDI_MPUMODE);
_EXPORT_INT(m, SNDCTL_MIDI_PRETIME);
+#endif
+#ifdef SNDCTL_SEQ_CTRLRATE
_EXPORT_INT(m, SNDCTL_SEQ_CTRLRATE);
_EXPORT_INT(m, SNDCTL_SEQ_GETINCOUNT);
_EXPORT_INT(m, SNDCTL_SEQ_GETOUTCOUNT);
+#endif
#ifdef SNDCTL_SEQ_GETTIME
_EXPORT_INT(m, SNDCTL_SEQ_GETTIME);
#endif
+#ifdef SNDCTL_SEQ_NRMIDIS
_EXPORT_INT(m, SNDCTL_SEQ_NRMIDIS);
_EXPORT_INT(m, SNDCTL_SEQ_NRSYNTHS);
_EXPORT_INT(m, SNDCTL_SEQ_OUTOFBAND);
@@ -1116,17 +1125,21 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_SEQ_SYNC);
_EXPORT_INT(m, SNDCTL_SEQ_TESTMIDI);
_EXPORT_INT(m, SNDCTL_SEQ_THRESHOLD);
+#endif
#ifdef SNDCTL_SYNTH_CONTROL
_EXPORT_INT(m, SNDCTL_SYNTH_CONTROL);
#endif
#ifdef SNDCTL_SYNTH_ID
_EXPORT_INT(m, SNDCTL_SYNTH_ID);
#endif
+#ifdef SNDCTL_SYNTH_INFO
_EXPORT_INT(m, SNDCTL_SYNTH_INFO);
_EXPORT_INT(m, SNDCTL_SYNTH_MEMAVL);
+#endif
#ifdef SNDCTL_SYNTH_REMOVESAMPLE
_EXPORT_INT(m, SNDCTL_SYNTH_REMOVESAMPLE);
#endif
+#ifdef SNDCTL_TMR_CONTINUE
_EXPORT_INT(m, SNDCTL_TMR_CONTINUE);
_EXPORT_INT(m, SNDCTL_TMR_METRONOME);
_EXPORT_INT(m, SNDCTL_TMR_SELECT);
@@ -1135,4 +1148,5 @@ initossaudiodev(void)
_EXPORT_INT(m, SNDCTL_TMR_STOP);
_EXPORT_INT(m, SNDCTL_TMR_TEMPO);
_EXPORT_INT(m, SNDCTL_TMR_TIMEBASE);
+#endif
}

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-Modules_rgbimgmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/rgbimgmodule.c.orig Thu Feb 14 22:26:18 2008
+++ Modules/rgbimgmodule.c Tue Aug 5 18:18:52 2008
@@ -299,6 +299,11 @@ longimagedata(PyObject *self, PyObject *args)
xsize = image.xsize;
ysize = image.ysize;
zsize = image.zsize;
+ tablen = xsize * ysize * zsize * sizeof(Py_Int32);
+ if (xsize != (((tablen / ysize) / zsize) / sizeof(Py_Int32))) {
+ PyErr_NoMemory();
+ goto finally;
+ }
if (rle) {
tablen = ysize * zsize * sizeof(Py_Int32);
rlebuflen = (int) (1.05 * xsize +10);

View File

@ -1,17 +0,0 @@
$OpenBSD: patch-Modules_selectmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/selectmodule.c.orig Mon Jul 10 11:18:57 2006
+++ Modules/selectmodule.c Tue Aug 5 18:18:52 2008
@@ -349,10 +349,12 @@ update_ufd_array(pollObject *self)
{
Py_ssize_t i, pos;
PyObject *key, *value;
+ struct pollfd *old_ufds = self->ufds;
self->ufd_len = PyDict_Size(self->dict);
- PyMem_Resize(self->ufds, struct pollfd, self->ufd_len);
+ PyMem_RESIZE(self->ufds, struct pollfd, self->ufd_len);
if (self->ufds == NULL) {
+ self->ufds = old_ufds;
PyErr_NoMemory();
return 0;
}

View File

@ -1,32 +0,0 @@
$OpenBSD: patch-Modules_stropmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/stropmodule.c.orig Thu Feb 14 22:26:18 2008
+++ Modules/stropmodule.c Tue Aug 5 18:18:52 2008
@@ -216,6 +216,13 @@ strop_joinfields(PyObject *self, PyObject *args)
return NULL;
}
slen = PyString_GET_SIZE(item);
+ if (slen > PY_SSIZE_T_MAX - reslen ||
+ seplen > PY_SSIZE_T_MAX - reslen - seplen) {
+ PyErr_SetString(PyExc_OverflowError,
+ "input too long");
+ Py_DECREF(res);
+ return NULL;
+ }
while (reslen + slen + seplen >= sz) {
if (_PyString_Resize(&res, sz * 2) < 0)
return NULL;
@@ -253,6 +260,14 @@ strop_joinfields(PyObject *self, PyObject *args)
return NULL;
}
slen = PyString_GET_SIZE(item);
+ if (slen > PY_SSIZE_T_MAX - reslen ||
+ seplen > PY_SSIZE_T_MAX - reslen - seplen) {
+ PyErr_SetString(PyExc_OverflowError,
+ "input too long");
+ Py_DECREF(res);
+ Py_XDECREF(item);
+ return NULL;
+ }
while (reslen + slen + seplen >= sz) {
if (_PyString_Resize(&res, sz * 2) < 0) {
Py_DECREF(item);

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-Modules_zlibmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/zlibmodule.c.orig Wed Nov 21 11:44:57 2007
+++ Modules/zlibmodule.c Tue Aug 5 18:18:52 2008
@@ -774,6 +774,10 @@ PyZlib_unflush(compobject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "|i:flush", &length))
return NULL;
+ if (length <= 0) {
+ PyErr_SetString(PyExc_ValueError, "length must be greater than zero");
+ return NULL;
+ }
if (!(retval = PyString_FromStringAndSize(NULL, length)))
return NULL;

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-Objects_bufferobject_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Objects/bufferobject.c.orig Thu Feb 14 22:26:18 2008
+++ Objects/bufferobject.c Tue Aug 5 18:18:52 2008
@@ -427,6 +427,10 @@ buffer_repeat(PyBufferObject *self, Py_ssize_t count)
count = 0;
if (!get_buf(self, &ptr, &size, ANY_BUFFER))
return NULL;
+ if (count > PY_SSIZE_T_MAX / size) {
+ PyErr_SetString(PyExc_MemoryError, "result too large");
+ return NULL;
+ }
ob = PyString_FromStringAndSize(NULL, size * count);
if ( ob == NULL )
return NULL;

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-Objects_longobject_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Objects/longobject.c.orig Tue May 8 04:30:48 2007
+++ Objects/longobject.c Tue Aug 5 18:18:52 2008
@@ -70,6 +70,8 @@ _PyLong_New(Py_ssize_t size)
PyErr_NoMemory();
return NULL;
}
+ /* XXX(nnorwitz): This can overflow --
+ PyObject_NEW_VAR / _PyObject_VAR_SIZE need to detect overflow */
return PyObject_NEW_VAR(PyLongObject, &PyLong_Type, size);
}

View File

@ -1,35 +0,0 @@
$OpenBSD: patch-Objects_obmalloc_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Objects/obmalloc.c.orig Thu Feb 14 22:26:18 2008
+++ Objects/obmalloc.c Tue Aug 5 18:18:52 2008
@@ -727,6 +727,15 @@ PyObject_Malloc(size_t nbytes)
uint size;
/*
+ * Limit ourselves to PY_SSIZE_T_MAX bytes to prevent security holes.
+ * Most python internals blindly use a signed Py_ssize_t to track
+ * things without checking for overflows or negatives.
+ * As size_t is unsigned, checking for nbytes < 0 is not required.
+ */
+ if (nbytes > PY_SSIZE_T_MAX)
+ return NULL;
+
+ /*
* This implicitly redirects malloc(0).
*/
if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) {
@@ -1129,6 +1138,15 @@ PyObject_Realloc(void *p, size_t nbytes)
if (p == NULL)
return PyObject_Malloc(nbytes);
+
+ /*
+ * Limit ourselves to PY_SSIZE_T_MAX bytes to prevent security holes.
+ * Most python internals blindly use a signed Py_ssize_t to track
+ * things without checking for overflows or negatives.
+ * As size_t is unsigned, checking for nbytes < 0 is not required.
+ */
+ if (nbytes > PY_SSIZE_T_MAX)
+ return NULL;
pool = POOL_ADDR(p);
if (Py_ADDRESS_IN_RANGE(p, pool)) {

View File

@ -1,62 +0,0 @@
$OpenBSD: patch-Objects_stringobject_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Objects/stringobject.c.orig Wed Nov 7 12:19:49 2007
+++ Objects/stringobject.c Tue Aug 5 18:18:52 2008
@@ -54,6 +54,11 @@ PyString_FromStringAndSize(const char *str, Py_ssize_t
{
register PyStringObject *op;
assert(size >= 0);
+ if (size < 0) {
+ PyErr_SetString(PyExc_SystemError,
+ "Negative size passed to PyString_FromStringAndSize");
+ return NULL;
+ }
if (size == 0 && (op = nullstring) != NULL) {
#ifdef COUNT_ALLOCS
null_strings++;
@@ -71,6 +76,11 @@ PyString_FromStringAndSize(const char *str, Py_ssize_t
return (PyObject *)op;
}
+ if (size > PY_SSIZE_T_MAX - sizeof(PyStringObject)) {
+ PyErr_SetString(PyExc_OverflowError, "string is too large");
+ return NULL;
+ }
+
/* Inline PyObject_NewVar */
op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size);
if (op == NULL)
@@ -106,7 +116,7 @@ PyString_FromString(const char *str)
assert(str != NULL);
size = strlen(str);
- if (size > PY_SSIZE_T_MAX) {
+ if (size > PY_SSIZE_T_MAX - sizeof(PyStringObject)) {
PyErr_SetString(PyExc_OverflowError,
"string is too long for a Python string");
return NULL;
@@ -967,14 +977,24 @@ string_concat(register PyStringObject *a, register PyO
Py_INCREF(a);
return (PyObject *)a;
}
+ /* Check that string sizes are not negative, to prevent an
+ overflow in cases where we are passed incorrectly-created
+ strings with negative lengths (due to a bug in other code).
+ */
size = a->ob_size + b->ob_size;
- if (size < 0) {
+ if (a->ob_size < 0 || b->ob_size < 0 ||
+ a->ob_size > PY_SSIZE_T_MAX - b->ob_size) {
PyErr_SetString(PyExc_OverflowError,
"strings are too large to concat");
return NULL;
}
/* Inline PyObject_NewVar */
+ if (size > PY_SSIZE_T_MAX - sizeof(PyStringObject)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "strings are too large to concat");
+ return NULL;
+ }
op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size);
if (op == NULL)
return PyErr_NoMemory();

View File

@ -1,18 +0,0 @@
$OpenBSD: patch-Objects_tupleobject_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Objects/tupleobject.c.orig Sun Aug 13 03:03:09 2006
+++ Objects/tupleobject.c Tue Aug 5 18:18:52 2008
@@ -60,11 +60,12 @@ PyTuple_New(register Py_ssize_t size)
Py_ssize_t nbytes = size * sizeof(PyObject *);
/* Check for overflow */
if (nbytes / sizeof(PyObject *) != (size_t)size ||
- (nbytes += sizeof(PyTupleObject) - sizeof(PyObject *))
- <= 0)
+ (nbytes > PY_SSIZE_T_MAX - sizeof(PyTupleObject) - sizeof(PyObject *)))
{
return PyErr_NoMemory();
}
+ nbytes += sizeof(PyTupleObject) - sizeof(PyObject *);
+
op = PyObject_GC_NewVar(PyTupleObject, &PyTuple_Type, size);
if (op == NULL)
return NULL;

View File

@ -1,125 +0,0 @@
$OpenBSD: patch-Objects_unicodeobject_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Objects/unicodeobject.c.orig Sat Nov 3 09:46:38 2007
+++ Objects/unicodeobject.c Tue Aug 5 18:18:52 2008
@@ -239,6 +239,11 @@ PyUnicodeObject *_PyUnicode_New(Py_ssize_t length)
return unicode_empty;
}
+ /* Ensure we won't overflow the size. */
+ if (length > ((PY_SSIZE_T_MAX / sizeof(Py_UNICODE)) - 1)) {
+ return (PyUnicodeObject *)PyErr_NoMemory();
+ }
+
/* Unicode freelist & memory allocation */
if (unicode_freelist) {
unicode = unicode_freelist;
@@ -970,7 +975,7 @@ PyObject *PyUnicode_DecodeUTF7(const char *s,
while (s < e) {
Py_UNICODE ch;
restart:
- ch = *s;
+ ch = (unsigned char) *s;
if (inShift) {
if ((ch == '-') || !B64CHAR(ch)) {
@@ -1091,6 +1096,9 @@ PyObject *PyUnicode_EncodeUTF7(const Py_UNICODE *s,
char * out;
char * start;
+ if (cbAllocated / 5 != size)
+ return PyErr_NoMemory();
+
if (size == 0)
return PyString_FromStringAndSize(NULL, 0);
@@ -1689,8 +1697,9 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
{
PyObject *v;
unsigned char *p;
+ Py_ssize_t nsize, bytesize;
#ifdef Py_UNICODE_WIDE
- int i, pairs;
+ Py_ssize_t i, pairs;
#else
const int pairs = 0;
#endif
@@ -1713,8 +1722,15 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
if (s[i] >= 0x10000)
pairs++;
#endif
- v = PyString_FromStringAndSize(NULL,
- 2 * (size + pairs + (byteorder == 0)));
+ /* 2 * (size + pairs + (byteorder == 0)) */
+ if (size > PY_SSIZE_T_MAX ||
+ size > PY_SSIZE_T_MAX - pairs - (byteorder == 0))
+ return PyErr_NoMemory();
+ nsize = (size + pairs + (byteorder == 0));
+ bytesize = nsize * 2;
+ if (bytesize / 2 != nsize)
+ return PyErr_NoMemory();
+ v = PyString_FromStringAndSize(NULL, bytesize);
if (v == NULL)
return NULL;
@@ -2042,6 +2058,11 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
char *p;
static const char *hexdigit = "0123456789abcdef";
+#ifdef Py_UNICODE_WIDE
+ const Py_ssize_t expandsize = 10;
+#else
+ const Py_ssize_t expandsize = 6;
+#endif
/* Initial allocation is based on the longest-possible unichr
escape.
@@ -2057,13 +2078,12 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
escape.
*/
+ if (size > (PY_SSIZE_T_MAX - 2 - 1) / expandsize)
+ return PyErr_NoMemory();
+
repr = PyString_FromStringAndSize(NULL,
2
-#ifdef Py_UNICODE_WIDE
- + 10*size
-#else
- + 6*size
-#endif
+ + expandsize*size
+ 1);
if (repr == NULL)
return NULL;
@@ -2304,12 +2324,16 @@ PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UN
char *q;
static const char *hexdigit = "0123456789abcdef";
-
#ifdef Py_UNICODE_WIDE
- repr = PyString_FromStringAndSize(NULL, 10 * size);
+ const Py_ssize_t expandsize = 10;
#else
- repr = PyString_FromStringAndSize(NULL, 6 * size);
+ const Py_ssize_t expandsize = 6;
#endif
+
+ if (size > PY_SSIZE_T_MAX / expandsize)
+ return PyErr_NoMemory();
+
+ repr = PyString_FromStringAndSize(NULL, expandsize * size);
if (repr == NULL)
return NULL;
if (size == 0)
@@ -4719,6 +4743,11 @@ PyUnicodeObject *pad(PyUnicodeObject *self,
return self;
}
+ if (left > PY_SSIZE_T_MAX - self->length ||
+ right > PY_SSIZE_T_MAX - (left + self->length)) {
+ PyErr_SetString(PyExc_OverflowError, "padded string is too long");
+ return NULL;
+ }
u = _PyUnicode_New(left + self->length + right);
if (u) {
if (left)

View File

@ -1,56 +0,0 @@
$OpenBSD: patch-Python_mysnprintf_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Python/mysnprintf.c.orig Sat Dec 22 03:32:15 2001
+++ Python/mysnprintf.c Tue Aug 5 18:18:52 2008
@@ -54,18 +54,28 @@ int
PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
{
int len; /* # bytes written, excluding \0 */
-#ifndef HAVE_SNPRINTF
+#ifdef HAVE_SNPRINTF
+#define _PyOS_vsnprintf_EXTRA_SPACE 1
+#else
+#define _PyOS_vsnprintf_EXTRA_SPACE 512
char *buffer;
#endif
assert(str != NULL);
assert(size > 0);
assert(format != NULL);
+ /* We take a size_t as input but return an int. Sanity check
+ * our input so that it won't cause an overflow in the
+ * vsnprintf return value or the buffer malloc size. */
+ if (size > INT_MAX - _PyOS_vsnprintf_EXTRA_SPACE) {
+ len = -666;
+ goto Done;
+ }
#ifdef HAVE_SNPRINTF
len = vsnprintf(str, size, format, va);
#else
/* Emulate it. */
- buffer = PyMem_MALLOC(size + 512);
+ buffer = PyMem_MALLOC(size + _PyOS_vsnprintf_EXTRA_SPACE);
if (buffer == NULL) {
len = -666;
goto Done;
@@ -75,7 +85,7 @@ PyOS_vsnprintf(char *str, size_t size, const char *fo
if (len < 0)
/* ignore the error */;
- else if ((size_t)len >= size + 512)
+ else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE)
Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf");
else {
@@ -86,8 +96,10 @@ PyOS_vsnprintf(char *str, size_t size, const char *fo
str[to_copy] = '\0';
}
PyMem_FREE(buffer);
-Done:
#endif
- str[size-1] = '\0';
+Done:
+ if (size > 0)
+ str[size-1] = '\0';
return len;
+#undef _PyOS_vsnprintf_EXTRA_SPACE
}

View File

@ -1,16 +1,16 @@
$OpenBSD: patch-configure_in,v 1.5 2008/06/30 00:29:32 djm Exp $
--- configure.in.orig Wed Feb 13 20:17:17 2008
+++ configure.in Wed Jun 18 17:59:12 2008
$OpenBSD: patch-configure_in,v 1.6 2009/01/01 21:03:27 djm Exp $
--- configure.in.orig Sun Dec 14 01:13:52 2008
+++ configure.in Mon Dec 15 20:13:14 2008
@@ -201,7 +201,7 @@ case $ac_sys_system/$ac_sys_release in
# On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
# even though select is a POSIX function. Reported by J. Ribbens.
# Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
- OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0@:>@)
- OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@)
+ OpenBSD*)
define_xopen_source=no
# OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
# also defined. This can be overridden by defining _BSD_SOURCE
@@ -1526,19 +1526,7 @@ then
@@ -1522,19 +1522,7 @@ then
LDSHARED="ld -Bshareable ${LDFLAGS}"
fi;;
OpenBSD*)
@ -31,7 +31,7 @@ $OpenBSD: patch-configure_in,v 1.5 2008/06/30 00:29:32 djm Exp $
NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
OpenUNIX*|UnixWare*)
if test "$GCC" = "yes"
@@ -1682,9 +1670,10 @@ AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-U
@@ -1678,9 +1666,10 @@ AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-U
# only check for sem_ini if thread support is requested
if test "$with_threads" = "yes" -o -z "$with_threads"; then
@ -43,27 +43,3 @@ $OpenBSD: patch-configure_in,v 1.5 2008/06/30 00:29:32 djm Exp $
fi
# check if we need libintl for locale functions
@@ -3104,7 +3093,7 @@ fi
# check for readline 2.1
AC_CHECK_LIB(readline, rl_callback_handler_install,
AC_DEFINE(HAVE_RL_CALLBACK, 1,
- [Define if you have readline 2.1]), , )
+ [Define if you have readline 2.1]), ,curses)
# check for readline 2.2
AC_TRY_CPP([#include <readline/readline.h>],
@@ -3120,12 +3109,12 @@ fi
# check for readline 4.0
AC_CHECK_LIB(readline, rl_pre_input_hook,
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
- [Define if you have readline 4.0]), , )
+ [Define if you have readline 4.0]), ,curses)
# check for readline 4.2
AC_CHECK_LIB(readline, rl_completion_matches,
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
- [Define if you have readline 4.2]), , )
+ [Define if you have readline 4.2]), ,curses)
# also in readline 4.2
AC_TRY_CPP([#include <readline/readline.h>],

View File

@ -1,18 +1,30 @@
$OpenBSD: patch-setup_py,v 1.4 2008/02/27 00:30:47 djm Exp $
--- setup.py.orig Tue Feb 5 10:41:02 2008
+++ setup.py Tue Feb 19 23:59:33 2008
@@ -244,8 +244,8 @@ class PyBuildExt(build_ext):
$OpenBSD: patch-setup_py,v 1.5 2009/01/01 21:03:27 djm Exp $
--- setup.py.orig Fri Oct 17 04:58:19 2008
+++ setup.py Fri Dec 26 12:42:10 2008
@@ -17,6 +17,11 @@ 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 = []
+def usrlocal(p):
+ return os.path.join(os.environ['LOCALBASE'], p)
+def usrx11r6(p):
+ return os.path.join(os.environ['X11BASE'], p)
+
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
1) 'dir' is not already in 'dirlist'
@@ -244,8 +249,8 @@ class PyBuildExt(build_ext):
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_dir_to_list(self.compiler.library_dirs, '!!LOCALBASE!!/lib')
+ add_dir_to_list(self.compiler.include_dirs, '!!LOCALBASE!!/include')
+ add_dir_to_list(self.compiler.library_dirs, usrlocal('lib'))
+ add_dir_to_list(self.compiler.include_dirs, usrlocal('include'))
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -521,8 +521,6 @@ class PyBuildExt(build_ext):
@@ -522,8 +527,6 @@ class PyBuildExt(build_ext):
depends = ['socketmodule.h']) )
# Detect SSL support for the socket module (via _ssl)
search_for_ssl_incs_in = [
@ -21,7 +33,7 @@ $OpenBSD: patch-setup_py,v 1.4 2008/02/27 00:30:47 djm Exp $
]
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
search_for_ssl_incs_in
@@ -533,9 +531,7 @@ class PyBuildExt(build_ext):
@@ -534,9 +537,7 @@ class PyBuildExt(build_ext):
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
@ -32,388 +44,142 @@ $OpenBSD: patch-setup_py,v 1.4 2008/02/27 00:30:47 djm Exp $
if (ssl_incs is not None and
ssl_libs is not None):
@@ -592,223 +588,15 @@ class PyBuildExt(build_ext):
exts.append( Extension('_sha256', ['sha256module.c']) )
exts.append( Extension('_sha512', ['sha512module.c']) )
@@ -609,12 +610,12 @@ class PyBuildExt(build_ext):
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
-
- # Modules that provide persistent dictionary-like semantics. You will
- # probably want to arrange for at least one of them to be available on
- # your machine, though none are defined by default because of library
- # dependencies. The Python module anydbm.py provides an
- # implementation independent wrapper for these; dumbdbm.py provides
- # similar functionality (but slower of course) implemented in Python.
-
- # Sleepycat^WOracle Berkeley DB interface.
- # http://www.oracle.com/database/berkeley-db/db/index.html
- #
- # This requires the Sleepycat^WOracle DB code. The supported versions
- # are set below. Visit the URL above to download
- # a release. Most open source OSes come with one or more
- # versions of BerkeleyDB already installed.
-
- max_db_ver = (4, 5)
- # NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
- # we leave that version disabled by default as it has proven to be
- # quite a buggy library release on many platforms.
- min_db_ver = (3, 3)
+ max_db_ver = (4, 7)
# NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
# we leave that version disabled by default as it has proven to be
# quite a buggy library release on many platforms.
min_db_ver = (3, 3)
- db_setup_debug = False # verbose debug prints from this script?
-
- # construct a list of paths to look for the header file in on
- # top of the normal inc_dirs.
- db_inc_paths = [
- '/usr/include/db4',
- '/usr/local/include/db4',
- '/opt/sfw/include/db4',
- '/sw/include/db4',
- '/usr/include/db3',
- '/usr/local/include/db3',
- '/opt/sfw/include/db3',
- '/sw/include/db3',
- ]
- # 4.x minor number specific paths
- for x in range(max_db_ver[1]+1):
- db_inc_paths.append('/usr/include/db4%d' % x)
- db_inc_paths.append('/usr/include/db4.%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db4%d' % x)
- db_inc_paths.append('/pkg/db-4.%d/include' % x)
- db_inc_paths.append('/opt/db-4.%d/include' % x)
- # 3.x minor number specific paths
- for x in (3,):
- db_inc_paths.append('/usr/include/db3%d' % x)
- db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
- db_inc_paths.append('/usr/local/include/db3%d' % x)
- db_inc_paths.append('/pkg/db-3.%d/include' % x)
- db_inc_paths.append('/opt/db-3.%d/include' % x)
-
- # Add some common subdirectories for Sleepycat DB to the list,
- # based on the standard include directories. This way DB3/4 gets
- # picked up when it is installed in a non-standard prefix and
- # the user has added that prefix into inc_dirs.
- std_variants = []
- for dn in inc_dirs:
- std_variants.append(os.path.join(dn, 'db3'))
- std_variants.append(os.path.join(dn, 'db4'))
- for x in range(max_db_ver[1]+1):
- std_variants.append(os.path.join(dn, "db4%d"%x))
- std_variants.append(os.path.join(dn, "db4.%d"%x))
- for x in (2,3):
- std_variants.append(os.path.join(dn, "db3%d"%x))
- std_variants.append(os.path.join(dn, "db3.%d"%x))
-
- db_inc_paths = std_variants + db_inc_paths
-
-
- db_ver_inc_map = {}
-
- class db_found(Exception): pass
- try:
- # See whether there is a Sleepycat header in the standard
- # search path.
- for d in inc_dirs + db_inc_paths:
- f = os.path.join(d, "db.h")
- if db_setup_debug: print "db: looking for db.h in", f
- if os.path.exists(f):
- f = open(f).read()
- m = re.search(r"#define\WDB_VERSION_MAJOR\W(\d+)", f)
- if m:
- db_major = int(m.group(1))
- m = re.search(r"#define\WDB_VERSION_MINOR\W(\d+)", f)
- db_minor = int(m.group(1))
- db_ver = (db_major, db_minor)
-
- # Avoid 4.6 prior to 4.6.21 due to a BerkeleyDB bug
- if db_ver == (4, 6):
- m = re.search(r"#define\WDB_VERSION_PATCH\W(\d+)", f)
- db_patch = int(m.group(1))
- if db_patch < 21:
- print "db.h:", db_ver, "patch", db_patch,
- print "being ignored (4.6.x must be >= 4.6.21)"
- continue
-
- if ( (not db_ver_inc_map.has_key(db_ver)) and
- (db_ver <= max_db_ver and db_ver >= min_db_ver) ):
- # save the include directory with the db.h version
- # (first occurrance only)
- db_ver_inc_map[db_ver] = d
- print "db.h: found", db_ver, "in", d
- else:
- # we already found a header for this library version
- if db_setup_debug: print "db.h: ignoring", d
- else:
- # ignore this header, it didn't contain a version number
+ db_setup_debug = True # verbose debug prints from this script?
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.
@@ -660,6 +661,7 @@ class PyBuildExt(build_ext):
std_variants.append(os.path.join(dn, "db3.%d"%x))
db_inc_paths = std_variants + db_inc_paths
+ db_inc_paths = [ usrlocal('include/db4') ]
db_ver_inc_map = {}
@@ -700,7 +702,7 @@ class PyBuildExt(build_ext):
if db_setup_debug: print "db.h: ignoring", d
else:
# ignore this header, it didn't contain a version number
- if db_setup_debug: print "db.h: unsupported version", db_ver, "in", d
-
- db_found_vers = db_ver_inc_map.keys()
- db_found_vers.sort()
-
- while db_found_vers:
- db_ver = db_found_vers.pop()
- db_incdir = db_ver_inc_map[db_ver]
-
- # check lib directories parallel to the location of the header
- db_dirs_to_check = [
- os.path.join(db_incdir, '..', 'lib64'),
- os.path.join(db_incdir, '..', 'lib'),
- os.path.join(db_incdir, '..', '..', 'lib64'),
- os.path.join(db_incdir, '..', '..', 'lib'),
- ]
- db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
-
- # Look for a version specific db-X.Y before an ambiguoius dbX
- # XXX should we -ever- look for a dbX name? Do any
- # systems really not name their library by version and
- # symlink to more general names?
- for dblib in (('db-%d.%d' % db_ver),
- ('db%d%d' % db_ver),
- ('db%d' % db_ver[0])):
- dblib_file = self.compiler.find_library_file(
- db_dirs_to_check + lib_dirs, dblib )
- if dblib_file:
- dblib_dir = [ os.path.abspath(os.path.dirname(dblib_file)) ]
- raise db_found
- else:
- if db_setup_debug: print "db lib: ", dblib, "not found"
-
- except db_found:
- print "db lib: using", db_ver, dblib
- if db_setup_debug: print "db: lib dir", dblib_dir, "inc dir", db_incdir
- db_incs = [db_incdir]
- dblibs = [dblib]
- # We add the runtime_library_dirs argument because the
- # BerkeleyDB lib we're linking against often isn't in the
- # system dynamic library search path. This is usually
- # correct and most trouble free, but may cause problems in
- # some unusual system configurations (e.g. the directory
- # is on an NFS server that goes away).
+ if !!USE_BSDDB!!:
exts.append(Extension('_bsddb', ['_bsddb.c'],
- library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
- include_dirs=db_incs,
- libraries=dblibs))
- else:
- if db_setup_debug: print "db: no appropriate library found"
- db_incs = None
- dblibs = []
- dblib_dir = None
+ library_dirs=["!!LOCALBASE!!/lib/db4"],
+ runtime_library_dirs=["!!LOCALBASE!!/lib/db4"],
+ include_dirs=["!!LOCALBASE!!/include/db4"],
+ libraries=["db"]))
+ if db_setup_debug: print "db.h: no version in", d
- # The sqlite interface
- sqlite_setup_debug = False # verbose debug prints from this script?
db_found_vers = db_ver_inc_map.keys()
db_found_vers.sort()
@@ -717,12 +719,14 @@ class PyBuildExt(build_ext):
os.path.join(db_incdir, '..', '..', 'lib'),
]
db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
+ db_dirs_to_check = [ usrlocal('lib/db4') ]
- # We hunt for #define SQLITE_VERSION "n.n.n"
- # We need to find >= sqlite version 3.0.8
- sqlite_incdir = sqlite_libdir = None
- sqlite_inc_paths = [ '/usr/include',
- '/usr/include/sqlite',
- '/usr/include/sqlite3',
- '/usr/local/include',
- '/usr/local/include/sqlite',
- '/usr/local/include/sqlite3',
- ]
- MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
- MIN_SQLITE_VERSION = ".".join([str(x)
- for x in MIN_SQLITE_VERSION_NUMBER])
-
- # Scan the default include directories before the SQLite specific
- # ones. This allows one to override the copy of sqlite on OSX,
- # where /usr/include contains an old version of sqlite.
- for d in inc_dirs + sqlite_inc_paths:
- f = os.path.join(d, "sqlite3.h")
- if os.path.exists(f):
- if sqlite_setup_debug: print "sqlite: found %s"%f
- incf = open(f).read()
- m = re.search(
- r'\s*.*#\s*.*define\s.*SQLITE_VERSION\W*"(.*)"', incf)
- if m:
- sqlite_version = m.group(1)
- sqlite_version_tuple = tuple([int(x)
- for x in sqlite_version.split(".")])
- if sqlite_version_tuple >= MIN_SQLITE_VERSION_NUMBER:
- # we win!
- print "%s/sqlite3.h: version %s"%(d, sqlite_version)
- sqlite_incdir = d
- break
- else:
- if sqlite_setup_debug:
- print "%s: version %d is too old, need >= %s"%(d,
- sqlite_version, MIN_SQLITE_VERSION)
- elif sqlite_setup_debug:
- print "sqlite: %s had no SQLITE_VERSION"%(f,)
-
- if sqlite_incdir:
- sqlite_dirs_to_check = [
- os.path.join(sqlite_incdir, '..', 'lib64'),
- os.path.join(sqlite_incdir, '..', 'lib'),
- os.path.join(sqlite_incdir, '..', '..', 'lib64'),
- os.path.join(sqlite_incdir, '..', '..', 'lib'),
- ]
- sqlite_libfile = self.compiler.find_library_file(
- sqlite_dirs_to_check + lib_dirs, 'sqlite3')
- sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
-
- if sqlite_incdir and sqlite_libdir:
+ if !!USE_SQLITE!!:
sqlite_srcs = ['_sqlite/cache.c',
'_sqlite/connection.c',
'_sqlite/cursor.c',
@@ -818,31 +606,14 @@ class PyBuildExt(build_ext):
'_sqlite/row.c',
'_sqlite/statement.c',
'_sqlite/util.c', ]
-
sqlite_defines = []
- if sys.platform != "win32":
- sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
- else:
- sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
-
-
- if sys.platform == 'darwin':
- # In every directory on the search path search for a dynamic
- # library and then a static library, instead of first looking
- # for dynamic libraries on the entiry path.
- # This way a staticly linked custom sqlite gets picked up
- # before the dynamic library in /usr/lib.
- sqlite_extra_link_args = ('-Wl,-search_paths_first',)
- else:
- sqlite_extra_link_args = ()
-
+ sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
exts.append(Extension('_sqlite3', sqlite_srcs,
define_macros=sqlite_defines,
include_dirs=["Modules/_sqlite",
- sqlite_incdir],
- library_dirs=sqlite_libdir,
- runtime_library_dirs=sqlite_libdir,
- extra_link_args=sqlite_extra_link_args,
+ "!!LOCALBASE!!/include"],
+ library_dirs=["!!LOCALBASE!!/lib"],
+ runtime_library_dirs=["!!LOCALBASE!!/lib"],
libraries=["sqlite3",]))
# Look for Berkeley db 1.85. Note that it is built as a different
@@ -856,6 +627,7 @@ class PyBuildExt(build_ext):
# we do not build this one. Otherwise this build will pick up
# Look for a version specific db-X.Y before an ambiguoius dbX
# XXX should we -ever- look for a dbX name? Do any
# systems really not name their library by version and
# symlink to more general names?
for dblib in (('db-%d.%d' % db_ver),
+ ('db'),
('db%d%d' % db_ver),
('db%d' % db_ver[0])):
dblib_file = self.compiler.find_library_file(
@@ -768,6 +772,7 @@ class PyBuildExt(build_ext):
'/usr/local/include/sqlite',
'/usr/local/include/sqlite3',
]
+ sqlite_inc_paths = [ usrlocal('include') ]
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
MIN_SQLITE_VERSION = ".".join([str(x)
for x in MIN_SQLITE_VERSION_NUMBER])
@@ -805,6 +810,7 @@ class PyBuildExt(build_ext):
os.path.join(sqlite_incdir, '..', '..', 'lib64'),
os.path.join(sqlite_incdir, '..', '..', 'lib'),
]
+ sqlite_dirs_to_check = [ usrlocal('lib') ]
sqlite_libfile = self.compiler.find_library_file(
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
@@ -858,7 +864,7 @@ class PyBuildExt(build_ext):
# the more recent berkeleydb's db.h file first in the include path
# when attempting to compile and it will fail.
+ db_incs = []
f = "/usr/include/db.h"
if os.path.exists(f) and not db_incs:
- if os.path.exists(f) and not db_incs:
+ if os.path.exists(f):
data = open(f).read()
@@ -897,8 +669,7 @@ class PyBuildExt(build_ext):
('DB_DBM_HSEARCH',None)],
libraries=dblibs))
- # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
- if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
+ if !!USE_GDBM!!:
exts.append( Extension('gdbm', ['gdbmmodule.c'],
libraries = ['gdbm'] ) )
@@ -989,53 +760,35 @@ class PyBuildExt(build_ext):
libraries = ['z'],
extra_link_args = zlib_extra_link_args))
- # Gustavo Niemeyer's bz2 module.
- if (self.compiler.find_library_file(lib_dirs, 'bz2')):
- if sys.platform == "darwin":
- bz2_extra_link_args = ('-Wl,-search_paths_first',)
- else:
- bz2_extra_link_args = ()
+ if !!USE_BZ2!!:
exts.append( Extension('bz2', ['bz2module.c'],
- libraries = ['bz2'],
- extra_link_args = bz2_extra_link_args) )
+ libraries = ['bz2']) )
- # Interface to the Expat XML parser
- #
- # Expat was written by James Clark and is now maintained by a
- # group of developers on SourceForge; see www.libexpat.org for
- # more information. The pyexpat module was written by Paul
- # Prescod after a prototype by Jack Jansen. The Expat source
- # is included in Modules/expat/. Usage of a system
- # shared libexpat.so/expat.dll is not advised.
- #
- # More information on Expat can be found at www.libexpat.org.
- #
- expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
- define_macros = [
- ('HAVE_EXPAT_CONFIG_H', '1'),
- ]
-
- exts.append(Extension('pyexpat',
- define_macros = define_macros,
- include_dirs = [expatinc],
- sources = ['pyexpat.c',
m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
if m is not None:
@@ -1020,10 +1026,8 @@ class PyBuildExt(build_ext):
define_macros = define_macros,
include_dirs = [expatinc],
sources = ['pyexpat.c',
- 'expat/xmlparse.c',
- 'expat/xmlrole.c',
- 'expat/xmltok.c',
- ],
- ))
-
- # Fredrik Lundh's cElementTree module. Note that this also
- # uses expat (via the CAPI hook in pyexpat).
-
- if os.path.isfile(os.path.join(srcdir, 'Modules', '_elementtree.c')):
- define_macros.append(('USE_PYEXPAT_CAPI', None))
- exts.append(Extension('_elementtree',
+ if !!USE_EXPAT!!:
+ expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
+ define_macros = [
+ ('HAVE_EXPAT_CONFIG_H', '1'),
+ ]
+
+ exts.append(Extension('pyexpat',
define_macros = define_macros,
- include_dirs = [expatinc],
- sources = ['_elementtree.c'],
+ include_dirs = ["!!X11BASE!!/include", expatinc],
+ library_dirs = ["!!X11BASE!!/lib"],
+ sources = ['pyexpat.c'],
+ ],
+ libraries = ['expat'],
))
+ # Fredrik Lundh's cElementTree module. Note that this also
+ # uses expat (via the CAPI hook in pyexpat).
+
+ if os.path.isfile(os.path.join(srcdir, 'Modules', '_elementtree.c')):
+ define_macros.append(('USE_PYEXPAT_CAPI', None))
+ exts.append(Extension('_elementtree',
+ define_macros = define_macros,
+ include_dirs = [expatinc],
+ sources = ['_elementtree.c'],
+ ))
+
# Hye-Shik Chang's CJKCodecs modules.
if have_unicode:
exts.append(Extension('_multibytecodec',
@@ -1151,8 +904,16 @@ class PyBuildExt(build_ext):
# Fredrik Lundh's cElementTree module. Note that this also
@@ -1063,6 +1067,9 @@ class PyBuildExt(build_ext):
if platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
'freebsd7'):
exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
+ elif platform in ('openbsd4'):
+ exts.append( Extension('ossaudiodev', ['ossaudiodev.c'],
+ libraries = ['ossaudio'],) )
self.extensions.extend(exts)
if platform == 'sunos5':
# SunOS specific modules
@@ -1195,7 +1202,7 @@ class PyBuildExt(build_ext):
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
+ include_dirs.append(usrx11r6('include'))
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
- # Call the method for detecting whether _tkinter can be compiled
- self.detect_tkinter(inc_dirs, lib_dirs)
+ if !!USE_TKINTER!!:
+ ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
+ define_macros=[('WITH_APPINIT', 1)],
+ include_dirs = ["!!LOCALBASE!!/include/tcl8.4",
+ "!!LOCALBASE!!/include/tk8.4",
+ "!!X11BASE!!/include"],
+ libraries = ["tk84", "tcl84", "X11"],
+ library_dirs = ["!!LOCALBASE!!/lib", "!!X11BASE!!/lib"],
+ )
+ self.extensions.append(ext)
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@@ -1224,8 +1231,7 @@ class PyBuildExt(build_ext):
# The versions with dots are used on Unix, and the versions without
# dots on Windows, for detection by cygwin.
tcllib = tklib = tcl_includes = tk_includes = None
- for version in ['8.5', '85', '8.4', '84', '8.3', '83', '8.2',
- '82', '8.1', '81', '8.0', '80']:
+ for version in ['84']:
tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version)
tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version)
if tklib and tcllib:
@@ -1266,17 +1272,9 @@ class PyBuildExt(build_ext):
if platform == 'sunos5':
include_dirs.append('/usr/openwin/include')
added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
- # Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
+ elif True:
+ include_dirs.append(usrx11r6('include'))
+ added_lib_dirs.append(usrx11r6('lib'))
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
# The _tkinter module, using frameworks. Since frameworks are quite
@@ -1535,8 +1296,7 @@ def main():
# If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin':
@@ -1536,8 +1534,7 @@ def main():
ext_modules=[Extension('_struct', ['_struct.c'])],
# Scripts to install

View File

@ -1 +0,0 @@
This package contains bzip2 compression module.

View File

@ -1 +0,0 @@
This package contains support for the expat XML parser.

View File

@ -13,12 +13,3 @@ dynamically loaded. Python is also adaptable as an
extension language for existing applications. See the
internal documentation for hints.
Flavors:
no_bsddb - do not build bsdb package
no_expat - do not build expat package
no_gdbm - do not build gdbm package
no_idle - do not build idle package
no_mpz - do not build mpz package
no_tests - do not build tests package
no_tkinter - do not build tkinter package
no_tools - do not build tools package

View File

@ -1,15 +0,0 @@
Python is an interpreted, interactive, object-oriented programming
language that combines remarkable power with very clear syntax. For
an introduction to programming in Python you are referred to the
Python Tutorial. The Python Library Reference documents built-in
and standard types, constants, functions and modules. Finally, the
Python Reference Manual describes the syntax and semantics of the
core language in (perhaps too) much detail.
Python's basic power can be extended with your own modules written
in C or C++. On most systems such modules may be dynamically loaded.
Python is also adaptable as an extension language for existing
applications. See the internal documentation for hints.
This package contains the sqlite3 module, for using the SQLite
database library in Python.

View File

@ -1,4 +0,0 @@
@comment $OpenBSD: PLIST-bz2,v 1.1 2006/11/01 20:59:18 alek Exp $
@option no-default-conflict
@conflict python-bz2->=2.5,<2.6
lib/python2.5/lib-dynload/bz2.so

View File

@ -1,5 +0,0 @@
@comment $OpenBSD: PLIST-expat,v 1.1 2006/11/01 20:59:18 alek Exp $
@option no-default-conflict
@conflict python-expat->=2.5,<2.6
lib/python2.5/lib-dynload/_elementtree.so
lib/python2.5/lib-dynload/pyexpat.so

View File

@ -1,6 +1,9 @@
@comment $OpenBSD: PLIST-main,v 1.8 2008/10/18 12:01:25 djm Exp $
@comment $OpenBSD: PLIST-main,v 1.9 2009/01/01 21:03:27 djm Exp $
@option no-default-conflict
@conflict python->=2.5,<2.6
@conflict python-bz2->=2.5,<2.6
@conflict python-expat->=2.5,<2.6
@conflict python-sqlite->=2.5,<2.6
@pkgpath lang/python/2.5
bin/pydoc2.5
@comment bin/python-config
@ -1170,7 +1173,7 @@ lib/python2.5/keyword.py
lib/python2.5/keyword.pyc
lib/python2.5/keyword.pyo
lib/python2.5/lib-dynload/
lib/python2.5/lib-dynload/Python-2.5.2-py2.5.egg-info
lib/python2.5/lib-dynload/Python-2.5.4-py2.5.egg-info
lib/python2.5/lib-dynload/_bisect.so
lib/python2.5/lib-dynload/_codecs_cn.so
lib/python2.5/lib-dynload/_codecs_hk.so
@ -1181,6 +1184,7 @@ lib/python2.5/lib-dynload/_codecs_tw.so
lib/python2.5/lib-dynload/_csv.so
lib/python2.5/lib-dynload/_curses.so
lib/python2.5/lib-dynload/_curses_panel.so
lib/python2.5/lib-dynload/_elementtree.so
lib/python2.5/lib-dynload/_functools.so
lib/python2.5/lib-dynload/_hashlib.so
lib/python2.5/lib-dynload/_heapq.so
@ -1190,6 +1194,7 @@ lib/python2.5/lib-dynload/_lsprof.so
lib/python2.5/lib-dynload/_multibytecodec.so
lib/python2.5/lib-dynload/_random.so
lib/python2.5/lib-dynload/_socket.so
lib/python2.5/lib-dynload/_sqlite3.so
lib/python2.5/lib-dynload/_ssl.so
lib/python2.5/lib-dynload/_struct.so
lib/python2.5/lib-dynload/_testcapi.so
@ -1198,6 +1203,7 @@ lib/python2.5/lib-dynload/array.so
lib/python2.5/lib-dynload/audioop.so
lib/python2.5/lib-dynload/binascii.so
lib/python2.5/lib-dynload/bsddb185.so
lib/python2.5/lib-dynload/bz2.so
lib/python2.5/lib-dynload/cPickle.so
lib/python2.5/lib-dynload/cStringIO.so
lib/python2.5/lib-dynload/cmath.so
@ -1212,7 +1218,9 @@ lib/python2.5/lib-dynload/math.so
lib/python2.5/lib-dynload/mmap.so
lib/python2.5/lib-dynload/nis.so
lib/python2.5/lib-dynload/operator.so
lib/python2.5/lib-dynload/ossaudiodev.so
lib/python2.5/lib-dynload/parser.so
lib/python2.5/lib-dynload/pyexpat.so
lib/python2.5/lib-dynload/readline.so
lib/python2.5/lib-dynload/resource.so
lib/python2.5/lib-dynload/select.so
@ -1426,6 +1434,38 @@ lib/python2.5/sndhdr.pyo
lib/python2.5/socket.py
lib/python2.5/socket.pyc
lib/python2.5/socket.pyo
lib/python2.5/sqlite3/
lib/python2.5/sqlite3/__init__.py
lib/python2.5/sqlite3/__init__.pyc
lib/python2.5/sqlite3/__init__.pyo
lib/python2.5/sqlite3/dbapi2.py
lib/python2.5/sqlite3/dbapi2.pyc
lib/python2.5/sqlite3/dbapi2.pyo
lib/python2.5/sqlite3/test/
lib/python2.5/sqlite3/test/__init__.py
lib/python2.5/sqlite3/test/__init__.pyc
lib/python2.5/sqlite3/test/__init__.pyo
lib/python2.5/sqlite3/test/dbapi.py
lib/python2.5/sqlite3/test/dbapi.pyc
lib/python2.5/sqlite3/test/dbapi.pyo
lib/python2.5/sqlite3/test/factory.py
lib/python2.5/sqlite3/test/factory.pyc
lib/python2.5/sqlite3/test/factory.pyo
lib/python2.5/sqlite3/test/hooks.py
lib/python2.5/sqlite3/test/hooks.pyc
lib/python2.5/sqlite3/test/hooks.pyo
lib/python2.5/sqlite3/test/regression.py
lib/python2.5/sqlite3/test/regression.pyc
lib/python2.5/sqlite3/test/regression.pyo
lib/python2.5/sqlite3/test/transactions.py
lib/python2.5/sqlite3/test/transactions.pyc
lib/python2.5/sqlite3/test/transactions.pyo
lib/python2.5/sqlite3/test/types.py
lib/python2.5/sqlite3/test/types.pyc
lib/python2.5/sqlite3/test/types.pyo
lib/python2.5/sqlite3/test/userfunctions.py
lib/python2.5/sqlite3/test/userfunctions.pyc
lib/python2.5/sqlite3/test/userfunctions.pyo
lib/python2.5/sre.py
lib/python2.5/sre.pyc
lib/python2.5/sre.pyo

View File

@ -1,36 +0,0 @@
@comment $OpenBSD: PLIST-sqlite,v 1.1 2006/11/01 20:59:18 alek Exp $
@option no-default-conflict
@conflict python-sqlite3->=2.5,<2.6
lib/python2.5/lib-dynload/_sqlite3.so
lib/python2.5/sqlite3/
lib/python2.5/sqlite3/__init__.py
lib/python2.5/sqlite3/__init__.pyc
lib/python2.5/sqlite3/__init__.pyo
lib/python2.5/sqlite3/dbapi2.py
lib/python2.5/sqlite3/dbapi2.pyc
lib/python2.5/sqlite3/dbapi2.pyo
lib/python2.5/sqlite3/test/
lib/python2.5/sqlite3/test/__init__.py
lib/python2.5/sqlite3/test/__init__.pyc
lib/python2.5/sqlite3/test/__init__.pyo
lib/python2.5/sqlite3/test/dbapi.py
lib/python2.5/sqlite3/test/dbapi.pyc
lib/python2.5/sqlite3/test/dbapi.pyo
lib/python2.5/sqlite3/test/factory.py
lib/python2.5/sqlite3/test/factory.pyc
lib/python2.5/sqlite3/test/factory.pyo
lib/python2.5/sqlite3/test/hooks.py
lib/python2.5/sqlite3/test/hooks.pyc
lib/python2.5/sqlite3/test/hooks.pyo
lib/python2.5/sqlite3/test/regression.py
lib/python2.5/sqlite3/test/regression.pyc
lib/python2.5/sqlite3/test/regression.pyo
lib/python2.5/sqlite3/test/transactions.py
lib/python2.5/sqlite3/test/transactions.pyc
lib/python2.5/sqlite3/test/transactions.pyo
lib/python2.5/sqlite3/test/types.py
lib/python2.5/sqlite3/test/types.pyc
lib/python2.5/sqlite3/test/types.pyo
lib/python2.5/sqlite3/test/userfunctions.py
lib/python2.5/sqlite3/test/userfunctions.pyc
lib/python2.5/sqlite3/test/userfunctions.pyo

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-tests,v 1.3 2008/02/27 00:30:47 djm Exp $
@comment $OpenBSD: PLIST-tests,v 1.4 2009/01/01 21:03:27 djm Exp $
@option no-default-conflict
@conflict python-tests->=2.5,<2.6
lib/python2.5/test/
@ -227,7 +227,6 @@ lib/python2.5/test/output/test_profile
lib/python2.5/test/output/test_pty
lib/python2.5/test/output/test_pyexpat
lib/python2.5/test/output/test_regex
lib/python2.5/test/output/test_resource
lib/python2.5/test/output/test_rgbimg
lib/python2.5/test/output/test_scope
lib/python2.5/test/output/test_signal

View File

@ -1,9 +1,8 @@
# $OpenBSD: Makefile,v 1.2 2008/10/19 07:13:45 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.3 2009/01/01 21:03:27 djm Exp $
VERSION= 2.6
#PATCHLEVEL=
#PSUBDIR= python/2.6
PKG_PATCHLEVEL= p0
PATCHLEVEL= .1
#PKG_PATCHLEVEL=
SHARED_LIBS= python2.6 1.0
# PSUBDIR= python/${VERSION}

View File

@ -1,5 +1,5 @@
MD5 (Python-2.6.tgz) = 0W0pp32yzTr4gqWR9DGkAw==
RMD160 (Python-2.6.tgz) = tE1cx++hmLIfQeQ+HSivYIdfCk4=
SHA1 (Python-2.6.tgz) = 1/0IMEtmy0AgeGp+5apFIjUEbs0=
SHA256 (Python-2.6.tgz) = fC8hqWinN6We0HKfSx3BVNw6oYPCC+lgVRhv5DxnQtA=
SIZE (Python-2.6.tgz) = 13023860
MD5 (Python-2.6.1.tgz) = UrPUIfQrrP3K9V9WwP+b5A==
RMD160 (Python-2.6.1.tgz) = Dn9XumHXN1wUim/y5VDNSUOizos=
SHA1 (Python-2.6.1.tgz) = Learu/nu77ygV0qv7Cpy5la6fQM=
SHA256 (Python-2.6.1.tgz) = +2XpNnjhMn4+hVnMVuHgDtjAcWKyEoejUCZ3iSxcUVw=
SIZE (Python-2.6.1.tgz) = 13046455

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-Lib_test_regrtest_py,v 1.1 2008/10/18 12:03:56 djm Exp $
--- Lib/test/regrtest.py.orig Sat Jul 19 00:26:35 2008
+++ Lib/test/regrtest.py Sun Sep 28 05:12:36 2008
@@ -1073,6 +1073,7 @@ _expectations = {
$OpenBSD: patch-Lib_test_regrtest_py,v 1.2 2009/01/01 21:03:27 djm Exp $
--- Lib/test/regrtest.py.orig Tue Sep 30 10:15:45 2008
+++ Lib/test/regrtest.py Sun Dec 21 10:00:44 2008
@@ -1074,6 +1074,7 @@ _expectations = {
test_epoll
test_gdbm
test_locale
@ -9,7 +9,7 @@ $OpenBSD: patch-Lib_test_regrtest_py,v 1.1 2008/10/18 12:03:56 djm Exp $
test_normalization
test_ossaudiodev
test_pep277
@@ -1098,6 +1099,8 @@ _expectations['freebsd5'] = _expectations['freebsd4']
@@ -1101,6 +1102,8 @@ _expectations['freebsd5'] = _expectations['freebsd4']
_expectations['freebsd6'] = _expectations['freebsd4']
_expectations['freebsd7'] = _expectations['freebsd4']
_expectations['freebsd8'] = _expectations['freebsd4']

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-Modules__multiprocessing_multiprocessing_h,v 1.1 2008/10/18 12:03:56 djm Exp $
--- Modules/_multiprocessing/multiprocessing.h.orig Sat Aug 23 08:53:09 2008
+++ Modules/_multiprocessing/multiprocessing.h Sat Aug 23 08:53:35 2008
@@ -21,6 +21,7 @@
#else
# include <fcntl.h> /* O_CREAT and O_EXCL */
# include <sys/socket.h>
+# include <sys/uio.h> /* struct iovec */
# include <arpa/inet.h> /* htonl() and ntohl() */
# if HAVE_SEM_OPEN
# include <semaphore.h>

View File

@ -1,18 +1,30 @@
$OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
--- setup.py.orig Sat Jun 28 11:04:31 2008
+++ setup.py Tue Sep 30 14:14:11 2008
@@ -310,8 +310,8 @@ class PyBuildExt(build_ext):
$OpenBSD: patch-setup_py,v 1.2 2009/01/01 21:03:27 djm Exp $
--- setup.py.orig Wed Nov 5 07:43:31 2008
+++ setup.py Fri Dec 26 12:40:47 2008
@@ -19,6 +19,11 @@ 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 = []
+def usrlocal(p):
+ return os.path.join(os.environ['LOCALBASE'], p)
+def usrx11r6(p):
+ return os.path.join(os.environ['X11BASE'], p)
+
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
1) 'dir' is not already in 'dirlist'
@@ -310,8 +315,8 @@ class PyBuildExt(build_ext):
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_dir_to_list(self.compiler.library_dirs, '!!LOCALBASE!!/lib')
+ add_dir_to_list(self.compiler.include_dirs, '!!LOCALBASE!!/include')
+ add_dir_to_list(self.compiler.library_dirs, usrlocal('lib'))
+ add_dir_to_list(self.compiler.include_dirs, usrlocal('include'))
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -612,8 +612,6 @@ class PyBuildExt(build_ext):
@@ -613,8 +618,6 @@ class PyBuildExt(build_ext):
depends = ['socketmodule.h']) )
# Detect SSL support for the socket module (via _ssl)
search_for_ssl_incs_in = [
@ -21,7 +33,7 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
]
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
search_for_ssl_incs_in
@@ -624,9 +622,7 @@ class PyBuildExt(build_ext):
@@ -625,9 +628,7 @@ class PyBuildExt(build_ext):
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
@ -32,7 +44,7 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
if (ssl_incs is not None and
ssl_libs is not None):
@@ -720,7 +716,7 @@ class PyBuildExt(build_ext):
@@ -721,7 +722,7 @@ class PyBuildExt(build_ext):
# BerkeleyDB 4.6.x is not stable on many architectures.
arch = platform_machine()
if arch not in ('i386', 'i486', 'i586', 'i686',
@ -41,23 +53,23 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
return False
return True
@@ -783,6 +779,7 @@ class PyBuildExt(build_ext):
@@ -784,6 +785,7 @@ class PyBuildExt(build_ext):
std_variants.append(os.path.join(dn, "db3.%d"%x))
db_inc_paths = std_variants + db_inc_paths
+ db_inc_paths = [ '!!LOCALBASE!!/include/db4' ]
+ db_inc_paths = [ usrlocal('include/db4') ]
db_inc_paths = [p for p in db_inc_paths if os.path.exists(p)]
db_ver_inc_map = {}
@@ -839,6 +836,7 @@ class PyBuildExt(build_ext):
@@ -840,6 +842,7 @@ class PyBuildExt(build_ext):
db_incdir.replace("include", 'lib64'),
db_incdir.replace("include", 'lib'),
]
+ db_dirs_to_check = ['!!LOCALBASE!!/lib/db4']
+ db_dirs_to_check = [usrlocal('lib/db4')]
db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
# Look for a version specific db-X.Y before an ambiguoius dbX
@@ -847,6 +845,7 @@ class PyBuildExt(build_ext):
@@ -848,6 +851,7 @@ class PyBuildExt(build_ext):
# symlink to more general names?
for dblib in (('db-%d.%d' % db_ver),
('db%d%d' % db_ver),
@ -65,23 +77,23 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
('db%d' % db_ver[0])):
dblib_file = self.compiler.find_library_file(
db_dirs_to_check + lib_dirs, dblib )
@@ -894,6 +893,7 @@ class PyBuildExt(build_ext):
@@ -895,6 +899,7 @@ class PyBuildExt(build_ext):
'/usr/local/include/sqlite',
'/usr/local/include/sqlite3',
]
+ sqlite_inc_paths = [ '!!LOCALBASE!!/include' ]
+ sqlite_inc_paths = [ usrlocal('include') ]
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
MIN_SQLITE_VERSION = ".".join([str(x)
for x in MIN_SQLITE_VERSION_NUMBER])
@@ -932,6 +932,7 @@ class PyBuildExt(build_ext):
@@ -933,6 +938,7 @@ class PyBuildExt(build_ext):
os.path.join(sqlite_incdir, '..', '..', 'lib64'),
os.path.join(sqlite_incdir, '..', '..', 'lib'),
]
+ sqlite_dirs_to_check = [ '!!LOCALBASE!!/lib' ]
+ sqlite_dirs_to_check = [ usrlocal('lib') ]
sqlite_libfile = self.compiler.find_library_file(
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
@@ -987,7 +988,7 @@ class PyBuildExt(build_ext):
if sqlite_libfile:
@@ -989,7 +995,7 @@ class PyBuildExt(build_ext):
# the more recent berkeleydb's db.h file first in the include path
# when attempting to compile and it will fail.
f = "/usr/include/db.h"
@ -90,7 +102,7 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
data = open(f).read()
m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
if m is not None:
@@ -1191,10 +1192,8 @@ class PyBuildExt(build_ext):
@@ -1193,10 +1199,8 @@ class PyBuildExt(build_ext):
define_macros = define_macros,
include_dirs = [expatinc],
sources = ['pyexpat.c',
@ -102,7 +114,7 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
))
# Fredrik Lundh's cElementTree module. Note that this also
@@ -1269,6 +1268,14 @@ class PyBuildExt(build_ext):
@@ -1279,6 +1283,14 @@ class PyBuildExt(build_ext):
)
libraries = []
@ -117,7 +129,7 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
else: # Linux and other unices
macros = dict(
HAVE_SEM_OPEN=1,
@@ -1309,6 +1316,9 @@ class PyBuildExt(build_ext):
@@ -1319,6 +1331,9 @@ class PyBuildExt(build_ext):
if platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
'freebsd7', 'freebsd8'):
exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
@ -127,7 +139,16 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
else:
missing.append('ossaudiodev')
@@ -1510,8 +1520,7 @@ class PyBuildExt(build_ext):
@@ -1473,7 +1488,7 @@ class PyBuildExt(build_ext):
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
+ include_dirs.append(usrx11r6('include'))
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
# All existing framework builds of Tcl/Tk don't support 64-bit
@@ -1520,8 +1535,7 @@ class PyBuildExt(build_ext):
# The versions with dots are used on Unix, and the versions without
# dots on Windows, for detection by cygwin.
tcllib = tklib = tcl_includes = tk_includes = None
@ -137,7 +158,28 @@ $OpenBSD: patch-setup_py,v 1.1 2008/10/18 12:03:56 djm Exp $
tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version)
tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version)
if tklib and tcllib:
@@ -1863,7 +1872,7 @@ def main():
@@ -1562,17 +1576,9 @@ class PyBuildExt(build_ext):
if platform == 'sunos5':
include_dirs.append('/usr/openwin/include')
added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
- # Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
+ elif True:
+ include_dirs.append(usrx11r6('include'))
+ added_lib_dirs.append(usrx11r6('lib'))
# If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin':
@@ -1872,7 +1878,7 @@ def main():
# Scripts to install
scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
'Tools/scripts/2to3',

View File

@ -1 +0,0 @@
This package contains bzip2 compression module.

View File

@ -13,12 +13,3 @@ dynamically loaded. Python is also adaptable as an
extension language for existing applications. See the
internal documentation for hints.
Flavors:
no_bsddb - do not build bsdb package
no_expat - do not build expat package
no_gdbm - do not build gdbm package
no_idle - do not build idle package
no_mpz - do not build mpz package
no_tests - do not build tests package
no_tkinter - do not build tkinter package
no_tools - do not build tools package

View File

@ -1,4 +0,0 @@
@comment $OpenBSD: PLIST-bz2,v 1.1 2008/10/18 12:03:56 djm Exp $
@option no-default-conflict
@conflict python-bz2->=2.6,<2.6
lib/python2.6/lib-dynload/bz2.so

View File

@ -1,6 +1,7 @@
@comment $OpenBSD: PLIST-main,v 1.1 2008/10/18 12:03:56 djm Exp $
@comment $OpenBSD: PLIST-main,v 1.2 2009/01/01 21:03:27 djm Exp $
@option no-default-conflict
@conflict python->=2.6,<2.6
@conflict python->=2.6,<2.7
@conflict python-bz2->=2.6,<2.7
@pkgpath lang/python/2.6
bin/2to3
@comment bin/pydoc
@ -139,15 +140,20 @@ lib/python2.6/SocketServer.pyo
lib/python2.6/StringIO.py
lib/python2.6/StringIO.pyc
lib/python2.6/StringIO.pyo
lib/python2.6/Tools/
lib/python2.6/Tools/buildbot/
lib/python2.6/Tools/buildbot/README.tcltk-AMD64
lib/python2.6/Tools/buildbot/build-amd64.bat
lib/python2.6/Tools/buildbot/clean-amd64.bat
lib/python2.6/Tools/buildbot/external-amd64.bat
lib/python2.6/Tools/buildbot/external-common.bat
lib/python2.6/Tools/buildbot/test-amd64.bat
lib/python2.6/Tools/msi/
lib/python2.6/Tools/msi/crtlicense.txt
lib/python2.6/Tools/msi/merge.py
lib/python2.6/Tools/pybench/
lib/python2.6/Tools/pybench/With.py
lib/python2.6/Tools/scripts/
lib/python2.6/Tools/scripts/2to3
lib/python2.6/Tools/scripts/patchcheck.py
lib/python2.6/Tools/scripts/win_add2path.py
@ -1235,7 +1241,7 @@ lib/python2.6/keyword.py
lib/python2.6/keyword.pyc
lib/python2.6/keyword.pyo
lib/python2.6/lib-dynload/
lib/python2.6/lib-dynload/Python-2.6-py2.6.egg-info
lib/python2.6/lib-dynload/Python-2.6.1-py2.6.egg-info
lib/python2.6/lib-dynload/_bisect.so
lib/python2.6/lib-dynload/_bytesio.so
lib/python2.6/lib-dynload/_codecs_cn.so
@ -1270,6 +1276,7 @@ lib/python2.6/lib-dynload/array.so
lib/python2.6/lib-dynload/audioop.so
lib/python2.6/lib-dynload/binascii.so
lib/python2.6/lib-dynload/bsddb185.so
lib/python2.6/lib-dynload/bz2.so
lib/python2.6/lib-dynload/cPickle.so
lib/python2.6/lib-dynload/cStringIO.so
lib/python2.6/lib-dynload/cmath.so
@ -1299,9 +1306,9 @@ lib/python2.6/lib-dynload/zlib.so
lib/python2.6/lib-old/
lib/python2.6/lib2to3/
lib/python2.6/lib2to3/Grammar.txt
lib/python2.6/lib2to3/Grammar2.6.0.final.0.pickle
lib/python2.6/lib2to3/Grammar2.6.1.final.0.pickle
lib/python2.6/lib2to3/PatternGrammar.txt
lib/python2.6/lib2to3/PatternGrammar2.6.0.final.0.pickle
lib/python2.6/lib2to3/PatternGrammar2.6.1.final.0.pickle
lib/python2.6/lib2to3/__init__.py
lib/python2.6/lib2to3/__init__.pyc
lib/python2.6/lib2to3/__init__.pyo
@ -1348,6 +1355,9 @@ lib/python2.6/lib2to3/fixes/fix_funcattrs.pyo
lib/python2.6/lib2to3/fixes/fix_future.py
lib/python2.6/lib2to3/fixes/fix_future.pyc
lib/python2.6/lib2to3/fixes/fix_future.pyo
lib/python2.6/lib2to3/fixes/fix_getcwdu.py
lib/python2.6/lib2to3/fixes/fix_getcwdu.pyc
lib/python2.6/lib2to3/fixes/fix_getcwdu.pyo
lib/python2.6/lib2to3/fixes/fix_has_key.py
lib/python2.6/lib2to3/fixes/fix_has_key.pyc
lib/python2.6/lib2to3/fixes/fix_has_key.pyo
@ -1417,6 +1427,9 @@ lib/python2.6/lib2to3/fixes/fix_renames.pyo
lib/python2.6/lib2to3/fixes/fix_repr.py
lib/python2.6/lib2to3/fixes/fix_repr.pyc
lib/python2.6/lib2to3/fixes/fix_repr.pyo
lib/python2.6/lib2to3/fixes/fix_set_literal.py
lib/python2.6/lib2to3/fixes/fix_set_literal.pyc
lib/python2.6/lib2to3/fixes/fix_set_literal.pyo
lib/python2.6/lib2to3/fixes/fix_standarderror.py
lib/python2.6/lib2to3/fixes/fix_standarderror.pyc
lib/python2.6/lib2to3/fixes/fix_standarderror.pyo

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-tests,v 1.1 2008/10/18 12:03:56 djm Exp $
@comment $OpenBSD: PLIST-tests,v 1.2 2009/01/01 21:03:28 djm Exp $
@option no-default-conflict
@conflict python-tests->=2.6,<2.6
lib/python2.6/test/
@ -678,6 +678,9 @@ lib/python2.6/test/test_future3.pyo
lib/python2.6/test/test_future4.py
lib/python2.6/test/test_future4.pyc
lib/python2.6/test/test_future4.pyo
lib/python2.6/test/test_future5.py
lib/python2.6/test/test_future5.pyc
lib/python2.6/test/test_future5.pyo
lib/python2.6/test/test_future_builtins.py
lib/python2.6/test/test_future_builtins.pyc
lib/python2.6/test/test_future_builtins.pyo

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile.inc,v 1.56 2008/10/18 11:55:57 djm Exp $
# $OpenBSD: Makefile.inc,v 1.57 2009/01/01 21:03:27 djm Exp $
# IMPORTANT! If you make any changes to the Python ports, be sure
# to also update files/CHANGES.OpenBSD for your change. This is a
@ -8,16 +8,12 @@
SHARED_ONLY= Yes
COMMENT-main= interpreted object-oriented programming language
COMMENT-expat= expat module for Python
COMMENT-bsddb= Berkeley db module for Python
COMMENT-gdbm= GNU dbm module for Python
COMMENT-idle= IDE for Python
COMMENT-mpz= GNU arbitrary magnitude integer module for Python
COMMENT-tests= Python test suite
COMMENT-tkinter=tk GUI module for Python
COMMENT-tools= extra tools for Python
COMMENT-sqlite= sqlite database module for Python
COMMENT-bz2= bz2 module for Python
PKGNAME-main= python-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
DISTNAME= Python-${VERSION}${PATCHLEVEL}
@ -38,129 +34,42 @@ PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
.if ${VERSION} == "2.6"
# Build knobs are no longer supported
PSEUDO_FLAVORS=
.else
PSEUDO_FLAVORS= no_expat no_gdbm no_idle no_mpz no_tkinter no_bsddb no_bz2 \
no_sqlite
MULTI_PACKAGES= -main -tests -tools -gdbm -idle -tkinter
# Python 2.6 lists BSD db 4.6.x as unstable on most architectures (see
# setup.py:allow_db_version). XXX revisit if databases/db/v4 is updated to 4.7
.if ${VERSION} != "2.6" || \
${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
MULTI_PACKAGES+=-bsddb
.endif
FLAVOR?=
MULTI_PACKAGES= -main -tests -tools
# All subpackages depend on the main python package.
RUN_DEPENDS= :python-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}:lang/python/${VERSION},-main
LIB_DEPENDS=
LIB_DEPENDS-main= bz2::archivers/bzip2
RUN_DEPENDS-main=
WANTLIB-main= ssl panel m crypto c util z readline pthread ncurses stdc++
.if ${VERSION} == "2.6"
WANTLIB-main+= expat ossaudio
LIB_DEPENDS-main= sqlite3.>=8.7::databases/sqlite3
WANTLIB-main= ssl panel m crypto c util z readline pthread \
ncurses stdc++ expat ossaudio
.if ${VERSION} == "2.5" || ${VERSION} == "2.6"
LIB_DEPENDS-main+= sqlite3::databases/sqlite3
.endif
LIB_DEPENDS-bsddb= lib/db4/db.>=4:db-4.*:databases/db/v4
LIB_DEPENDS-gdbm= gdbm.>=3::databases/gdbm
LIB_DEPENDS-bz2= bz2::archivers/bzip2
RUN_DEPENDS-idle= ${RUN_DEPENDS} \
::lang/python/${VERSION},-tkinter
LIB_DEPENDS-tkinter= tcl84:tcl-8.4.*:lang/tcl/8.4 \
tk84:tk-8.4.*:x11/tk/8.4
WANTLIB-tkinter= X11
LIB_DEPENDS-mpz= gmp::devel/gmp
WANTLIB-expat= expat
LIB_DEPENDS-sqlite= sqlite3.>=8.7::databases/sqlite3
SETUP_PY= "s,!!LOCALBASE!!,${LOCALBASE},g" \
"s,!!X11BASE!!,${X11BASE},g"
.if empty(FLAVOR:L:Mno_bsddb) && (${VERSION} == "2.5" || ${VERSION} == "2.6")
# Python 2.6 lists BSD db 4.6.x as unstable on most architectures (see
# setup.py:allow_db_version). XXX revisit if databases/db/v4 is updated to 4.7
. if ${VERSION} != "2.6" || \
( ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" )
SETUP_PY+= "s,!!USE_BSDDB!!,1,g"
MULTI_PACKAGES+=-bsddb
. endif
.else
SETUP_PY+= "s,!!USE_BSDDB!!,0,g"
.endif
.if empty(FLAVOR:L:Mno_gdbm)
SETUP_PY+= "s,!!USE_GDBM!!,1,g"
MULTI_PACKAGES+=-gdbm
.else
SETUP_PY+= "s,!!USE_GDBM!!,0,g"
.endif
.if empty(FLAVOR:L:Mno_bz2)
SETUP_PY+= "s,!!USE_BZ2!!,1,g"
MULTI_PACKAGES+=-bz2
.else
SETUP_PY+= "s,!!USE_BZ2!!,0,g"
.endif
.if empty(FLAVOR:L:Mno_idle) && empty(FLAVOR:L:Mno_tkinter)
MULTI_PACKAGES+=-idle
.endif
.if empty(FLAVOR:L:Mno_tkinter)
USE_X11= Yes
SETUP_PY+= "s,!!USE_TKINTER!!,1,g"
MULTI_PACKAGES+=-tkinter
.else
SETUP_PY+= "s,!!USE_TKINTER!!,0,g"
.endif
.if empty(FLAVOR:L:Mno_mpz) && ${VERSION} == "2.3"
SETUP_PY+= "s,!!USE_MPZ!!,1,g"
MULTI_PACKAGES+=-mpz
.else
SETUP_PY+= "s,!!USE_MPZ!!,0,g"
.endif
.if empty(FLAVOR:L:Mno_expat) && ${VERSION} != "2.6"
SETUP_PY+= "s,!!USE_EXPAT!!,1,g"
MULTI_PACKAGES+=-expat
.else
SETUP_PY+= "s,!!USE_EXPAT!!,0,g"
.endif
.if empty(FLAVOR:L:Mno_sqlite) && ${VERSION} == "2.5"
SETUP_PY+= "s,!!USE_SQLITE!!,1,g"
MULTI_PACKAGES+=-sqlite
.else
SETUP_PY+= "s,!!USE_SQLITE!!,0,g"
.endif
FULLPKGNAME-expat= python-expat-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-bsddb= python-bsddb-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-gdbm= python-gdbm-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-idle= python-idle-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-mpz= python-mpz-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-tests= python-tests-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-tkinter= python-tkinter-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-tools= python-tools-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-sqlite= python-sqlite-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
FULLPKGNAME-bz2= python-bz2-${VERSION}${PATCHLEVEL}${PKG_PATCHLEVEL}
AUTOCONF_VERSION?=2.59
CONFIGURE_STYLE=autoconf
CONFIGURE_ARGS+=${CONFIGURE_SHARED}
# --srcdir is needed for systrace to work correctly
CONFIGURE_ARGS+=--with-fpectl --with-threads --srcdir=${WRKSRC}
CONFIGURE_ARGS+=--enable-ipv6
# THREAD_STACK_SIZE value might be changed by particular python release
THREAD_STACK_SIZE?=0x20000
REGRESS_TARGET= test
REGRESS_FLAGS= "EXTRATESTOPTS=-w"
# Some regress tests write to $HOME
PORTHOME= ${WRKDIR}
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "sparc64"
PKG_ARGS+= -Dmm=0
@ -180,20 +89,30 @@ PKG_ARGS+= -Dctypes=0
. endif
.endif
USE_X11= Yes
AUTOCONF_VERSION?= 2.59
CONFIGURE_STYLE= autoconf
CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
# --srcdir is needed for systrace to work correctly
CONFIGURE_ARGS+= --with-fpectl --with-threads --srcdir=${WRKSRC}
CONFIGURE_ARGS+= --enable-ipv6
# THREAD_STACK_SIZE value might be changed by particular python release
THREAD_STACK_SIZE?=0x20000
CONFIGURE_ENV+= OPT='${CFLAGS} -DTHREAD_STACK_SIZE=${THREAD_STACK_SIZE} -fPIC' \
LDFLAGS='-L${WRKSRC}' \
SVNVERSION=no
MAKE_FLAGS+= LDLIBRARY=libpython${VERSION}.so.${LIBpython${VERSION}_VERSION} \
LD_LIBRARY_PATH=${WRKSRC} PATH="${WRKDIST}:${PORTPATH}"
LDFLAGS='-L${WRKSRC}' SVNVERSION=no \
LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
MAKE_ENV+= LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
MAKE_FLAGS+= LDLIBRARY=libpython${VERSION}.so.${LIBpython${VERSION}_VERSION}
MAKE_FLAGS+= LD_LIBRARY_PATH=${WRKSRC} PATH="${WRKDIST}:${PORTPATH}"
FAKE_FLAGS+= RANLIB=:
ALL_TARGET?= everything ./Lib/plat-openbsd4
post-configure:
@cd ${WRKSRC} && ${MAKE_PROGRAM} Makefile
for i in ${SETUP_PY}; do \
perl -pi -e "$$i" ${WRKSRC}/setup.py; \
done
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/Tools/scripts/pydoc \
@ -212,3 +131,8 @@ post-install:
${PREFIX}/share/emacs/site-lisp
.endif
REGRESS_TARGET= test
REGRESS_FLAGS= "EXTRATESTOPTS=-w"
# Some regress tests write to $HOME
PORTHOME= ${WRKDIR}

View File

@ -1,4 +1,4 @@
# $OpenBSD: python.port.mk,v 1.25 2008/12/16 06:32:27 fgsch Exp $
# $OpenBSD: python.port.mk,v 1.26 2009/01/01 21:03:27 djm Exp $
#
# python.port.mk - Xavier Santolaria <xavier@santolaria.net>
# This file is in the public domain.
@ -33,9 +33,6 @@ REGRESS_TARGET?= test
.endif
.if !defined(NO_SHARED_LIBS) || ${NO_SHARED_LIBS:U} != YES
.if ${MODPY_VERSION} != "2.6"
MODPY_EXPAT_DEPENDS= :python-expat-${MODPY_VERSION}*:lang/python/${MODPY_VERSION},-expat
.endif
MODPY_TKINTER_DEPENDS= :python-tkinter-${MODPY_VERSION}*:lang/python/${MODPY_VERSION},-tkinter
.endif
@ -55,7 +52,8 @@ MODPY_DISTUTILS_INSTALL?= install --prefix=${LOCALBASE} \
--root=${DESTDIR} \
--single-version-externally-managed
.else
MODPY_DISTUTILS_INSTALL?= install --prefix=${PREFIX}
MODPY_DISTUTILS_INSTALL?= install --prefix=${LOCALBASE} \
--root=${DESTDIR}
.endif
MAKE_ENV+= CC=${CC}