summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python
diff options
context:
space:
mode:
authorAdrian Dudau <adrian.dudau@enea.com>2014-06-26 14:36:22 +0200
committerAdrian Dudau <adrian.dudau@enea.com>2014-06-26 15:32:53 +0200
commitf4cf9fe05bb3f32fabea4e54dd92d368967a80da (patch)
tree487180fa9866985ea7b28e625651765d86f515c3 /meta/recipes-devtools/python/python
downloadpoky-f4cf9fe05bb3f32fabea4e54dd92d368967a80da.tar.gz
initial commit for Enea Linux 4.0
Migrated from the internal git server on the daisy-enea branch Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/recipes-devtools/python/python')
-rw-r--r--meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch138
-rw-r--r--meta/recipes-devtools/python/python/03-fix-tkinter-detection.patch42
-rw-r--r--meta/recipes-devtools/python/python/05-enable-ctypes-cross-build.patch30
-rw-r--r--meta/recipes-devtools/python/python/06-avoid_usr_lib_termcap_path_in_linking.patch33
-rw-r--r--meta/recipes-devtools/python/python/06-ctypes-libffi-fix-configure.patch44
-rw-r--r--meta/recipes-devtools/python/python/CVE-2013-4073_py27.patch251
-rw-r--r--meta/recipes-devtools/python/python/add-md5module-support.patch18
-rw-r--r--meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch25
-rw-r--r--meta/recipes-devtools/python/python/avoid_warning_for_sunos_specific_module.patch23
-rw-r--r--meta/recipes-devtools/python/python/builddir.patch55
-rw-r--r--meta/recipes-devtools/python/python/cgi_py.patch23
-rw-r--r--meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch57
-rw-r--r--meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch33
-rw-r--r--meta/recipes-devtools/python/python/fix_for_using_different_libdir.patch82
-rw-r--r--meta/recipes-devtools/python/python/gcc-4.8-fix-configure-Wformat.patch20
-rw-r--r--meta/recipes-devtools/python/python/host_include_contamination.patch27
-rw-r--r--meta/recipes-devtools/python/python/multilib.patch257
-rw-r--r--meta/recipes-devtools/python/python/parallel-makeinst-create-bindir.patch19
-rw-r--r--meta/recipes-devtools/python/python/pypirc-secure.patch35
-rw-r--r--meta/recipes-devtools/python/python/python-2.7.3-CVE-2012-2135.patch73
-rw-r--r--meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-smtplib-fix.patch101
-rw-r--r--meta/recipes-devtools/python/python/python-2.7.3-CVE-2014-1912.patch26
-rw-r--r--meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch1572
-rw-r--r--meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch28
-rw-r--r--meta/recipes-devtools/python/python/python-fix-build-error-with-Readline-6.3.patch62
-rw-r--r--meta/recipes-devtools/python/python/remove_sqlite_rpath.patch19
-rw-r--r--meta/recipes-devtools/python/python/run-ptest5
-rw-r--r--meta/recipes-devtools/python/python/search_db_h_in_inc_dirs_and_avoid_warning.patch40
-rw-r--r--meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch27
-rw-r--r--meta/recipes-devtools/python/python/setuptweaks.patch57
-rw-r--r--meta/recipes-devtools/python/python/sitecustomize.py45
31 files changed, 3267 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch b/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
new file mode 100644
index 0000000000..691beada03
--- /dev/null
+++ b/meta/recipes-devtools/python/python/01-use-proper-tools-for-cross-build.patch
@@ -0,0 +1,138 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3# We need to ensure our host tools get run during build, not the freshly
4# built cross-tools (this will not work), so we introduce HOSTPYTHON and HOSTPGEN.
5# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
6
7Index: Python-2.7.2/Makefile.pre.in
8===================================================================
9--- Python-2.7.2.orig/Makefile.pre.in
10+++ Python-2.7.2/Makefile.pre.in
11@@ -182,6 +182,7 @@ UNICODE_OBJS= @UNICODE_OBJS@
12
13 PYTHON= python$(EXE)
14 BUILDPYTHON= python$(BUILDEXE)
15+HOSTPYTHON= $(BUILDPYTHON)
16
17 # The task to run while instrument when building the profile-opt target
18 PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
19@@ -214,7 +215,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
20 ##########################################################################
21 # Parser
22 PGEN= Parser/pgen$(EXE)
23-
24+HOSTPGEN= $(PGEN)$(EXE)
25 POBJS= \
26 Parser/acceler.o \
27 Parser/grammar1.o \
28@@ -401,14 +402,14 @@ $(BUILDPYTHON): Modules/python.o $(LIBRA
29 $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
30
31 platform: $(BUILDPYTHON)
32- $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
33+ $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
34
35
36 # Build the shared modules
37 sharedmods: $(BUILDPYTHON)
38 @case $$MAKEFLAGS in \
39- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
40- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
41+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
42+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
43 esac
44
45 # Build static library
46@@ -542,7 +543,7 @@ Modules/python.o: $(srcdir)/Modules/pyth
47 $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
48 Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
49 -@$(INSTALL) -d Include
50- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
51+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
52 -touch Parser/pgen.stamp
53
54 $(PGEN): $(PGENOBJS)
55@@ -926,25 +927,25 @@ libinstall: build_all $(srcdir)/Lib/$(PL
56 done
57 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
58 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
59- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
60+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
61 -d $(LIBDEST) -f \
62 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
63 $(DESTDIR)$(LIBDEST)
64 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
65- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
66+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
67 -d $(LIBDEST) -f \
68 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
69 $(DESTDIR)$(LIBDEST)
70 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
71- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
72+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
73 -d $(LIBDEST)/site-packages -f \
74 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
75 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
76- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
77+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
78 -d $(LIBDEST)/site-packages -f \
79 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
80 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
81- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
82+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
83
84 # Create the PLATDIR source directory, if one wasn't distributed..
85 $(srcdir)/Lib/$(PLATDIR):
86@@ -1049,7 +1050,7 @@ libainstall: all python-config
87 # Install the dynamically loadable modules
88 # This goes into $(exec_prefix)
89 sharedinstall: sharedmods
90- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
91+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
92 --prefix=$(prefix) \
93 --install-scripts=$(BINDIR) \
94 --install-platlib=$(DESTSHARED) \
95Index: Python-2.7.2/setup.py
96===================================================================
97--- Python-2.7.2.orig/setup.py
98+++ Python-2.7.2/setup.py
99@@ -313,6 +313,7 @@ class PyBuildExt(build_ext):
100 self.failed.append(ext.name)
101 self.announce('*** WARNING: renaming "%s" since importing it'
102 ' failed: %s' % (ext.name, why), level=3)
103+ return
104 assert not self.inplace
105 basename, tail = os.path.splitext(ext_filename)
106 newname = basename + "_failed" + tail
107@@ -369,8 +370,8 @@ class PyBuildExt(build_ext):
108
109 def detect_modules(self):
110 # Ensure that /usr/local is always used
111- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
112- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
113+ #add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
114+ #add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
115 self.add_multiarch_paths()
116
117 # Add paths specified in the environment variables LDFLAGS and
118@@ -475,6 +476,9 @@ class PyBuildExt(build_ext):
119
120 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
121
122+ lib_dirs = [ os.getenv("STAGING_LIBDIR"), os.getenv("STAGING_BASELIBDIR") ]
123+ inc_dirs = [ os.getenv("STAGING_INCDIR") ]
124+
125 #
126 # The following modules are all pretty straightforward, and compile
127 # on pretty much any POSIXish platform.
128@@ -677,8 +681,8 @@ class PyBuildExt(build_ext):
129 elif curses_library:
130 readline_libs.append(curses_library)
131 elif self.compiler.find_library_file(lib_dirs +
132- ['/usr/lib/termcap'],
133- 'termcap'):
134+ ['/usr/lib/termcap'],
135+ 'termcap'):
136 readline_libs.append('termcap')
137 exts.append( Extension('readline', ['readline.c'],
138 library_dirs=['/usr/lib/termcap'],
diff --git a/meta/recipes-devtools/python/python/03-fix-tkinter-detection.patch b/meta/recipes-devtools/python/python/03-fix-tkinter-detection.patch
new file mode 100644
index 0000000000..d74e4b1776
--- /dev/null
+++ b/meta/recipes-devtools/python/python/03-fix-tkinter-detection.patch
@@ -0,0 +1,42 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3# We need to supply STAGING_INCDIR here, otherwise the Tk headers
4# will not be found.
5# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille.de>
6
7Index: Python-2.6.1/setup.py
8===================================================================
9--- Python-2.6.1.orig/setup.py
10+++ Python-2.6.1/setup.py
11@@ -1543,7 +1543,7 @@ class PyBuildExt(build_ext):
12 dotversion = dotversion[:-1] + '.' + dotversion[-1]
13 tcl_include_sub = []
14 tk_include_sub = []
15- for dir in inc_dirs:
16+ for dir in [os.getenv("STAGING_INCDIR")]:
17 tcl_include_sub += [dir + os.sep + "tcl" + dotversion]
18 tk_include_sub += [dir + os.sep + "tk" + dotversion]
19 tk_include_sub += tcl_include_sub
20@@ -1562,22 +1562,6 @@ class PyBuildExt(build_ext):
21 if dir not in include_dirs:
22 include_dirs.append(dir)
23
24- # Check for various platform-specific directories
25- if platform == 'sunos5':
26- include_dirs.append('/usr/openwin/include')
27- added_lib_dirs.append('/usr/openwin/lib')
28- elif os.path.exists('/usr/X11R6/include'):
29- include_dirs.append('/usr/X11R6/include')
30- added_lib_dirs.append('/usr/X11R6/lib64')
31- added_lib_dirs.append('/usr/X11R6/lib')
32- elif os.path.exists('/usr/X11R5/include'):
33- include_dirs.append('/usr/X11R5/include')
34- added_lib_dirs.append('/usr/X11R5/lib')
35- else:
36- # Assume default location for X11
37- include_dirs.append('/usr/X11/include')
38- added_lib_dirs.append('/usr/X11/lib')
39-
40 # If Cygwin, then verify that X is installed before proceeding
41 if platform == 'cygwin':
42 x11_inc = find_file('X11/Xlib.h', [], include_dirs)
diff --git a/meta/recipes-devtools/python/python/05-enable-ctypes-cross-build.patch b/meta/recipes-devtools/python/python/05-enable-ctypes-cross-build.patch
new file mode 100644
index 0000000000..a68a20620a
--- /dev/null
+++ b/meta/recipes-devtools/python/python/05-enable-ctypes-cross-build.patch
@@ -0,0 +1,30 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3# CTypes need to know the actual host we are building on.
4# Signed-Off: Michael Dietrich <mdt@emdete.de>
5
6Index: Python-2.6.1/setup.py
7===================================================================
8--- Python-2.6.1.orig/setup.py
9+++ Python-2.6.1/setup.py
10@@ -1656,16 +1656,16 @@ class PyBuildExt(build_ext):
11 ffi_configfile):
12 from distutils.dir_util import mkpath
13 mkpath(ffi_builddir)
14- config_args = []
15+ config_args = ['--host=%s' % os.environ["HOST_SYS"], ]
16
17 # Pass empty CFLAGS because we'll just append the resulting
18 # CFLAGS to Python's; -g or -O2 is to be avoided.
19- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
20- % (ffi_builddir, ffi_srcdir, " ".join(config_args))
21+ cmd = "(cd %s && autoconf -W cross) && (cd %s && env CFLAGS='' '%s/configure' %s)" \
22+ % (ffi_srcdir, ffi_builddir, ffi_srcdir, " ".join(config_args))
23
24 res = os.system(cmd)
25 if res or not os.path.exists(ffi_configfile):
26- print "Failed to configure _ctypes module"
27+ print "Failed to configure _ctypes module (res=%d) or missing conffile=%s" % ( res, ffi_configfile )
28 return False
29
30 fficonfig = {}
diff --git a/meta/recipes-devtools/python/python/06-avoid_usr_lib_termcap_path_in_linking.patch b/meta/recipes-devtools/python/python/06-avoid_usr_lib_termcap_path_in_linking.patch
new file mode 100644
index 0000000000..f8ab0e71e9
--- /dev/null
+++ b/meta/recipes-devtools/python/python/06-avoid_usr_lib_termcap_path_in_linking.patch
@@ -0,0 +1,33 @@
1Upstream-Status: Pending
2
3The poison directories patch has detected library path issue while
4compiling the python in cross environment, as seen bellow.
5
6warning: library search path "/usr/lib/termcap" is unsafe for cross-compilation
7
8This Patch fixes this issue in the python build environment.
911 Oct 2010
10Nitin A Kamble <nitin.a.kamble@intel.com>
11
122011/09/29
13Rebased for python 2.7.2
14Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
15
16Index: Python-2.7.2/setup.py
17===================================================================
18--- Python-2.7.2.orig/setup.py
19+++ Python-2.7.2/setup.py
20@@ -680,12 +680,10 @@ class PyBuildExt(build_ext):
21 pass # Issue 7384: Already linked against curses or tinfo.
22 elif curses_library:
23 readline_libs.append(curses_library)
24- elif self.compiler.find_library_file(lib_dirs +
25- ['/usr/lib/termcap'],
26+ elif self.compiler.find_library_file(lib_dirs,
27 'termcap'):
28 readline_libs.append('termcap')
29 exts.append( Extension('readline', ['readline.c'],
30- library_dirs=['/usr/lib/termcap'],
31 extra_link_args=readline_extra_link_args,
32 libraries=readline_libs) )
33 else:
diff --git a/meta/recipes-devtools/python/python/06-ctypes-libffi-fix-configure.patch b/meta/recipes-devtools/python/python/06-ctypes-libffi-fix-configure.patch
new file mode 100644
index 0000000000..abd63d2a96
--- /dev/null
+++ b/meta/recipes-devtools/python/python/06-ctypes-libffi-fix-configure.patch
@@ -0,0 +1,44 @@
1This fixes configure issues with recent autoconf, e.g:
2 autoreconf: Entering directory `Modules/_ctypes/libffi'
3 autoreconf: configure.ac: not using Gettext
4 autoreconf: running: aclocal --force
5 configure.ac:26: error: m4_copy: won't overwrite defined macro: _AC_ARG_VAR_PRECIOUS
6 configure.ac:26: the top level
7
8The problem is still present in python-2.6.5 but fixed in python-svn.
9
10Upstream-Status: Accepted [python-svn]
11
12Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
13Acked-by: Martin Jansa <Martin.Jansa@gmail.com>
14Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
15Signed-off-by: Saul Wold <sgw@linux.intel.com>
16
17
182011/09/29
19Rebased for python 2.7.2
20Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
21
22
23Index: Python-2.7.2/Modules/_ctypes/libffi/Makefile.am
24===================================================================
25--- Python-2.7.2.orig/Modules/_ctypes/libffi/Makefile.am
26+++ Python-2.7.2/Modules/_ctypes/libffi/Makefile.am
27@@ -2,7 +2,7 @@
28
29 AUTOMAKE_OPTIONS = foreign subdir-objects
30
31-SUBDIRS = include testsuite man
32+SUBDIRS = include
33
34 EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
35 src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
36@@ -34,8 +34,6 @@ EXTRA_DIST = LICENSE ChangeLog.v1 Change
37 libtool-version ChangeLog.libffi m4/libtool.m4 \
38 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4
39
40-info_TEXINFOS = doc/libffi.texi
41-
42 ## ################################################################
43
44 ##
diff --git a/meta/recipes-devtools/python/python/CVE-2013-4073_py27.patch b/meta/recipes-devtools/python/python/CVE-2013-4073_py27.patch
new file mode 100644
index 0000000000..0d17463052
--- /dev/null
+++ b/meta/recipes-devtools/python/python/CVE-2013-4073_py27.patch
@@ -0,0 +1,251 @@
1Upstream-Status: Backport
2
3Signed-off-by: Saul Wold <sgw@linux.intel.com>
4
5diff -r 9ddc63c039ba Lib/test/nullbytecert.pem
6--- /dev/null Thu Jan 01 00:00:00 1970 +0000
7+++ b/Lib/test/nullbytecert.pem Sun Aug 11 18:13:17 2013 +0200
8@@ -0,0 +1,90 @@
9+Certificate:
10+ Data:
11+ Version: 3 (0x2)
12+ Serial Number: 0 (0x0)
13+ Signature Algorithm: sha1WithRSAEncryption
14+ Issuer: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
15+ Validity
16+ Not Before: Aug 7 13:11:52 2013 GMT
17+ Not After : Aug 7 13:12:52 2013 GMT
18+ Subject: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
19+ Subject Public Key Info:
20+ Public Key Algorithm: rsaEncryption
21+ Public-Key: (2048 bit)
22+ Modulus:
23+ 00:b5:ea:ed:c9:fb:46:7d:6f:3b:76:80:dd:3a:f3:
24+ 03:94:0b:a7:a6:db:ec:1d:df:ff:23:74:08:9d:97:
25+ 16:3f:a3:a4:7b:3e:1b:0e:96:59:25:03:a7:26:e2:
26+ 88:a9:cf:79:cd:f7:04:56:b0:ab:79:32:6e:59:c1:
27+ 32:30:54:eb:58:a8:cb:91:f0:42:a5:64:27:cb:d4:
28+ 56:31:88:52:ad:cf:bd:7f:f0:06:64:1f:cc:27:b8:
29+ a3:8b:8c:f3:d8:29:1f:25:0b:f5:46:06:1b:ca:02:
30+ 45:ad:7b:76:0a:9c:bf:bb:b9:ae:0d:16:ab:60:75:
31+ ae:06:3e:9c:7c:31:dc:92:2f:29:1a:e0:4b:0c:91:
32+ 90:6c:e9:37:c5:90:d7:2a:d7:97:15:a3:80:8f:5d:
33+ 7b:49:8f:54:30:d4:97:2c:1c:5b:37:b5:ab:69:30:
34+ 68:43:d3:33:78:4b:02:60:f5:3c:44:80:a1:8f:e7:
35+ f0:0f:d1:5e:87:9e:46:cf:62:fc:f9:bf:0c:65:12:
36+ f1:93:c8:35:79:3f:c8:ec:ec:47:f5:ef:be:44:d5:
37+ ae:82:1e:2d:9a:9f:98:5a:67:65:e1:74:70:7c:cb:
38+ d3:c2:ce:0e:45:49:27:dc:e3:2d:d4:fb:48:0e:2f:
39+ 9e:77:b8:14:46:c0:c4:36:ca:02:ae:6a:91:8c:da:
40+ 2f:85
41+ Exponent: 65537 (0x10001)
42+ X509v3 extensions:
43+ X509v3 Basic Constraints: critical
44+ CA:FALSE
45+ X509v3 Subject Key Identifier:
46+ 88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C
47+ X509v3 Key Usage:
48+ Digital Signature, Non Repudiation, Key Encipherment
49+ X509v3 Subject Alternative Name:
50+ *************************************************************
51+ WARNING: The values for DNS, email and URI are WRONG. OpenSSL
52+ doesn't print the text after a NULL byte.
53+ *************************************************************
54+ DNS:altnull.python.org, email:null@python.org, URI:http://null.python.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
55+ Signature Algorithm: sha1WithRSAEncryption
56+ ac:4f:45:ef:7d:49:a8:21:70:8e:88:59:3e:d4:36:42:70:f5:
57+ a3:bd:8b:d7:a8:d0:58:f6:31:4a:b1:a4:a6:dd:6f:d9:e8:44:
58+ 3c:b6:0a:71:d6:7f:b1:08:61:9d:60:ce:75:cf:77:0c:d2:37:
59+ 86:02:8d:5e:5d:f9:0f:71:b4:16:a8:c1:3d:23:1c:f1:11:b3:
60+ 56:6e:ca:d0:8d:34:94:e6:87:2a:99:f2:ae:ae:cc:c2:e8:86:
61+ de:08:a8:7f:c5:05:fa:6f:81:a7:82:e6:d0:53:9d:34:f4:ac:
62+ 3e:40:fe:89:57:7a:29:a4:91:7e:0b:c6:51:31:e5:10:2f:a4:
63+ 60:76:cd:95:51:1a:be:8b:a1:b0:fd:ad:52:bd:d7:1b:87:60:
64+ d2:31:c7:17:c4:18:4f:2d:08:25:a3:a7:4f:b7:92:ca:e2:f5:
65+ 25:f1:54:75:81:9d:b3:3d:61:a2:f7:da:ed:e1:c6:6f:2c:60:
66+ 1f:d8:6f:c5:92:05:ab:c9:09:62:49:a9:14:ad:55:11:cc:d6:
67+ 4a:19:94:99:97:37:1d:81:5f:8b:cf:a3:a8:96:44:51:08:3d:
68+ 0b:05:65:12:eb:b6:70:80:88:48:72:4f:c6:c2:da:cf:cd:8e:
69+ 5b:ba:97:2f:60:b4:96:56:49:5e:3a:43:76:63:04:be:2a:f6:
70+ c1:ca:a9:94
71+-----BEGIN CERTIFICATE-----
72+MIIE2DCCA8CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBxTELMAkGA1UEBhMCVVMx
73+DzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJQmVhdmVydG9uMSMwIQYDVQQKDBpQ
74+eXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEgMB4GA1UECwwXUHl0aG9uIENvcmUg
75+RGV2ZWxvcG1lbnQxJDAiBgNVBAMMG251bGwucHl0aG9uLm9yZwBleGFtcGxlLm9y
76+ZzEkMCIGCSqGSIb3DQEJARYVcHl0aG9uLWRldkBweXRob24ub3JnMB4XDTEzMDgw
77+NzEzMTE1MloXDTEzMDgwNzEzMTI1MlowgcUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQI
78+DAZPcmVnb24xEjAQBgNVBAcMCUJlYXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNv
79+ZnR3YXJlIEZvdW5kYXRpb24xIDAeBgNVBAsMF1B5dGhvbiBDb3JlIERldmVsb3Bt
80+ZW50MSQwIgYDVQQDDBtudWxsLnB5dGhvbi5vcmcAZXhhbXBsZS5vcmcxJDAiBgkq
81+hkiG9w0BCQEWFXB5dGhvbi1kZXZAcHl0aG9uLm9yZzCCASIwDQYJKoZIhvcNAQEB
82+BQADggEPADCCAQoCggEBALXq7cn7Rn1vO3aA3TrzA5QLp6bb7B3f/yN0CJ2XFj+j
83+pHs+Gw6WWSUDpybiiKnPec33BFawq3kyblnBMjBU61ioy5HwQqVkJ8vUVjGIUq3P
84+vX/wBmQfzCe4o4uM89gpHyUL9UYGG8oCRa17dgqcv7u5rg0Wq2B1rgY+nHwx3JIv
85+KRrgSwyRkGzpN8WQ1yrXlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
86+oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
87+08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
88+HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
89+BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
90+Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
91+bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
92+AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
93+i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
94+HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
95+kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
96+VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
97+RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
98+-----END CERTIFICATE-----
99diff -r 9ddc63c039ba Lib/test/test_ssl.py
100--- a/Lib/test/test_ssl.py Sun Aug 11 13:04:50 2013 +0300
101+++ b/Lib/test/test_ssl.py Sun Aug 11 18:13:17 2013 +0200
102@@ -25,6 +25,7 @@
103 HOST = test_support.HOST
104 CERTFILE = None
105 SVN_PYTHON_ORG_ROOT_CERT = None
106+NULLBYTECERT = None
107
108 def handle_error(prefix):
109 exc_format = ' '.join(traceback.format_exception(*sys.exc_info()))
110@@ -123,6 +124,27 @@
111 ('DNS', 'projects.forum.nokia.com'))
112 )
113
114+ def test_parse_cert_CVE_2013_4073(self):
115+ p = ssl._ssl._test_decode_cert(NULLBYTECERT)
116+ if test_support.verbose:
117+ sys.stdout.write("\n" + pprint.pformat(p) + "\n")
118+ subject = ((('countryName', 'US'),),
119+ (('stateOrProvinceName', 'Oregon'),),
120+ (('localityName', 'Beaverton'),),
121+ (('organizationName', 'Python Software Foundation'),),
122+ (('organizationalUnitName', 'Python Core Development'),),
123+ (('commonName', 'null.python.org\x00example.org'),),
124+ (('emailAddress', 'python-dev@python.org'),))
125+ self.assertEqual(p['subject'], subject)
126+ self.assertEqual(p['issuer'], subject)
127+ self.assertEqual(p['subjectAltName'],
128+ (('DNS', 'altnull.python.org\x00example.com'),
129+ ('email', 'null@python.org\x00user@example.org'),
130+ ('URI', 'http://null.python.org\x00http://example.org'),
131+ ('IP Address', '192.0.2.1'),
132+ ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
133+ )
134+
135 def test_DER_to_PEM(self):
136 with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:
137 pem = f.read()
138@@ -1360,7 +1382,7 @@
139
140
141 def test_main(verbose=False):
142- global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT
143+ global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT, NULLBYTECERT
144 CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
145 "keycert.pem")
146 SVN_PYTHON_ORG_ROOT_CERT = os.path.join(
147@@ -1368,10 +1390,13 @@
148 "https_svn_python_org_root.pem")
149 NOKIACERT = os.path.join(os.path.dirname(__file__) or os.curdir,
150 "nokia.pem")
151+ NULLBYTECERT = os.path.join(os.path.dirname(__file__) or os.curdir,
152+ "nullbytecert.pem")
153
154 if (not os.path.exists(CERTFILE) or
155 not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT) or
156- not os.path.exists(NOKIACERT)):
157+ not os.path.exists(NOKIACERT) or
158+ not os.path.exists(NULLBYTECERT)):
159 raise test_support.TestFailed("Can't read certificate files!")
160
161 tests = [BasicTests, BasicSocketTests]
162diff -r 9ddc63c039ba Modules/_ssl.c
163--- a/Modules/_ssl.c Sun Aug 11 13:04:50 2013 +0300
164+++ b/Modules/_ssl.c Sun Aug 11 18:13:17 2013 +0200
165@@ -741,8 +741,13 @@
166
167 /* get a rendering of each name in the set of names */
168
169+ int gntype;
170+ ASN1_STRING *as = NULL;
171+
172 name = sk_GENERAL_NAME_value(names, j);
173- if (name->type == GEN_DIRNAME) {
174+ gntype = name-> type;
175+ switch (gntype) {
176+ case GEN_DIRNAME:
177
178 /* we special-case DirName as a tuple of tuples of attributes */
179
180@@ -764,11 +769,61 @@
181 goto fail;
182 }
183 PyTuple_SET_ITEM(t, 1, v);
184+ break;
185
186- } else {
187+ case GEN_EMAIL:
188+ case GEN_DNS:
189+ case GEN_URI:
190+ /* GENERAL_NAME_print() doesn't handle NUL bytes in ASN1_string
191+ correctly. */
192+ t = PyTuple_New(2);
193+ if (t == NULL)
194+ goto fail;
195+ switch (gntype) {
196+ case GEN_EMAIL:
197+ v = PyUnicode_FromString("email");
198+ as = name->d.rfc822Name;
199+ break;
200+ case GEN_DNS:
201+ v = PyUnicode_FromString("DNS");
202+ as = name->d.dNSName;
203+ break;
204+ case GEN_URI:
205+ v = PyUnicode_FromString("URI");
206+ as = name->d.uniformResourceIdentifier;
207+ break;
208+ }
209+ if (v == NULL) {
210+ Py_DECREF(t);
211+ goto fail;
212+ }
213+ PyTuple_SET_ITEM(t, 0, v);
214+ v = PyString_FromStringAndSize((char *)ASN1_STRING_data(as),
215+ ASN1_STRING_length(as));
216+ if (v == NULL) {
217+ Py_DECREF(t);
218+ goto fail;
219+ }
220+ PyTuple_SET_ITEM(t, 1, v);
221+ break;
222
223+ default:
224 /* for everything else, we use the OpenSSL print form */
225-
226+ switch (gntype) {
227+ /* check for new general name type */
228+ case GEN_OTHERNAME:
229+ case GEN_X400:
230+ case GEN_EDIPARTY:
231+ case GEN_IPADD:
232+ case GEN_RID:
233+ break;
234+ default:
235+ if (PyErr_Warn(PyExc_RuntimeWarning,
236+ "Unknown general name type") == -1) {
237+ goto fail;
238+ }
239+ break;
240+ }
241 (void) BIO_reset(biobuf);
242 GENERAL_NAME_print(biobuf, name);
243 len = BIO_gets(biobuf, buf, sizeof(buf)-1);
244@@ -794,6 +849,7 @@
245 goto fail;
246 }
247 PyTuple_SET_ITEM(t, 1, v);
248+ break;
249 }
250
251 /* and add that rendering to the list */
diff --git a/meta/recipes-devtools/python/python/add-md5module-support.patch b/meta/recipes-devtools/python/python/add-md5module-support.patch
new file mode 100644
index 0000000000..33fea77554
--- /dev/null
+++ b/meta/recipes-devtools/python/python/add-md5module-support.patch
@@ -0,0 +1,18 @@
1
2Upstream-Status: Inappropriate [configuration]
3
4Signed-off-by: Saul Wold <sgw@linux.intel.com>
5
6Index: Python-2.7.2/Modules/Setup.dist
7===================================================================
8--- Python-2.7.2.orig/Modules/Setup.dist 2011-06-11 08:46:26.000000000 -0700
9+++ Python-2.7.2/Modules/Setup.dist 2011-12-27 15:51:41.244623219 -0800
10@@ -248,7 +248,7 @@
11 # Message-Digest Algorithm, described in RFC 1321. The necessary files
12 # md5.c and md5.h are included here.
13
14-#_md5 md5module.c md5.c
15+_md5 md5module.c md5.c
16
17
18 # The _sha module implements the SHA checksum algorithms.
diff --git a/meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch b/meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch
new file mode 100644
index 0000000000..208c57c822
--- /dev/null
+++ b/meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch
@@ -0,0 +1,25 @@
1_tkinter module needs tk module along with tcl. tk is not yet integrated
2in yocto so we skip the check for this module.
3Avoid a warning by not adding this module to missing variable.
4
5Upstream-Status: Inappropriate [distribution]
6
7Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
8
9Index: Python-2.7.2/setup.py
10===================================================================
11--- Python-2.7.2.orig/setup.py 2012-04-05 23:18:38.500136647 +0300
12+++ Python-2.7.2/setup.py 2012-04-05 23:19:35.888134969 +0300
13@@ -1634,8 +1634,10 @@
14 # Call the method for detecting whether _tkinter can be compiled
15 self.detect_tkinter(inc_dirs, lib_dirs)
16
17- if '_tkinter' not in [e.name for e in self.extensions]:
18- missing.append('_tkinter')
19+ # tkinter module will not be avalaible as yocto
20+ # doesn't have tk integrated (yet)
21+ #if '_tkinter' not in [e.name for e in self.extensions]:
22+ # missing.append('_tkinter')
23
24 return missing
25
diff --git a/meta/recipes-devtools/python/python/avoid_warning_for_sunos_specific_module.patch b/meta/recipes-devtools/python/python/avoid_warning_for_sunos_specific_module.patch
new file mode 100644
index 0000000000..337e0e3e29
--- /dev/null
+++ b/meta/recipes-devtools/python/python/avoid_warning_for_sunos_specific_module.patch
@@ -0,0 +1,23 @@
1sunaudiodev module is sunos specific so we avoid a warning by not
2adding this module to missing variable.
3
4Upstream-Status: Inappropriate [distribution]
5
6Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
7
8Index: Python-2.7.2/setup.py
9===================================================================
10--- Python-2.7.2.orig/setup.py 2012-04-05 22:29:18.049196608 +0300
11+++ Python-2.7.2/setup.py 2012-04-05 22:29:57.505195453 +0300
12@@ -1522,8 +1522,9 @@
13 if platform == 'sunos5':
14 # SunOS specific modules
15 exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
16- else:
17- missing.append('sunaudiodev')
18+ # If platform is not sunos warning is useless
19+ #else:
20+ # missing.append('sunaudiodev')
21
22 if platform == 'darwin':
23 # _scproxy
diff --git a/meta/recipes-devtools/python/python/builddir.patch b/meta/recipes-devtools/python/python/builddir.patch
new file mode 100644
index 0000000000..930170b95a
--- /dev/null
+++ b/meta/recipes-devtools/python/python/builddir.patch
@@ -0,0 +1,55 @@
1When cross compiling python, we used to need to install the Makefile, pyconfig.h
2and the python library to their final location before being able to compile the
3rest of python. This change allows us to point python at its own source when
4building, avoiding a variety of sysroot staging issues and simplifying the main
5python recipe.
6
7Upstream-Status: Inappropriate
8RP 2012/11/13
9
10Index: Python-2.7.3/Lib/sysconfig.py
11===================================================================
12--- Python-2.7.3.orig/Lib/sysconfig.py 2012-11-13 14:36:08.429167199 +0000
13+++ Python-2.7.3/Lib/sysconfig.py 2012-11-13 21:58:31.788551800 +0000
14@@ -93,6 +93,7 @@
15 _EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
16 _CONFIG_VARS = None
17 _USER_BASE = None
18+_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None)
19
20 def _safe_realpath(path):
21 try:
22@@ -100,7 +102,9 @@
23 except OSError:
24 return path
25
26-if sys.executable:
27+if _PYTHONBUILDDIR:
28+ _PROJECT_BASE = _PYTHONBUILDDIR
29+elif sys.executable:
30 _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))
31 else:
32 # sys.executable can be empty if argv[0] has been changed and Python is
33Index: Python-2.7.3/Lib/distutils/sysconfig.py
34===================================================================
35--- Python-2.7.3.orig/Lib/distutils/sysconfig.py 2012-11-13 14:36:08.005167209 +0000
36+++ Python-2.7.3/Lib/distutils/sysconfig.py 2012-11-13 22:07:05.644540695 +0000
37@@ -26,6 +26,9 @@
38 # live in project/PCBuild9. If we're dealing with an x64 Windows build,
39 # it'll live in project/PCbuild/amd64.
40 project_base = os.path.dirname(os.path.abspath(sys.executable))
41+_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None)
42+if _PYTHONBUILDDIR:
43+ project_base = _PYTHONBUILDDIR
44 if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
45 project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
46 # PC/VS7.1
47@@ -247,7 +250,7 @@
48 def get_makefile_filename():
49 """Return full pathname of installed Makefile from the Python build."""
50 if python_build:
51- return os.path.join(os.path.dirname(sys.executable), "Makefile")
52+ return os.path.join(project_base, "Makefile")
53 lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
54 return os.path.join(lib_dir, "config", "Makefile")
55
diff --git a/meta/recipes-devtools/python/python/cgi_py.patch b/meta/recipes-devtools/python/python/cgi_py.patch
new file mode 100644
index 0000000000..de504f9dcf
--- /dev/null
+++ b/meta/recipes-devtools/python/python/cgi_py.patch
@@ -0,0 +1,23 @@
1Lib/cgi.py: Update the script as mentioned in the comment
2
3Upstream-Status: Inappropriate [distribution]
4
5Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
6
7--- Python-2.6.6/Lib/cgi.py.orig 2010-08-01 22:14:27.000000000 -0500
8+++ Python-2.6.6/Lib/cgi.py 2011-09-21 15:28:40.478208631 -0500
9@@ -1,13 +1,4 @@
10-#! /usr/local/bin/python
11-
12-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
13-# intentionally NOT "/usr/bin/env python". On many systems
14-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
15-# scripts, and /usr/local/bin is the default directory where Python is
16-# installed, so /usr/bin/env would be unable to find python. Granted,
17-# binary installations by Linux vendors often install Python in
18-# /usr/bin. So let those vendors patch cgi.py to match their choice
19-# of installation.
20+#! /usr/bin/env python
21
22 """Support module for CGI (Common Gateway Interface) scripts.
23
diff --git a/meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch b/meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch
new file mode 100644
index 0000000000..2b62db3826
--- /dev/null
+++ b/meta/recipes-devtools/python/python/check-if-target-is-64b-not-host.patch
@@ -0,0 +1,57 @@
1Author: Andrei Gherzan <andrei@gherzan.ro>
2Date: Sun Mar 25 02:02:27 2012 +0200
3
4This patch was added for 64bit host machines. In the compile process python
5is checking if platform is a 64bit platform using sys.maxint which is the host's
6value. The patch fixes this issue so that python would check if TARGET machine
7is 64bit not the HOST machine. In this way will have "dl" and "imageop" modules
8built if HOST machine is 64bit but the target machine is 32bit.
9
10Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
11
12Upstream-Status: Pending
13
14Index: Python-2.7.2/setup.py
15===================================================================
16--- Python-2.7.2.orig/setup.py 2012-03-25 01:10:41.540163187 +0200
17+++ Python-2.7.2/setup.py 2012-03-25 01:26:06.092539990 +0200
18@@ -23,6 +23,21 @@
19 # This global variable is used to hold the list of modules to be disabled.
20 disabled_module_list = []
21
22+def target_is_64bit_platform ():
23+ """
24+ In case of cross-compile, some modules are not build as setup checks if HOST
25+ is 64bit and not TARGET.
26+ As python was built for TARGET we can check this in pyconfig.h in this way:
27+ Sizeof LONG on a 32 bit platform is 4 bytes
28+ Sizeof LONG on a 64 bit platform is 8 bytes
29+ """
30+ pyconf = open("pyconfig.h").read()
31+ aux = re.search(r"#s*define\s+SIZEOF_LONG\s+8\s*", pyconf)
32+ if aux is not None:
33+ return True
34+ else:
35+ return False
36+
37 def add_dir_to_list(dirlist, dir):
38 """Add the directory 'dir' to the list 'dirlist' (at the front) if
39 1) 'dir' is not already in 'dirlist'
40@@ -628,7 +643,7 @@
41 exts.append( Extension('audioop', ['audioop.c']) )
42
43 # Disabled on 64-bit platforms
44- if sys.maxint != 9223372036854775807L:
45+ if not target_is_64bit_platform():
46 # Operations on images
47 exts.append( Extension('imageop', ['imageop.c']) )
48 else:
49@@ -1418,7 +1433,7 @@
50 missing.append('_codecs_%s' % loc)
51
52 # Dynamic loading module
53- if sys.maxint == 0x7fffffff:
54+ if not target_is_64bit_platform():
55 # This requires sizeof(int) == sizeof(long) == sizeof(char*)
56 dl_inc = find_file('dlfcn.h', [], inc_dirs)
57 if (dl_inc is not None) and (platform not in ['atheos']):
diff --git a/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch b/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
new file mode 100644
index 0000000000..669112dab0
--- /dev/null
+++ b/meta/recipes-devtools/python/python/fix-makefile-for-ptest.patch
@@ -0,0 +1,33 @@
1Add 'build-test' and 'runtest-TESTS' targets to Makefile, to build and run tests
2cross-compiled.
3
4Signed-off-by: Tudor Florea <tudor.florea@enea.com>
5Upstream-Status: Pending
6---
7diff -ruN a/Makefile.pre.in b/Makefile.pre.in
8--- a/Makefile.pre.in 2013-06-27 10:44:11.033840532 +0200
9+++ b/Makefile.pre.in 2013-06-27 10:44:39.572635273 +0200
10@@ -709,14 +709,19 @@
11 # generated bytecode. This is sometimes a very shy bug needing a lot of
12 # sample data.
13
14-TESTOPTS= -l $(EXTRATESTOPTS)
15+TESTOPTS= -l -v $(EXTRATESTOPTS)
16 TESTPROG= $(srcdir)/Lib/test/regrtest.py
17-TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
18-test: all platform
19- -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
20+TESTPYTHON= $(RUNSHARED) $(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
21+test: build-test
22+ $(MAKE) runtest-TESTS
23+
24+runtest-TESTS:
25+ -find $(srcdir) -name '*.py[co]' -print | xargs rm -f
26 -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
27 $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
28
29+build-test: all platform
30+
31 testall: all platform
32 -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
33 $(TESTPYTHON) $(srcdir)/Lib/compileall.py
diff --git a/meta/recipes-devtools/python/python/fix_for_using_different_libdir.patch b/meta/recipes-devtools/python/python/fix_for_using_different_libdir.patch
new file mode 100644
index 0000000000..50d3915425
--- /dev/null
+++ b/meta/recipes-devtools/python/python/fix_for_using_different_libdir.patch
@@ -0,0 +1,82 @@
1Upstream-Status: Inappropriate [Embedded specific]
2
3This patch fixes issuing with different libdir like lib64.
4This patch makes the native python binary modules findable
5in the install process of the host python.
6
7Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
8Date: 2012/03/14
9
10Updated for python 2.7.3
11Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
12Date: 2012/05/01
13
14Index: Python-2.7.3/Lib/sysconfig.py
15===================================================================
16--- Python-2.7.3.orig/Lib/sysconfig.py
17+++ Python-2.7.3/Lib/sysconfig.py
18@@ -7,10 +7,10 @@ from os.path import pardir, realpath
19
20 _INSTALL_SCHEMES = {
21 'posix_prefix': {
22- 'stdlib': '{base}/lib/python{py_version_short}',
23- 'platstdlib': '{platbase}/lib/python{py_version_short}',
24- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
25- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
26+ 'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
27+ 'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
28+ 'purelib': '{base}/'+sys.lib+'/python{py_version_short}/site-packages',
29+ 'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
30 'include': '{base}/include/python{py_version_short}',
31 'platinclude': '{platbase}/include/python{py_version_short}',
32 'scripts': '{base}/bin',
33@@ -65,10 +65,10 @@ _INSTALL_SCHEMES = {
34 'data' : '{userbase}',
35 },
36 'posix_user': {
37- 'stdlib': '{userbase}/lib/python{py_version_short}',
38- 'platstdlib': '{userbase}/lib/python{py_version_short}',
39- 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
40- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
41+ 'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
42+ 'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
43+ 'purelib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
44+ 'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
45 'include': '{userbase}/include/python{py_version_short}',
46 'scripts': '{userbase}/bin',
47 'data' : '{userbase}',
48Index: Python-2.7.3/Makefile.pre.in
49===================================================================
50--- Python-2.7.3.orig/Makefile.pre.in
51+++ Python-2.7.3/Makefile.pre.in
52@@ -941,25 +941,25 @@ libinstall: build_all $(srcdir)/Lib/$(PL
53 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
54 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
55 fi
56- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
57+ PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
58 $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
59 -d $(LIBDEST) -f \
60 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
61 $(DESTDIR)$(LIBDEST)
62- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
63+ PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
64 $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
65 -d $(LIBDEST) -f \
66 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
67 $(DESTDIR)$(LIBDEST)
68- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
69+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
70 $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
71 -d $(LIBDEST)/site-packages -f \
72 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
73- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
74+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
75 $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
76 -d $(LIBDEST)/site-packages -f \
77 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
78- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
79+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
80 $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
81
82 # Create the PLATDIR source directory, if one wasn't distributed..
diff --git a/meta/recipes-devtools/python/python/gcc-4.8-fix-configure-Wformat.patch b/meta/recipes-devtools/python/python/gcc-4.8-fix-configure-Wformat.patch
new file mode 100644
index 0000000000..b5d9d5d424
--- /dev/null
+++ b/meta/recipes-devtools/python/python/gcc-4.8-fix-configure-Wformat.patch
@@ -0,0 +1,20 @@
1backport bug 17547 from http://hg.python.org/cpython/rev/9d50af4c482f/
2
3-Wformat is needed by gcc 4.8
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Upstream-Status: Backport
8Index: Python-2.7.3/configure.in
9===================================================================
10--- Python-2.7.3.orig/configure.in 2013-06-11 02:22:04.186529212 -0700
11+++ Python-2.7.3/configure.in 2013-06-13 02:17:06.324403327 -0700
12@@ -1196,7 +1196,7 @@
13 then
14 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
15 save_CFLAGS=$CFLAGS
16- CFLAGS="$CFLAGS -Werror"
17+ CFLAGS="$CFLAGS -Werror -Wformat"
18 AC_COMPILE_IFELSE([
19 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
20 ],[
diff --git a/meta/recipes-devtools/python/python/host_include_contamination.patch b/meta/recipes-devtools/python/python/host_include_contamination.patch
new file mode 100644
index 0000000000..62cb8b16da
--- /dev/null
+++ b/meta/recipes-devtools/python/python/host_include_contamination.patch
@@ -0,0 +1,27 @@
1when building python for qemux86-64 on ubuntu 11.10/64bit
2it gropes into host includes and then mixes them with cross
3includes and as a result some modules fail to compile and link
4one of the modules is python-elementtree which is then not
5found during image creation
6
7Proble is that setup.py tries to add native includes that newer
8ubuntu has introduced for multiarch support. But that should
9only happen for native builds and not cross building python
10so we add a check here.
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13Upstream-Status: Pending
14
15Index: Python-2.7.2/setup.py
16===================================================================
17--- Python-2.7.2.orig/setup.py 2012-02-03 12:10:42.307057756 -0800
18+++ Python-2.7.2/setup.py 2012-02-03 12:11:12.363059210 -0800
19@@ -360,6 +360,8 @@
20 # https://wiki.ubuntu.com/MultiarchSpec
21 if not find_executable('dpkg-architecture'):
22 return
23+ if os.environ.get('CROSS_COMPILE') is not None:
24+ return
25 tmpfile = os.path.join(self.build_temp, 'multiarch')
26 if not os.path.exists(self.build_temp):
27 os.makedirs(self.build_temp)
diff --git a/meta/recipes-devtools/python/python/multilib.patch b/meta/recipes-devtools/python/python/multilib.patch
new file mode 100644
index 0000000000..df470f7c09
--- /dev/null
+++ b/meta/recipes-devtools/python/python/multilib.patch
@@ -0,0 +1,257 @@
1commit 248279e54467a8cd5cde98fc124d1d1384703513
2Author: Yu Ke <ke.yu@intel.com>
3Date: Tue Jun 28 21:21:29 2011 +0800
4
5 SUSE patch for the lib64 issue
6
7 see detail in http://bugs.python.org/issue1294959
8
9 also rebased a bit for Yocto python 2.6.6
10
11 Picked-by: Yu Ke <ke.yu@intel.com>
12
132011/09/29
14Rebased for python 2.7.2
15
16Upstream-Status: Inappropriate [configuration]
17
18Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
19
20Index: Python-2.7.2/Include/pythonrun.h
21===================================================================
22--- Python-2.7.2.orig/Include/pythonrun.h
23+++ Python-2.7.2/Include/pythonrun.h
24@@ -108,6 +108,7 @@ PyAPI_FUNC(char *) Py_GetPath(void);
25 /* In their own files */
26 PyAPI_FUNC(const char *) Py_GetVersion(void);
27 PyAPI_FUNC(const char *) Py_GetPlatform(void);
28+PyAPI_FUNC(const char *) Py_GetLib(void);
29 PyAPI_FUNC(const char *) Py_GetCopyright(void);
30 PyAPI_FUNC(const char *) Py_GetCompiler(void);
31 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
32Index: Python-2.7.2/Lib/distutils/command/install.py
33===================================================================
34--- Python-2.7.2.orig/Lib/distutils/command/install.py
35+++ Python-2.7.2/Lib/distutils/command/install.py
36@@ -22,6 +22,8 @@ from site import USER_BASE
37 from site import USER_SITE
38
39
40+libname = sys.lib
41+
42 if sys.version < "2.2":
43 WINDOWS_SCHEME = {
44 'purelib': '$base',
45@@ -42,7 +44,7 @@ else:
46 INSTALL_SCHEMES = {
47 'unix_prefix': {
48 'purelib': '$base/lib/python$py_version_short/site-packages',
49- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
50+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
51 'headers': '$base/include/python$py_version_short/$dist_name',
52 'scripts': '$base/bin',
53 'data' : '$base',
54Index: Python-2.7.2/Lib/distutils/sysconfig.py
55===================================================================
56--- Python-2.7.2.orig/Lib/distutils/sysconfig.py
57+++ Python-2.7.2/Lib/distutils/sysconfig.py
58@@ -114,8 +114,11 @@ def get_python_lib(plat_specific=0, stan
59 prefix = plat_specific and EXEC_PREFIX or PREFIX
60
61 if os.name == "posix":
62- libpython = os.path.join(prefix,
63- "lib", "python" + get_python_version())
64+ if plat_specific or standard_lib:
65+ lib = sys.lib
66+ else:
67+ lib = "lib"
68+ libpython = os.path.join(prefix, lib, "python" + get_python_version())
69 if standard_lib:
70 return libpython
71 else:
72Index: Python-2.7.2/Lib/pydoc.py
73===================================================================
74--- Python-2.7.2.orig/Lib/pydoc.py
75+++ Python-2.7.2/Lib/pydoc.py
76@@ -352,7 +352,7 @@ class Doc:
77
78 docloc = os.environ.get("PYTHONDOCS",
79 "http://docs.python.org/library")
80- basedir = os.path.join(sys.exec_prefix, "lib",
81+ basedir = os.path.join(sys.exec_prefix, sys.lib,
82 "python"+sys.version[0:3])
83 if (isinstance(object, type(os)) and
84 (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
85Index: Python-2.7.2/Lib/site.py
86===================================================================
87--- Python-2.7.2.orig/Lib/site.py
88+++ Python-2.7.2/Lib/site.py
89@@ -300,13 +300,19 @@ def getsitepackages():
90 if sys.platform in ('os2emx', 'riscos'):
91 sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
92 elif os.sep == '/':
93- sitepackages.append(os.path.join(prefix, "lib",
94+ sitepackages.append(os.path.join(prefix, sys.lib,
95 "python" + sys.version[:3],
96 "site-packages"))
97- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
98+ if sys.lib != "lib":
99+ sitepackages.append(os.path.join(prefix, "lib",
100+ "python" + sys.version[:3],
101+ "site-packages"))
102+ sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
103+ if sys.lib != "lib":
104+ sitepackages.append(os.path.join(prefix, "lib", "site-python"))
105 else:
106 sitepackages.append(prefix)
107- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
108+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
109 if sys.platform == "darwin":
110 # for framework builds *only* we add the standard Apple
111 # locations.
112Index: Python-2.7.2/Lib/test/test_dl.py
113===================================================================
114--- Python-2.7.2.orig/Lib/test/test_dl.py
115+++ Python-2.7.2/Lib/test/test_dl.py
116@@ -5,10 +5,11 @@
117 import unittest
118 from test.test_support import verbose, import_module
119 dl = import_module('dl', deprecated=True)
120+import sys
121
122 sharedlibs = [
123- ('/usr/lib/libc.so', 'getpid'),
124- ('/lib/libc.so.6', 'getpid'),
125+ ('/usr/'+sys.lib+'/libc.so', 'getpid'),
126+ ('/'+sys.lib+'/libc.so.6', 'getpid'),
127 ('/usr/bin/cygwin1.dll', 'getpid'),
128 ('/usr/lib/libc.dylib', 'getpid'),
129 ]
130Index: Python-2.7.2/Lib/trace.py
131===================================================================
132--- Python-2.7.2.orig/Lib/trace.py
133+++ Python-2.7.2/Lib/trace.py
134@@ -762,10 +762,10 @@ def main(argv=None):
135 # should I also call expanduser? (after all, could use $HOME)
136
137 s = s.replace("$prefix",
138- os.path.join(sys.prefix, "lib",
139+ os.path.join(sys.prefix, sys.lib,
140 "python" + sys.version[:3]))
141 s = s.replace("$exec_prefix",
142- os.path.join(sys.exec_prefix, "lib",
143+ os.path.join(sys.exec_prefix, sys.lib,
144 "python" + sys.version[:3]))
145 s = os.path.normpath(s)
146 ignore_dirs.append(s)
147Index: Python-2.7.2/Makefile.pre.in
148===================================================================
149--- Python-2.7.2.orig/Makefile.pre.in
150+++ Python-2.7.2/Makefile.pre.in
151@@ -81,6 +81,7 @@ PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAG
152
153 # Machine-dependent subdirectories
154 MACHDEP= @MACHDEP@
155+LIB= @LIB@
156
157 # Install prefix for architecture-independent files
158 prefix= @prefix@
159@@ -97,7 +98,7 @@ LIBDIR= @libdir@
160 MANDIR= @mandir@
161 INCLUDEDIR= @includedir@
162 CONFINCLUDEDIR= $(exec_prefix)/include
163-SCRIPTDIR= $(prefix)/lib
164+SCRIPTDIR= $(prefix)/@LIB@
165
166 # Detailed destination directories
167 BINLIBDEST= $(LIBDIR)/python$(VERSION)
168@@ -533,6 +534,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
169 -DEXEC_PREFIX='"$(exec_prefix)"' \
170 -DVERSION='"$(VERSION)"' \
171 -DVPATH='"$(VPATH)"' \
172+ -DLIB='"$(LIB)"' \
173 -o $@ $(srcdir)/Modules/getpath.c
174
175 Modules/python.o: $(srcdir)/Modules/python.c
176@@ -567,7 +569,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
177 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
178
179 Python/getplatform.o: $(srcdir)/Python/getplatform.c
180- $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
181+ $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
182
183 Python/importdl.o: $(srcdir)/Python/importdl.c
184 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
185Index: Python-2.7.2/Modules/getpath.c
186===================================================================
187--- Python-2.7.2.orig/Modules/getpath.c
188+++ Python-2.7.2/Modules/getpath.c
189@@ -116,9 +116,11 @@
190 #define EXEC_PREFIX PREFIX
191 #endif
192
193+#define LIB_PYTHON LIB "/python" VERSION
194+
195 #ifndef PYTHONPATH
196-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
197- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
198+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
199+ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
200 #endif
201
202 #ifndef LANDMARK
203@@ -129,7 +131,7 @@ static char prefix[MAXPATHLEN+1];
204 static char exec_prefix[MAXPATHLEN+1];
205 static char progpath[MAXPATHLEN+1];
206 static char *module_search_path = NULL;
207-static char lib_python[] = "lib/python" VERSION;
208+static char lib_python[] = LIB_PYTHON;
209
210 static void
211 reduce(char *dir)
212Index: Python-2.7.2/Python/getplatform.c
213===================================================================
214--- Python-2.7.2.orig/Python/getplatform.c
215+++ Python-2.7.2/Python/getplatform.c
216@@ -10,3 +10,13 @@ Py_GetPlatform(void)
217 {
218 return PLATFORM;
219 }
220+
221+#ifndef LIB
222+#define LIB "lib"
223+#endif
224+
225+const char *
226+Py_GetLib(void)
227+{
228+ return LIB;
229+}
230Index: Python-2.7.2/Python/sysmodule.c
231===================================================================
232--- Python-2.7.2.orig/Python/sysmodule.c
233+++ Python-2.7.2/Python/sysmodule.c
234@@ -1416,6 +1416,8 @@ _PySys_Init(void)
235 PyString_FromString(Py_GetCopyright()));
236 SET_SYS_FROM_STRING("platform",
237 PyString_FromString(Py_GetPlatform()));
238+ SET_SYS_FROM_STRING("lib",
239+ PyString_FromString(Py_GetLib()));
240 SET_SYS_FROM_STRING("executable",
241 PyString_FromString(Py_GetProgramFullPath()));
242 SET_SYS_FROM_STRING("prefix",
243Index: Python-2.7.2/configure.in
244===================================================================
245--- Python-2.7.2.orig/configure.in
246+++ Python-2.7.2/configure.in
247@@ -629,6 +629,10 @@ SunOS*)
248 ;;
249 esac
250
251+AC_SUBST(LIB)
252+AC_MSG_CHECKING(LIB)
253+LIB=`basename ${libdir}`
254+AC_MSG_RESULT($LIB)
255
256 AC_SUBST(LIBRARY)
257 AC_MSG_CHECKING(LIBRARY)
diff --git a/meta/recipes-devtools/python/python/parallel-makeinst-create-bindir.patch b/meta/recipes-devtools/python/python/parallel-makeinst-create-bindir.patch
new file mode 100644
index 0000000000..951cb466ff
--- /dev/null
+++ b/meta/recipes-devtools/python/python/parallel-makeinst-create-bindir.patch
@@ -0,0 +1,19 @@
1When using make -j with the 'install' target, it's possible for altbininstall
2(which normally creates BINDIR) and libainstall (which doesn't, though it
3installs python-config there) to race, resulting in a failure due to
4attempting to install python-config into a nonexistent BINDIR. Ensure it also
5exists in the libainstall target.
6
7Upstream-Status: Pending
8
9--- Python-2.7.3.orig/Makefile.pre.in
10+++ Python-2.7.3/Makefile.pre.in
11@@ -1008,7 +1008,7 @@ LIBPL= $(LIBP)/config
12 LIBPC= $(LIBDIR)/pkgconfig
13
14 libainstall: all python-config
15- @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
16+ @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC) $(BINDIR); \
17 do \
18 if test ! -d $(DESTDIR)$$i; then \
19 echo "Creating directory $$i"; \
diff --git a/meta/recipes-devtools/python/python/pypirc-secure.patch b/meta/recipes-devtools/python/python/pypirc-secure.patch
new file mode 100644
index 0000000000..8e2df677b6
--- /dev/null
+++ b/meta/recipes-devtools/python/python/pypirc-secure.patch
@@ -0,0 +1,35 @@
1# HG changeset patch
2# User Philip Jenvey <pjenvey@underboss.org>
3# Date 1322701507 28800
4# Branch 2.7
5# Node ID e7c20a8476a0e2ca18f8040864cbc400818d8f24
6# Parent 3ecddf168f1f554a17a047384fe0b02f2d688277
7create the .pypirc securely
8
9Upstream-Status: Backport
10
11Signed-off-by: Saul Wold <sgw@linux.intel.com>
12
13
14diff -r 3ecddf168f1f -r e7c20a8476a0 Lib/distutils/config.py
15--- a/Lib/distutils/config.py Tue Nov 29 00:53:09 2011 +0100
16+++ b/Lib/distutils/config.py Wed Nov 30 17:05:07 2011 -0800
17@@ -42,16 +42,8 @@
18 def _store_pypirc(self, username, password):
19 """Creates a default .pypirc file."""
20 rc = self._get_rc_file()
21- f = open(rc, 'w')
22- try:
23- f.write(DEFAULT_PYPIRC % (username, password))
24- finally:
25- f.close()
26- try:
27- os.chmod(rc, 0600)
28- except OSError:
29- # should do something better here
30- pass
31+ with os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0600), 'w') as fp:
32+ fp.write(DEFAULT_PYPIRC % (username, password))
33
34 def _read_pypirc(self):
35 """Reads the .pypirc file."""
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-CVE-2012-2135.patch b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2012-2135.patch
new file mode 100644
index 0000000000..3afdbc0f6e
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2012-2135.patch
@@ -0,0 +1,73 @@
1Upstream-Status: Backport
2
3Reference:http://bugs.python.org/issue14579
4
5The utf-16 decoder in Python 3.1 through 3.3 does not update the
6aligned_end variable after calling the unicode_decode_call_errorhandler
7function, which allows remote attackers to obtain sensitive information
8(process memory) or cause a denial of service (memory corruption and crash)
9via unspecified vectors.
10
11http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-2135
12
13diff -urpN a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
14--- a/Lib/test/test_codecs.py
15+++ b/Lib/test/test_codecs.py
16@@ -495,8 +495,21 @@ class UTF16LETest(ReadTest):
17 )
18
19 def test_errors(self):
20- self.assertRaises(UnicodeDecodeError, codecs.utf_16_le_decode, "\xff", "strict", True)
21-
22+ tests = [
23+ (b'\xff', u'\ufffd'),
24+ (b'A\x00Z', u'A\ufffd'),
25+ (b'A\x00B\x00C\x00D\x00Z', u'ABCD\ufffd'),
26+ (b'\x00\xd8', u'\ufffd'),
27+ (b'\x00\xd8A', u'\ufffd'),
28+ (b'\x00\xd8A\x00', u'\ufffdA'),
29+ (b'\x00\xdcA\x00', u'\ufffdA'),
30+ ]
31+ for raw, expected in tests:
32+ print('*****', raw, expected)
33+ self.assertRaises(UnicodeDecodeError, codecs.utf_16_le_decode,
34+ raw, 'strict', True)
35+ self.assertEqual(raw.decode('utf-16le', 'replace'), expected)
36+
37 class UTF16BETest(ReadTest):
38 encoding = "utf-16-be"
39
40@@ -516,7 +529,20 @@ class UTF16BETest(ReadTest):
41 )
42
43 def test_errors(self):
44- self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode, "\xff", "strict", True)
45+ tests = [
46+ (b'\xff', u'\ufffd'),
47+ (b'\x00A\xff', u'A\ufffd'),
48+ (b'\x00A\x00B\x00C\x00DZ', u'ABCD\ufffd'),
49+ (b'\xd8\x00', u'\ufffd'),
50+ (b'\xd8\x00\xdc', u'\ufffd'),
51+ (b'\xd8\x00\x00A', u'\ufffdA'),
52+ (b'\xdc\x00\x00A', u'\ufffdA'),
53+ ]
54+ for raw, expected in tests:
55+ print('*****', raw, expected)
56+ self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode,
57+ raw, 'strict', True)
58+ self.assertEqual(raw.decode('utf-16be', 'replace'), expected)
59
60 class UTF8Test(ReadTest):
61 encoding = "utf-8"
62diff -urpN a/Objects/unicodeobject.c b/Objects/unicodeobject.c
63--- a/Objects/unicodeobject.c 2013-03-04 11:34:34.000000000 +0800
64+++ b/Objects/unicodeobject.c 2013-03-04 11:36:01.000000000 +0800
65@@ -2564,7 +2564,7 @@ PyUnicode_DecodeUTF16Stateful(const char
66 }
67
68 /* UTF-16 code pair: */
69- if (q >= e) {
70+ if (e - q < 2) {
71 errmsg = "unexpected end of data";
72 startinpos = (((const char *)q)-2)-starts;
73 endinpos = ((const char *)e)-starts;
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-smtplib-fix.patch b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-smtplib-fix.patch
new file mode 100644
index 0000000000..f34ff40ea5
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-smtplib-fix.patch
@@ -0,0 +1,101 @@
1Upstream-Status: Backport
2
3Reference: http://bugs.python.org/issue16042
4
5CVE-2013-1752: smtplib: Limit amount of data read by limiting the
6call to readline(). Original patch by Christian Heimes
7
8Signed-off-by: Maxin B. John <maxin.john@enea.com>
9---
10diff -Naur Python-2.7.3-orig/Lib/smtplib.py Python-2.7.3/Lib/smtplib.py
11--- Python-2.7.3-orig/Lib/smtplib.py 2012-04-10 01:07:31.000000000 +0200
12+++ Python-2.7.3/Lib/smtplib.py 2014-02-27 14:15:24.444198465 +0100
13@@ -57,6 +57,7 @@
14 SMTP_PORT = 25
15 SMTP_SSL_PORT = 465
16 CRLF = "\r\n"
17+_MAXLINE = 8192 # more than 8 times larger than RFC 821, 4.5.3
18
19 OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I)
20
21@@ -179,10 +180,14 @@
22 def __init__(self, sslobj):
23 self.sslobj = sslobj
24
25- def readline(self):
26+ def readline(self, size=-1):
27+ if size < 0:
28+ size = None
29 str = ""
30 chr = None
31 while chr != "\n":
32+ if size is not None and len(str) >= size:
33+ break
34 chr = self.sslobj.read(1)
35 if not chr:
36 break
37@@ -351,7 +356,7 @@
38 self.file = self.sock.makefile('rb')
39 while 1:
40 try:
41- line = self.file.readline()
42+ line = self.file.readline(_MAXLINE + 1)
43 except socket.error as e:
44 self.close()
45 raise SMTPServerDisconnected("Connection unexpectedly closed: "
46@@ -361,6 +366,8 @@
47 raise SMTPServerDisconnected("Connection unexpectedly closed")
48 if self.debuglevel > 0:
49 print>>stderr, 'reply:', repr(line)
50+ if len(line) > _MAXLINE:
51+ raise SMTPResponseException(500, "Line too long.")
52 resp.append(line[4:].strip())
53 code = line[:3]
54 # Check that the error code is syntactically correct.
55diff -Naur Python-2.7.3-orig/Lib/test/test_smtplib.py Python-2.7.3/Lib/test/test_smtplib.py
56--- Python-2.7.3-orig/Lib/test/test_smtplib.py 2012-04-10 01:07:32.000000000 +0200
57+++ Python-2.7.3/Lib/test/test_smtplib.py 2014-02-27 14:15:24.448198293 +0100
58@@ -292,6 +292,33 @@
59 HOST, self.port, 'localhost', 3)
60
61
62+@unittest.skipUnless(threading, 'Threading required for this test.')
63+class TooLongLineTests(unittest.TestCase):
64+ respdata = '250 OK' + ('.' * smtplib._MAXLINE * 2) + '\n'
65+
66+ def setUp(self):
67+ self.old_stdout = sys.stdout
68+ self.output = StringIO.StringIO()
69+ sys.stdout = self.output
70+
71+ self.evt = threading.Event()
72+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
73+ self.sock.settimeout(15)
74+ self.port = test_support.bind_port(self.sock)
75+ servargs = (self.evt, self.respdata, self.sock)
76+ threading.Thread(target=server, args=servargs).start()
77+ self.evt.wait()
78+ self.evt.clear()
79+
80+ def tearDown(self):
81+ self.evt.wait()
82+ sys.stdout = self.old_stdout
83+
84+ def testLineTooLong(self):
85+ self.assertRaises(smtplib.SMTPResponseException, smtplib.SMTP,
86+ HOST, self.port, 'localhost', 3)
87+
88+
89 sim_users = {'Mr.A@somewhere.com':'John A',
90 'Ms.B@somewhere.com':'Sally B',
91 'Mrs.C@somewhereesle.com':'Ruth C',
92@@ -511,7 +538,8 @@
93 def test_main(verbose=None):
94 test_support.run_unittest(GeneralTests, DebuggingServerTests,
95 NonConnectingTests,
96- BadHELOServerTests, SMTPSimTests)
97+ BadHELOServerTests, SMTPSimTests,
98+ TooLongLineTests)
99
100 if __name__ == '__main__':
101 test_main()
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-CVE-2014-1912.patch b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2014-1912.patch
new file mode 100644
index 0000000000..02cc83d314
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2014-1912.patch
@@ -0,0 +1,26 @@
1Upstream-Status: Backport
2
3Reference: http://bugs.python.org/issue20246
4
5CVE-2014-1912: Python buffer overflow in socket.recvfrom_into()
6lets remote users execute arbitrary code.Original patch by Benjamin Peterson
7
8Signed-off-by: Maxin B. John <maxin.john@enea.com>
9---
10diff -r 40fb60df4755 Modules/socketmodule.c
11--- a/Modules/socketmodule.c Sun Jan 12 12:11:47 2014 +0200
12+++ b/Modules/socketmodule.c Mon Jan 13 16:36:35 2014 -0800
13@@ -2744,6 +2744,13 @@
14 recvlen = buflen;
15 }
16
17+ /* Check if the buffer is large enough */
18+ if (buflen < recvlen) {
19+ PyErr_SetString(PyExc_ValueError,
20+ "buffer too small for requested bytes");
21+ goto error;
22+ }
23+
24 readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr);
25 if (readlen < 0) {
26 /* Return an error */
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch
new file mode 100644
index 0000000000..3df33368ec
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch
@@ -0,0 +1,1572 @@
1Upstream-Status: Inappropriate [not author]
2
3Fix to support db 5.3 for bsddb module in python 2.7.2
4
5This patch is made from the db5.1.diff in
6http://archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.3-0ubuntu3.diff.gz
7
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9---
10 Lib/bsddb/__init__.py | 2 +-
11 Lib/bsddb/test/test_all.py | 5 +-
12 Lib/bsddb/test/test_dbenv.py | 29 +++-
13 Modules/_bsddb.c | 439 +++++++++++++++++++++++-------------------
14 Modules/bsddb.h | 20 +-
15 setup.py | 25 +++-
16 6 files changed, 307 insertions(+), 213 deletions(-)
17
18diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py
19index ed4deea..1b1c388 100644
20--- a/Lib/bsddb/__init__.py
21+++ b/Lib/bsddb/__init__.py
22@@ -33,7 +33,7 @@
23 #----------------------------------------------------------------------
24
25
26-"""Support for Berkeley DB 4.1 through 4.8 with a simple interface.
27+"""Support for Berkeley DB 4.2 through 5.3 with a simple interface.
28
29 For the full featured object oriented interface use the bsddb.db module
30 instead. It mirrors the Oracle Berkeley DB C API.
31diff --git a/Lib/bsddb/test/test_all.py b/Lib/bsddb/test/test_all.py
32index e9fe618..6a25f4a 100644
33--- a/Lib/bsddb/test/test_all.py
34+++ b/Lib/bsddb/test/test_all.py
35@@ -484,6 +484,8 @@ def print_versions():
36 print '-=' * 38
37 print db.DB_VERSION_STRING
38 print 'bsddb.db.version(): %s' % (db.version(), )
39+ if db.version() >= (5, 0) :
40+ print 'bsddb.db.full_version(): %s' %repr(db.full_version())
41 print 'bsddb.db.__version__: %s' % db.__version__
42 print 'bsddb.db.cvsid: %s' % db.cvsid
43
44@@ -528,7 +530,8 @@ def get_new_database_path() :
45
46 # This path can be overriden via "set_test_path_prefix()".
47 import os, os.path
48-get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB")
49+get_new_path.prefix=os.path.join(os.environ.get("TMPDIR",
50+ os.path.join(os.sep,"tmp")), "z-Berkeley_DB")
51 get_new_path.num=0
52
53 def get_test_path_prefix() :
54diff --git a/Lib/bsddb/test/test_dbenv.py b/Lib/bsddb/test/test_dbenv.py
55index 37281df..6ac1e54 100644
56--- a/Lib/bsddb/test/test_dbenv.py
57+++ b/Lib/bsddb/test/test_dbenv.py
58@@ -25,12 +25,31 @@ class DBEnv(unittest.TestCase):
59 test_support.rmtree(self.homeDir)
60
61 class DBEnv_general(DBEnv) :
62+ def test_get_open_flags(self) :
63+ flags = db.DB_CREATE | db.DB_INIT_MPOOL
64+ self.env.open(self.homeDir, flags)
65+ self.assertEqual(flags, self.env.get_open_flags())
66+
67+ def test_get_open_flags2(self) :
68+ flags = db.DB_CREATE | db.DB_INIT_MPOOL | \
69+ db.DB_INIT_LOCK | db.DB_THREAD
70+ self.env.open(self.homeDir, flags)
71+ self.assertEqual(flags, self.env.get_open_flags())
72+
73 if db.version() >= (4, 7) :
74 def test_lk_partitions(self) :
75 for i in [10, 20, 40] :
76 self.env.set_lk_partitions(i)
77 self.assertEqual(i, self.env.get_lk_partitions())
78
79+ def test_getset_intermediate_dir_mode(self) :
80+ self.assertEqual(None, self.env.get_intermediate_dir_mode())
81+ for mode in ["rwx------", "rw-rw-rw-", "rw-r--r--"] :
82+ self.env.set_intermediate_dir_mode(mode)
83+ self.assertEqual(mode, self.env.get_intermediate_dir_mode())
84+ self.assertRaises(db.DBInvalidArgError,
85+ self.env.set_intermediate_dir_mode, "abcde")
86+
87 if db.version() >= (4, 6) :
88 def test_thread(self) :
89 for i in [16, 100, 1000] :
90@@ -115,7 +134,7 @@ class DBEnv_general(DBEnv) :
91 self.assertEqual(i, self.env.get_lk_max_lockers())
92
93 def test_lg_regionmax(self) :
94- for i in [128, 256, 1024] :
95+ for i in [128, 256, 1000] :
96 i = i*1024*1024
97 self.env.set_lg_regionmax(i)
98 j = self.env.get_lg_regionmax()
99@@ -172,8 +191,12 @@ class DBEnv_general(DBEnv) :
100 self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
101 cachesize = (0, 2*1024*1024, 1)
102 self.assertRaises(db.DBInvalidArgError,
103- self.env.set_cachesize, *cachesize)
104- self.assertEqual(cachesize2, self.env.get_cachesize())
105+ self.env.set_cachesize, *cachesize)
106+ cachesize3 = self.env.get_cachesize()
107+ self.assertEqual(cachesize2[0], cachesize3[0])
108+ self.assertEqual(cachesize2[2], cachesize3[2])
109+ # In Berkeley DB 5.3, the cachesize can change when opening the Env
110+ self.assertTrue(cachesize2[1] <= cachesize3[1])
111
112 def test_set_cachesize_dbenv_db(self) :
113 # You can not configure the cachesize using
114diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
115index d2d12ff..e98e4bc 100644
116--- a/Modules/_bsddb.c
117+++ b/Modules/_bsddb.c
118@@ -187,8 +187,10 @@ static PyObject* DBOldVersionError; /* DB_OLD_VERSION */
119 static PyObject* DBRunRecoveryError; /* DB_RUNRECOVERY */
120 static PyObject* DBVerifyBadError; /* DB_VERIFY_BAD */
121 static PyObject* DBNoServerError; /* DB_NOSERVER */
122+#if (DBVER < 52)
123 static PyObject* DBNoServerHomeError; /* DB_NOSERVER_HOME */
124 static PyObject* DBNoServerIDError; /* DB_NOSERVER_ID */
125+#endif
126 static PyObject* DBPageNotFoundError; /* DB_PAGE_NOTFOUND */
127 static PyObject* DBSecondaryBadError; /* DB_SECONDARY_BAD */
128
129@@ -202,9 +204,7 @@ static PyObject* DBFileExistsError; /* EEXIST */
130 static PyObject* DBNoSuchFileError; /* ENOENT */
131 static PyObject* DBPermissionsError; /* EPERM */
132
133-#if (DBVER >= 42)
134 static PyObject* DBRepHandleDeadError; /* DB_REP_HANDLE_DEAD */
135-#endif
136 #if (DBVER >= 44)
137 static PyObject* DBRepLockoutError; /* DB_REP_LOCKOUT */
138 #endif
139@@ -696,8 +696,10 @@ static int makeDBError(int err)
140 case DB_RUNRECOVERY: errObj = DBRunRecoveryError; break;
141 case DB_VERIFY_BAD: errObj = DBVerifyBadError; break;
142 case DB_NOSERVER: errObj = DBNoServerError; break;
143+#if (DBVER < 52)
144 case DB_NOSERVER_HOME: errObj = DBNoServerHomeError; break;
145 case DB_NOSERVER_ID: errObj = DBNoServerIDError; break;
146+#endif
147 case DB_PAGE_NOTFOUND: errObj = DBPageNotFoundError; break;
148 case DB_SECONDARY_BAD: errObj = DBSecondaryBadError; break;
149 case DB_BUFFER_SMALL: errObj = DBNoMemoryError; break;
150@@ -715,9 +717,7 @@ static int makeDBError(int err)
151 case ENOENT: errObj = DBNoSuchFileError; break;
152 case EPERM : errObj = DBPermissionsError; break;
153
154-#if (DBVER >= 42)
155 case DB_REP_HANDLE_DEAD : errObj = DBRepHandleDeadError; break;
156-#endif
157 #if (DBVER >= 44)
158 case DB_REP_LOCKOUT : errObj = DBRepLockoutError; break;
159 #endif
160@@ -2132,7 +2132,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs)
161 MYDB_BEGIN_ALLOW_THREADS;
162 err = self->db->get(self->db, txn, &key, &data, flags);
163 MYDB_END_ALLOW_THREADS;
164- if (err == DB_BUFFER_SMALL) {
165+ if ((err == DB_BUFFER_SMALL) || (err == 0)) {
166 retval = NUMBER_FromLong((long)data.size);
167 err = 0;
168 }
169@@ -2385,9 +2385,7 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs)
170 return NULL;
171 }
172
173-#if (DBVER >= 42)
174 self->db->get_flags(self->db, &self->setflags);
175-#endif
176
177 self->flags = flags;
178
179@@ -2539,6 +2537,37 @@ DB_get_priority(DBObject* self)
180 #endif
181
182 static PyObject*
183+DB_get_dbname(DBObject* self)
184+{
185+ int err;
186+ const char *filename, *dbname;
187+
188+ CHECK_DB_NOT_CLOSED(self);
189+
190+ MYDB_BEGIN_ALLOW_THREADS;
191+ err = self->db->get_dbname(self->db, &filename, &dbname);
192+ MYDB_END_ALLOW_THREADS;
193+ RETURN_IF_ERR();
194+ /* If "dbname==NULL", it is correctly converted to "None" */
195+ return Py_BuildValue("(ss)", filename, dbname);
196+}
197+
198+static PyObject*
199+DB_get_open_flags(DBObject* self)
200+{
201+ int err;
202+ unsigned int flags;
203+
204+ CHECK_DB_NOT_CLOSED(self);
205+
206+ MYDB_BEGIN_ALLOW_THREADS;
207+ err = self->db->get_open_flags(self->db, &flags);
208+ MYDB_END_ALLOW_THREADS;
209+ RETURN_IF_ERR();
210+ return NUMBER_FromLong(flags);
211+}
212+
213+static PyObject*
214 DB_set_q_extentsize(DBObject* self, PyObject* args)
215 {
216 int err;
217@@ -2555,7 +2584,6 @@ DB_set_q_extentsize(DBObject* self, PyObject* args)
218 RETURN_NONE();
219 }
220
221-#if (DBVER >= 42)
222 static PyObject*
223 DB_get_q_extentsize(DBObject* self)
224 {
225@@ -2570,7 +2598,6 @@ DB_get_q_extentsize(DBObject* self)
226 RETURN_IF_ERR();
227 return NUMBER_FromLong(extentsize);
228 }
229-#endif
230
231 static PyObject*
232 DB_set_bt_minkey(DBObject* self, PyObject* args)
233@@ -2588,7 +2615,6 @@ DB_set_bt_minkey(DBObject* self, PyObject* args)
234 RETURN_NONE();
235 }
236
237-#if (DBVER >= 42)
238 static PyObject*
239 DB_get_bt_minkey(DBObject* self)
240 {
241@@ -2603,7 +2629,6 @@ DB_get_bt_minkey(DBObject* self)
242 RETURN_IF_ERR();
243 return NUMBER_FromLong(bt_minkey);
244 }
245-#endif
246
247 static int
248 _default_cmp(const DBT *leftKey,
249@@ -2759,7 +2784,6 @@ DB_set_cachesize(DBObject* self, PyObject* args)
250 RETURN_NONE();
251 }
252
253-#if (DBVER >= 42)
254 static PyObject*
255 DB_get_cachesize(DBObject* self)
256 {
257@@ -2777,7 +2801,6 @@ DB_get_cachesize(DBObject* self)
258
259 return Py_BuildValue("(iii)", gbytes, bytes, ncache);
260 }
261-#endif
262
263 static PyObject*
264 DB_set_flags(DBObject* self, PyObject* args)
265@@ -2797,7 +2820,6 @@ DB_set_flags(DBObject* self, PyObject* args)
266 RETURN_NONE();
267 }
268
269-#if (DBVER >= 42)
270 static PyObject*
271 DB_get_flags(DBObject* self)
272 {
273@@ -2812,6 +2834,35 @@ DB_get_flags(DBObject* self)
274 RETURN_IF_ERR();
275 return NUMBER_FromLong(flags);
276 }
277+
278+#if (DBVER >= 43)
279+static PyObject*
280+DB_get_transactional(DBObject* self)
281+{
282+ int err;
283+
284+ CHECK_DB_NOT_CLOSED(self);
285+
286+ MYDB_BEGIN_ALLOW_THREADS;
287+ err = self->db->get_transactional(self->db);
288+ MYDB_END_ALLOW_THREADS;
289+
290+ if(err == 0) {
291+ Py_INCREF(Py_False);
292+ return Py_False;
293+ } else if(err == 1) {
294+ Py_INCREF(Py_True);
295+ return Py_True;
296+ }
297+
298+ /*
299+ ** If we reach there, there was an error. The
300+ ** "return" should be unreachable.
301+ */
302+ RETURN_IF_ERR();
303+ assert(0); /* This coude SHOULD be unreachable */
304+ return NULL;
305+}
306 #endif
307
308 static PyObject*
309@@ -2830,7 +2881,6 @@ DB_set_h_ffactor(DBObject* self, PyObject* args)
310 RETURN_NONE();
311 }
312
313-#if (DBVER >= 42)
314 static PyObject*
315 DB_get_h_ffactor(DBObject* self)
316 {
317@@ -2845,7 +2895,6 @@ DB_get_h_ffactor(DBObject* self)
318 RETURN_IF_ERR();
319 return NUMBER_FromLong(ffactor);
320 }
321-#endif
322
323 static PyObject*
324 DB_set_h_nelem(DBObject* self, PyObject* args)
325@@ -2863,7 +2912,6 @@ DB_set_h_nelem(DBObject* self, PyObject* args)
326 RETURN_NONE();
327 }
328
329-#if (DBVER >= 42)
330 static PyObject*
331 DB_get_h_nelem(DBObject* self)
332 {
333@@ -2878,7 +2926,6 @@ DB_get_h_nelem(DBObject* self)
334 RETURN_IF_ERR();
335 return NUMBER_FromLong(nelem);
336 }
337-#endif
338
339 static PyObject*
340 DB_set_lorder(DBObject* self, PyObject* args)
341@@ -2896,7 +2943,6 @@ DB_set_lorder(DBObject* self, PyObject* args)
342 RETURN_NONE();
343 }
344
345-#if (DBVER >= 42)
346 static PyObject*
347 DB_get_lorder(DBObject* self)
348 {
349@@ -2911,7 +2957,6 @@ DB_get_lorder(DBObject* self)
350 RETURN_IF_ERR();
351 return NUMBER_FromLong(lorder);
352 }
353-#endif
354
355 static PyObject*
356 DB_set_pagesize(DBObject* self, PyObject* args)
357@@ -2929,7 +2974,6 @@ DB_set_pagesize(DBObject* self, PyObject* args)
358 RETURN_NONE();
359 }
360
361-#if (DBVER >= 42)
362 static PyObject*
363 DB_get_pagesize(DBObject* self)
364 {
365@@ -2944,7 +2988,6 @@ DB_get_pagesize(DBObject* self)
366 RETURN_IF_ERR();
367 return NUMBER_FromLong(pagesize);
368 }
369-#endif
370
371 static PyObject*
372 DB_set_re_delim(DBObject* self, PyObject* args)
373@@ -2967,7 +3010,6 @@ DB_set_re_delim(DBObject* self, PyObject* args)
374 RETURN_NONE();
375 }
376
377-#if (DBVER >= 42)
378 static PyObject*
379 DB_get_re_delim(DBObject* self)
380 {
381@@ -2981,7 +3023,6 @@ DB_get_re_delim(DBObject* self)
382 RETURN_IF_ERR();
383 return NUMBER_FromLong(re_delim);
384 }
385-#endif
386
387 static PyObject*
388 DB_set_re_len(DBObject* self, PyObject* args)
389@@ -2999,7 +3040,6 @@ DB_set_re_len(DBObject* self, PyObject* args)
390 RETURN_NONE();
391 }
392
393-#if (DBVER >= 42)
394 static PyObject*
395 DB_get_re_len(DBObject* self)
396 {
397@@ -3014,7 +3054,6 @@ DB_get_re_len(DBObject* self)
398 RETURN_IF_ERR();
399 return NUMBER_FromLong(re_len);
400 }
401-#endif
402
403 static PyObject*
404 DB_set_re_pad(DBObject* self, PyObject* args)
405@@ -3036,7 +3075,6 @@ DB_set_re_pad(DBObject* self, PyObject* args)
406 RETURN_NONE();
407 }
408
409-#if (DBVER >= 42)
410 static PyObject*
411 DB_get_re_pad(DBObject* self)
412 {
413@@ -3050,7 +3088,6 @@ DB_get_re_pad(DBObject* self)
414 RETURN_IF_ERR();
415 return NUMBER_FromLong(re_pad);
416 }
417-#endif
418
419 static PyObject*
420 DB_set_re_source(DBObject* self, PyObject* args)
421@@ -3069,7 +3106,6 @@ DB_set_re_source(DBObject* self, PyObject* args)
422 RETURN_NONE();
423 }
424
425-#if (DBVER >= 42)
426 static PyObject*
427 DB_get_re_source(DBObject* self)
428 {
429@@ -3084,7 +3120,6 @@ DB_get_re_source(DBObject* self)
430 RETURN_IF_ERR();
431 return PyBytes_FromString(source);
432 }
433-#endif
434
435 static PyObject*
436 DB_stat(DBObject* self, PyObject* args, PyObject* kwargs)
437@@ -3381,7 +3416,6 @@ DB_set_encrypt(DBObject* self, PyObject* args, PyObject* kwargs)
438 RETURN_NONE();
439 }
440
441-#if (DBVER >= 42)
442 static PyObject*
443 DB_get_encrypt_flags(DBObject* self)
444 {
445@@ -3396,7 +3430,6 @@ DB_get_encrypt_flags(DBObject* self)
446
447 return NUMBER_FromLong(flags);
448 }
449-#endif
450
451
452
453@@ -4987,7 +5020,6 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs)
454 RETURN_NONE();
455 }
456
457-#if (DBVER >= 42)
458 static PyObject*
459 DBEnv_get_encrypt_flags(DBEnvObject* self)
460 {
461@@ -5025,7 +5057,6 @@ DBEnv_get_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs)
462 RETURN_IF_ERR();
463 return NUMBER_FromLong(timeout);
464 }
465-#endif
466
467
468 static PyObject*
469@@ -5064,7 +5095,6 @@ DBEnv_set_shm_key(DBEnvObject* self, PyObject* args)
470 RETURN_NONE();
471 }
472
473-#if (DBVER >= 42)
474 static PyObject*
475 DBEnv_get_shm_key(DBEnvObject* self)
476 {
477@@ -5081,7 +5111,6 @@ DBEnv_get_shm_key(DBEnvObject* self)
478
479 return NUMBER_FromLong(shm_key);
480 }
481-#endif
482
483 #if (DBVER >= 46)
484 static PyObject*
485@@ -5170,7 +5199,6 @@ DBEnv_set_cachesize(DBEnvObject* self, PyObject* args)
486 RETURN_NONE();
487 }
488
489-#if (DBVER >= 42)
490 static PyObject*
491 DBEnv_get_cachesize(DBEnvObject* self)
492 {
493@@ -5188,7 +5216,6 @@ DBEnv_get_cachesize(DBEnvObject* self)
494
495 return Py_BuildValue("(iii)", gbytes, bytes, ncache);
496 }
497-#endif
498
499
500 static PyObject*
501@@ -5208,7 +5235,6 @@ DBEnv_set_flags(DBEnvObject* self, PyObject* args)
502 RETURN_NONE();
503 }
504
505-#if (DBVER >= 42)
506 static PyObject*
507 DBEnv_get_flags(DBEnvObject* self)
508 {
509@@ -5223,7 +5249,6 @@ DBEnv_get_flags(DBEnvObject* self)
510 RETURN_IF_ERR();
511 return NUMBER_FromLong(flags);
512 }
513-#endif
514
515 #if (DBVER >= 47)
516 static PyObject*
517@@ -5423,7 +5448,6 @@ DBEnv_set_data_dir(DBEnvObject* self, PyObject* args)
518 RETURN_NONE();
519 }
520
521-#if (DBVER >= 42)
522 static PyObject*
523 DBEnv_get_data_dirs(DBEnvObject* self)
524 {
525@@ -5463,7 +5487,6 @@ DBEnv_get_data_dirs(DBEnvObject* self)
526 }
527 return tuple;
528 }
529-#endif
530
531 #if (DBVER >= 44)
532 static PyObject*
533@@ -5513,7 +5536,6 @@ DBEnv_set_lg_bsize(DBEnvObject* self, PyObject* args)
534 RETURN_NONE();
535 }
536
537-#if (DBVER >= 42)
538 static PyObject*
539 DBEnv_get_lg_bsize(DBEnvObject* self)
540 {
541@@ -5528,7 +5550,6 @@ DBEnv_get_lg_bsize(DBEnvObject* self)
542 RETURN_IF_ERR();
543 return NUMBER_FromLong(lg_bsize);
544 }
545-#endif
546
547 static PyObject*
548 DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args)
549@@ -5547,7 +5568,6 @@ DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args)
550 RETURN_NONE();
551 }
552
553-#if (DBVER >= 42)
554 static PyObject*
555 DBEnv_get_lg_dir(DBEnvObject* self)
556 {
557@@ -5562,7 +5582,6 @@ DBEnv_get_lg_dir(DBEnvObject* self)
558 RETURN_IF_ERR();
559 return PyBytes_FromString(dirp);
560 }
561-#endif
562
563 static PyObject*
564 DBEnv_set_lg_max(DBEnvObject* self, PyObject* args)
565@@ -5580,7 +5599,6 @@ DBEnv_set_lg_max(DBEnvObject* self, PyObject* args)
566 RETURN_NONE();
567 }
568
569-#if (DBVER >= 42)
570 static PyObject*
571 DBEnv_get_lg_max(DBEnvObject* self)
572 {
573@@ -5595,8 +5613,6 @@ DBEnv_get_lg_max(DBEnvObject* self)
574 RETURN_IF_ERR();
575 return NUMBER_FromLong(lg_max);
576 }
577-#endif
578-
579
580 static PyObject*
581 DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args)
582@@ -5614,7 +5630,6 @@ DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args)
583 RETURN_NONE();
584 }
585
586-#if (DBVER >= 42)
587 static PyObject*
588 DBEnv_get_lg_regionmax(DBEnvObject* self)
589 {
590@@ -5629,7 +5644,6 @@ DBEnv_get_lg_regionmax(DBEnvObject* self)
591 RETURN_IF_ERR();
592 return NUMBER_FromLong(lg_regionmax);
593 }
594-#endif
595
596 #if (DBVER >= 47)
597 static PyObject*
598@@ -5680,7 +5694,6 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args)
599 RETURN_NONE();
600 }
601
602-#if (DBVER >= 42)
603 static PyObject*
604 DBEnv_get_lk_detect(DBEnvObject* self)
605 {
606@@ -5695,8 +5708,6 @@ DBEnv_get_lk_detect(DBEnvObject* self)
607 RETURN_IF_ERR();
608 return NUMBER_FromLong(lk_detect);
609 }
610-#endif
611-
612
613 #if (DBVER < 45)
614 static PyObject*
615@@ -5734,7 +5745,6 @@ DBEnv_set_lk_max_locks(DBEnvObject* self, PyObject* args)
616 RETURN_NONE();
617 }
618
619-#if (DBVER >= 42)
620 static PyObject*
621 DBEnv_get_lk_max_locks(DBEnvObject* self)
622 {
623@@ -5749,7 +5759,6 @@ DBEnv_get_lk_max_locks(DBEnvObject* self)
624 RETURN_IF_ERR();
625 return NUMBER_FromLong(lk_max);
626 }
627-#endif
628
629 static PyObject*
630 DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args)
631@@ -5767,7 +5776,6 @@ DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args)
632 RETURN_NONE();
633 }
634
635-#if (DBVER >= 42)
636 static PyObject*
637 DBEnv_get_lk_max_lockers(DBEnvObject* self)
638 {
639@@ -5782,7 +5790,6 @@ DBEnv_get_lk_max_lockers(DBEnvObject* self)
640 RETURN_IF_ERR();
641 return NUMBER_FromLong(lk_max);
642 }
643-#endif
644
645 static PyObject*
646 DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args)
647@@ -5800,7 +5807,6 @@ DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args)
648 RETURN_NONE();
649 }
650
651-#if (DBVER >= 42)
652 static PyObject*
653 DBEnv_get_lk_max_objects(DBEnvObject* self)
654 {
655@@ -5815,9 +5821,7 @@ DBEnv_get_lk_max_objects(DBEnvObject* self)
656 RETURN_IF_ERR();
657 return NUMBER_FromLong(lk_max);
658 }
659-#endif
660
661-#if (DBVER >= 42)
662 static PyObject*
663 DBEnv_get_mp_mmapsize(DBEnvObject* self)
664 {
665@@ -5832,8 +5836,6 @@ DBEnv_get_mp_mmapsize(DBEnvObject* self)
666 RETURN_IF_ERR();
667 return NUMBER_FromLong(mmapsize);
668 }
669-#endif
670-
671
672 static PyObject*
673 DBEnv_set_mp_mmapsize(DBEnvObject* self, PyObject* args)
674@@ -5869,8 +5871,6 @@ DBEnv_set_tmp_dir(DBEnvObject* self, PyObject* args)
675 RETURN_NONE();
676 }
677
678-
679-#if (DBVER >= 42)
680 static PyObject*
681 DBEnv_get_tmp_dir(DBEnvObject* self)
682 {
683@@ -5887,8 +5887,6 @@ DBEnv_get_tmp_dir(DBEnvObject* self)
684
685 return PyBytes_FromString(dirpp);
686 }
687-#endif
688-
689
690 static PyObject*
691 DBEnv_txn_recover(DBEnvObject* self)
692@@ -5899,7 +5897,7 @@ DBEnv_txn_recover(DBEnvObject* self)
693 DBTxnObject *txn;
694 #define PREPLIST_LEN 16
695 DB_PREPLIST preplist[PREPLIST_LEN];
696-#if (DBVER < 48)
697+#if (DBVER < 48 || DBVER > 51)
698 long retp;
699 #else
700 u_int32_t retp;
701@@ -6003,8 +6001,6 @@ DBEnv_txn_checkpoint(DBEnvObject* self, PyObject* args)
702 RETURN_NONE();
703 }
704
705-
706-#if (DBVER >= 42)
707 static PyObject*
708 DBEnv_get_tx_max(DBEnvObject* self)
709 {
710@@ -6019,8 +6015,6 @@ DBEnv_get_tx_max(DBEnvObject* self)
711 RETURN_IF_ERR();
712 return PyLong_FromUnsignedLong(max);
713 }
714-#endif
715-
716
717 static PyObject*
718 DBEnv_set_tx_max(DBEnvObject* self, PyObject* args)
719@@ -6038,8 +6032,6 @@ DBEnv_set_tx_max(DBEnvObject* self, PyObject* args)
720 RETURN_NONE();
721 }
722
723-
724-#if (DBVER >= 42)
725 static PyObject*
726 DBEnv_get_tx_timestamp(DBEnvObject* self)
727 {
728@@ -6054,7 +6046,6 @@ DBEnv_get_tx_timestamp(DBEnvObject* self)
729 RETURN_IF_ERR();
730 return NUMBER_FromLong(timestamp);
731 }
732-#endif
733
734 static PyObject*
735 DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args)
736@@ -6756,6 +6747,55 @@ DBEnv_set_private(DBEnvObject* self, PyObject* private_obj)
737 RETURN_NONE();
738 }
739
740+#if (DBVER >= 47)
741+static PyObject*
742+DBEnv_set_intermediate_dir_mode(DBEnvObject* self, PyObject* args)
743+{
744+ int err;
745+ const char *mode;
746+
747+ if (!PyArg_ParseTuple(args,"s:set_intermediate_dir_mode", &mode))
748+ return NULL;
749+
750+ CHECK_ENV_NOT_CLOSED(self);
751+
752+ MYDB_BEGIN_ALLOW_THREADS;
753+ err = self->db_env->set_intermediate_dir_mode(self->db_env, mode);
754+ MYDB_END_ALLOW_THREADS;
755+ RETURN_IF_ERR();
756+ RETURN_NONE();
757+}
758+
759+static PyObject*
760+DBEnv_get_intermediate_dir_mode(DBEnvObject* self)
761+{
762+ int err;
763+ const char *mode;
764+
765+ CHECK_ENV_NOT_CLOSED(self);
766+
767+ MYDB_BEGIN_ALLOW_THREADS;
768+ err = self->db_env->get_intermediate_dir_mode(self->db_env, &mode);
769+ MYDB_END_ALLOW_THREADS;
770+ RETURN_IF_ERR();
771+ return Py_BuildValue("s", mode);
772+}
773+#endif
774+
775+static PyObject*
776+DBEnv_get_open_flags(DBEnvObject* self)
777+{
778+ int err;
779+ unsigned int flags;
780+
781+ CHECK_ENV_NOT_CLOSED(self);
782+
783+ MYDB_BEGIN_ALLOW_THREADS;
784+ err = self->db_env->get_open_flags(self->db_env, &flags);
785+ MYDB_END_ALLOW_THREADS;
786+ RETURN_IF_ERR();
787+ return NUMBER_FromLong(flags);
788+}
789
790 #if (DBVER < 48)
791 static PyObject*
792@@ -6875,7 +6915,6 @@ DBEnv_set_verbose(DBEnvObject* self, PyObject* args)
793 RETURN_NONE();
794 }
795
796-#if (DBVER >= 42)
797 static PyObject*
798 DBEnv_get_verbose(DBEnvObject* self, PyObject* args)
799 {
800@@ -6893,7 +6932,6 @@ DBEnv_get_verbose(DBEnvObject* self, PyObject* args)
801 RETURN_IF_ERR();
802 return PyBool_FromLong(verbose);
803 }
804-#endif
805
806 #if (DBVER >= 45)
807 static void
808@@ -6975,9 +7013,7 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args)
809 PyObject *control_py, *rec_py;
810 DBT control, rec;
811 int envid;
812-#if (DBVER >= 42)
813 DB_LSN lsn;
814-#endif
815
816 if (!PyArg_ParseTuple(args, "OOi:rep_process_message", &control_py,
817 &rec_py, &envid))
818@@ -6994,13 +7030,8 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args)
819 err = self->db_env->rep_process_message(self->db_env, &control, &rec,
820 envid, &lsn);
821 #else
822-#if (DBVER >= 42)
823 err = self->db_env->rep_process_message(self->db_env, &control, &rec,
824 &envid, &lsn);
825-#else
826- err = self->db_env->rep_process_message(self->db_env, &control, &rec,
827- &envid);
828-#endif
829 #endif
830 MYDB_END_ALLOW_THREADS;
831 switch (err) {
832@@ -7029,12 +7060,10 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args)
833 return r;
834 break;
835 }
836-#if (DBVER >= 42)
837 case DB_REP_NOTPERM :
838 case DB_REP_ISPERM :
839 return Py_BuildValue("(i(ll))", err, lsn.file, lsn.offset);
840 break;
841-#endif
842 }
843 RETURN_IF_ERR();
844 return Py_BuildValue("(OO)", Py_None, Py_None);
845@@ -7086,20 +7115,6 @@ _DBEnv_rep_transportCallback(DB_ENV* db_env, const DBT* control, const DBT* rec,
846 return ret;
847 }
848
849-#if (DBVER <= 41)
850-static int
851-_DBEnv_rep_transportCallbackOLD(DB_ENV* db_env, const DBT* control, const DBT* rec,
852- int envid, u_int32_t flags)
853-{
854- DB_LSN lsn;
855-
856- lsn.file = -1; /* Dummy values */
857- lsn.offset = -1;
858- return _DBEnv_rep_transportCallback(db_env, control, rec, &lsn, envid,
859- flags);
860-}
861-#endif
862-
863 static PyObject*
864 DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args)
865 {
866@@ -7120,13 +7135,8 @@ DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args)
867 err = self->db_env->rep_set_transport(self->db_env, envid,
868 &_DBEnv_rep_transportCallback);
869 #else
870-#if (DBVER >= 42)
871 err = self->db_env->set_rep_transport(self->db_env, envid,
872 &_DBEnv_rep_transportCallback);
873-#else
874- err = self->db_env->set_rep_transport(self->db_env, envid,
875- &_DBEnv_rep_transportCallbackOLD);
876-#endif
877 #endif
878 MYDB_END_ALLOW_THREADS;
879 RETURN_IF_ERR();
880@@ -7608,6 +7618,7 @@ DBEnv_repmgr_start(DBEnvObject* self, PyObject* args, PyObject*
881 RETURN_NONE();
882 }
883
884+#if (DBVER < 52)
885 static PyObject*
886 DBEnv_repmgr_set_local_site(DBEnvObject* self, PyObject* args, PyObject*
887 kwargs)
888@@ -7654,6 +7665,7 @@ DBEnv_repmgr_add_remote_site(DBEnvObject* self, PyObject* args, PyObject*
889 RETURN_IF_ERR();
890 return NUMBER_FromLong(eidp);
891 }
892+#endif
893
894 static PyObject*
895 DBEnv_repmgr_set_ack_policy(DBEnvObject* self, PyObject* args)
896@@ -8482,65 +8494,43 @@ static PyMethodDef DB_methods[] = {
897 {"remove", (PyCFunction)DB_remove, METH_VARARGS|METH_KEYWORDS},
898 {"rename", (PyCFunction)DB_rename, METH_VARARGS},
899 {"set_bt_minkey", (PyCFunction)DB_set_bt_minkey, METH_VARARGS},
900-#if (DBVER >= 42)
901 {"get_bt_minkey", (PyCFunction)DB_get_bt_minkey, METH_NOARGS},
902-#endif
903 {"set_bt_compare", (PyCFunction)DB_set_bt_compare, METH_O},
904 {"set_cachesize", (PyCFunction)DB_set_cachesize, METH_VARARGS},
905-#if (DBVER >= 42)
906 {"get_cachesize", (PyCFunction)DB_get_cachesize, METH_NOARGS},
907-#endif
908 {"set_encrypt", (PyCFunction)DB_set_encrypt, METH_VARARGS|METH_KEYWORDS},
909-#if (DBVER >= 42)
910 {"get_encrypt_flags", (PyCFunction)DB_get_encrypt_flags, METH_NOARGS},
911-#endif
912-
913 {"set_flags", (PyCFunction)DB_set_flags, METH_VARARGS},
914-#if (DBVER >= 42)
915 {"get_flags", (PyCFunction)DB_get_flags, METH_NOARGS},
916+#if (DBVER >= 43)
917+ {"get_transactional", (PyCFunction)DB_get_transactional, METH_NOARGS},
918 #endif
919 {"set_h_ffactor", (PyCFunction)DB_set_h_ffactor, METH_VARARGS},
920-#if (DBVER >= 42)
921 {"get_h_ffactor", (PyCFunction)DB_get_h_ffactor, METH_NOARGS},
922-#endif
923 {"set_h_nelem", (PyCFunction)DB_set_h_nelem, METH_VARARGS},
924-#if (DBVER >= 42)
925 {"get_h_nelem", (PyCFunction)DB_get_h_nelem, METH_NOARGS},
926-#endif
927 {"set_lorder", (PyCFunction)DB_set_lorder, METH_VARARGS},
928-#if (DBVER >= 42)
929 {"get_lorder", (PyCFunction)DB_get_lorder, METH_NOARGS},
930-#endif
931 {"set_pagesize", (PyCFunction)DB_set_pagesize, METH_VARARGS},
932-#if (DBVER >= 42)
933 {"get_pagesize", (PyCFunction)DB_get_pagesize, METH_NOARGS},
934-#endif
935 {"set_re_delim", (PyCFunction)DB_set_re_delim, METH_VARARGS},
936-#if (DBVER >= 42)
937 {"get_re_delim", (PyCFunction)DB_get_re_delim, METH_NOARGS},
938-#endif
939 {"set_re_len", (PyCFunction)DB_set_re_len, METH_VARARGS},
940-#if (DBVER >= 42)
941 {"get_re_len", (PyCFunction)DB_get_re_len, METH_NOARGS},
942-#endif
943 {"set_re_pad", (PyCFunction)DB_set_re_pad, METH_VARARGS},
944-#if (DBVER >= 42)
945 {"get_re_pad", (PyCFunction)DB_get_re_pad, METH_NOARGS},
946-#endif
947 {"set_re_source", (PyCFunction)DB_set_re_source, METH_VARARGS},
948-#if (DBVER >= 42)
949 {"get_re_source", (PyCFunction)DB_get_re_source, METH_NOARGS},
950-#endif
951 {"set_q_extentsize",(PyCFunction)DB_set_q_extentsize, METH_VARARGS},
952-#if (DBVER >= 42)
953 {"get_q_extentsize",(PyCFunction)DB_get_q_extentsize, METH_NOARGS},
954-#endif
955 {"set_private", (PyCFunction)DB_set_private, METH_O},
956 {"get_private", (PyCFunction)DB_get_private, METH_NOARGS},
957 #if (DBVER >= 46)
958 {"set_priority", (PyCFunction)DB_set_priority, METH_VARARGS},
959 {"get_priority", (PyCFunction)DB_get_priority, METH_NOARGS},
960 #endif
961+ {"get_dbname", (PyCFunction)DB_get_dbname, METH_NOARGS},
962+ {"get_open_flags", (PyCFunction)DB_get_open_flags, METH_NOARGS},
963 {"stat", (PyCFunction)DB_stat, METH_VARARGS|METH_KEYWORDS},
964 #if (DBVER >= 43)
965 {"stat_print", (PyCFunction)DB_stat_print,
966@@ -8639,24 +8629,18 @@ static PyMethodDef DBEnv_methods[] = {
967 {"get_thread_count", (PyCFunction)DBEnv_get_thread_count, METH_NOARGS},
968 #endif
969 {"set_encrypt", (PyCFunction)DBEnv_set_encrypt, METH_VARARGS|METH_KEYWORDS},
970-#if (DBVER >= 42)
971 {"get_encrypt_flags", (PyCFunction)DBEnv_get_encrypt_flags, METH_NOARGS},
972 {"get_timeout", (PyCFunction)DBEnv_get_timeout,
973 METH_VARARGS|METH_KEYWORDS},
974-#endif
975 {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS},
976 {"set_shm_key", (PyCFunction)DBEnv_set_shm_key, METH_VARARGS},
977-#if (DBVER >= 42)
978 {"get_shm_key", (PyCFunction)DBEnv_get_shm_key, METH_NOARGS},
979-#endif
980 #if (DBVER >= 46)
981 {"set_cache_max", (PyCFunction)DBEnv_set_cache_max, METH_VARARGS},
982 {"get_cache_max", (PyCFunction)DBEnv_get_cache_max, METH_NOARGS},
983 #endif
984 {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS},
985-#if (DBVER >= 42)
986 {"get_cachesize", (PyCFunction)DBEnv_get_cachesize, METH_NOARGS},
987-#endif
988 {"memp_trickle", (PyCFunction)DBEnv_memp_trickle, METH_VARARGS},
989 {"memp_sync", (PyCFunction)DBEnv_memp_sync, METH_VARARGS},
990 {"memp_stat", (PyCFunction)DBEnv_memp_stat,
991@@ -8685,33 +8669,21 @@ static PyMethodDef DBEnv_methods[] = {
992 #endif
993 #endif
994 {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS},
995-#if (DBVER >= 42)
996 {"get_data_dirs", (PyCFunction)DBEnv_get_data_dirs, METH_NOARGS},
997-#endif
998-#if (DBVER >= 42)
999 {"get_flags", (PyCFunction)DBEnv_get_flags, METH_NOARGS},
1000-#endif
1001 {"set_flags", (PyCFunction)DBEnv_set_flags, METH_VARARGS},
1002 #if (DBVER >= 47)
1003 {"log_set_config", (PyCFunction)DBEnv_log_set_config, METH_VARARGS},
1004 {"log_get_config", (PyCFunction)DBEnv_log_get_config, METH_VARARGS},
1005 #endif
1006 {"set_lg_bsize", (PyCFunction)DBEnv_set_lg_bsize, METH_VARARGS},
1007-#if (DBVER >= 42)
1008 {"get_lg_bsize", (PyCFunction)DBEnv_get_lg_bsize, METH_NOARGS},
1009-#endif
1010 {"set_lg_dir", (PyCFunction)DBEnv_set_lg_dir, METH_VARARGS},
1011-#if (DBVER >= 42)
1012 {"get_lg_dir", (PyCFunction)DBEnv_get_lg_dir, METH_NOARGS},
1013-#endif
1014 {"set_lg_max", (PyCFunction)DBEnv_set_lg_max, METH_VARARGS},
1015-#if (DBVER >= 42)
1016 {"get_lg_max", (PyCFunction)DBEnv_get_lg_max, METH_NOARGS},
1017-#endif
1018 {"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS},
1019-#if (DBVER >= 42)
1020 {"get_lg_regionmax",(PyCFunction)DBEnv_get_lg_regionmax, METH_NOARGS},
1021-#endif
1022 #if (DBVER >= 44)
1023 {"set_lg_filemode", (PyCFunction)DBEnv_set_lg_filemode, METH_VARARGS},
1024 {"get_lg_filemode", (PyCFunction)DBEnv_get_lg_filemode, METH_NOARGS},
1025@@ -8721,36 +8693,24 @@ static PyMethodDef DBEnv_methods[] = {
1026 {"get_lk_partitions", (PyCFunction)DBEnv_get_lk_partitions, METH_NOARGS},
1027 #endif
1028 {"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS},
1029-#if (DBVER >= 42)
1030 {"get_lk_detect", (PyCFunction)DBEnv_get_lk_detect, METH_NOARGS},
1031-#endif
1032 #if (DBVER < 45)
1033 {"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS},
1034 #endif
1035 {"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS},
1036-#if (DBVER >= 42)
1037 {"get_lk_max_locks", (PyCFunction)DBEnv_get_lk_max_locks, METH_NOARGS},
1038-#endif
1039 {"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS},
1040-#if (DBVER >= 42)
1041 {"get_lk_max_lockers", (PyCFunction)DBEnv_get_lk_max_lockers, METH_NOARGS},
1042-#endif
1043 {"set_lk_max_objects", (PyCFunction)DBEnv_set_lk_max_objects, METH_VARARGS},
1044-#if (DBVER >= 42)
1045 {"get_lk_max_objects", (PyCFunction)DBEnv_get_lk_max_objects, METH_NOARGS},
1046-#endif
1047 #if (DBVER >= 43)
1048 {"stat_print", (PyCFunction)DBEnv_stat_print,
1049 METH_VARARGS|METH_KEYWORDS},
1050 #endif
1051 {"set_mp_mmapsize", (PyCFunction)DBEnv_set_mp_mmapsize, METH_VARARGS},
1052-#if (DBVER >= 42)
1053 {"get_mp_mmapsize", (PyCFunction)DBEnv_get_mp_mmapsize, METH_NOARGS},
1054-#endif
1055 {"set_tmp_dir", (PyCFunction)DBEnv_set_tmp_dir, METH_VARARGS},
1056-#if (DBVER >= 42)
1057 {"get_tmp_dir", (PyCFunction)DBEnv_get_tmp_dir, METH_NOARGS},
1058-#endif
1059 {"txn_begin", (PyCFunction)DBEnv_txn_begin, METH_VARARGS|METH_KEYWORDS},
1060 {"txn_checkpoint", (PyCFunction)DBEnv_txn_checkpoint, METH_VARARGS},
1061 {"txn_stat", (PyCFunction)DBEnv_txn_stat, METH_VARARGS},
1062@@ -8758,10 +8718,8 @@ static PyMethodDef DBEnv_methods[] = {
1063 {"txn_stat_print", (PyCFunction)DBEnv_txn_stat_print,
1064 METH_VARARGS|METH_KEYWORDS},
1065 #endif
1066-#if (DBVER >= 42)
1067 {"get_tx_max", (PyCFunction)DBEnv_get_tx_max, METH_NOARGS},
1068 {"get_tx_timestamp", (PyCFunction)DBEnv_get_tx_timestamp, METH_NOARGS},
1069-#endif
1070 {"set_tx_max", (PyCFunction)DBEnv_set_tx_max, METH_VARARGS},
1071 {"set_tx_timestamp", (PyCFunction)DBEnv_set_tx_timestamp, METH_VARARGS},
1072 {"lock_detect", (PyCFunction)DBEnv_lock_detect, METH_VARARGS},
1073@@ -8804,11 +8762,16 @@ static PyMethodDef DBEnv_methods[] = {
1074 {"get_mp_max_write", (PyCFunction)DBEnv_get_mp_max_write, METH_NOARGS},
1075 #endif
1076 {"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS},
1077-#if (DBVER >= 42)
1078- {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS},
1079+ {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS},
1080+ {"set_private", (PyCFunction)DBEnv_set_private, METH_O},
1081+ {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS},
1082+ {"get_open_flags", (PyCFunction)DBEnv_get_open_flags, METH_NOARGS},
1083+#if (DBVER >= 47)
1084+ {"set_intermediate_dir_mode", (PyCFunction)DBEnv_set_intermediate_dir_mode,
1085+ METH_VARARGS},
1086+ {"get_intermediate_dir_mode", (PyCFunction)DBEnv_get_intermediate_dir_mode,
1087+ METH_NOARGS},
1088 #endif
1089- {"set_private", (PyCFunction)DBEnv_set_private, METH_O},
1090- {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS},
1091 {"rep_start", (PyCFunction)DBEnv_rep_start,
1092 METH_VARARGS|METH_KEYWORDS},
1093 {"rep_set_transport", (PyCFunction)DBEnv_rep_set_transport, METH_VARARGS},
1094@@ -8855,10 +8818,12 @@ static PyMethodDef DBEnv_methods[] = {
1095 #if (DBVER >= 45)
1096 {"repmgr_start", (PyCFunction)DBEnv_repmgr_start,
1097 METH_VARARGS|METH_KEYWORDS},
1098+#if (DBVER < 52)
1099 {"repmgr_set_local_site", (PyCFunction)DBEnv_repmgr_set_local_site,
1100 METH_VARARGS|METH_KEYWORDS},
1101 {"repmgr_add_remote_site", (PyCFunction)DBEnv_repmgr_add_remote_site,
1102 METH_VARARGS|METH_KEYWORDS},
1103+#endif
1104 {"repmgr_set_ack_policy", (PyCFunction)DBEnv_repmgr_set_ack_policy,
1105 METH_VARARGS},
1106 {"repmgr_get_ack_policy", (PyCFunction)DBEnv_repmgr_get_ack_policy,
1107@@ -8922,13 +8887,9 @@ DBEnv_db_home_get(DBEnvObject* self)
1108
1109 CHECK_ENV_NOT_CLOSED(self);
1110
1111-#if (DBVER >= 42)
1112 MYDB_BEGIN_ALLOW_THREADS;
1113 self->db_env->get_home(self->db_env, &home);
1114 MYDB_END_ALLOW_THREADS;
1115-#else
1116- home=self->db_env->db_home;
1117-#endif
1118
1119 if (home == NULL) {
1120 RETURN_NONE();
1121@@ -9298,10 +9259,25 @@ bsddb_version(PyObject* self)
1122 {
1123 int major, minor, patch;
1124
1125+ /* This should be instantaneous, no need to release the GIL */
1126 db_version(&major, &minor, &patch);
1127 return Py_BuildValue("(iii)", major, minor, patch);
1128 }
1129
1130+#if (DBVER >= 50)
1131+static PyObject*
1132+bsddb_version_full(PyObject* self)
1133+{
1134+ char *version_string;
1135+ int family, release, major, minor, patch;
1136+
1137+ /* This should be instantaneous, no need to release the GIL */
1138+ version_string = db_full_version(&family, &release, &major, &minor, &patch);
1139+ return Py_BuildValue("(siiiii)",
1140+ version_string, family, release, major, minor, patch);
1141+}
1142+#endif
1143+
1144
1145 /* List of functions defined in the module */
1146 static PyMethodDef bsddb_methods[] = {
1147@@ -9311,6 +9287,9 @@ static PyMethodDef bsddb_methods[] = {
1148 {"DBSequence", (PyCFunction)DBSequence_construct, METH_VARARGS | METH_KEYWORDS },
1149 #endif
1150 {"version", (PyCFunction)bsddb_version, METH_NOARGS, bsddb_version_doc},
1151+#if (DBVER >= 50)
1152+ {"full_version", (PyCFunction)bsddb_version_full, METH_NOARGS},
1153+#endif
1154 {NULL, NULL} /* sentinel */
1155 };
1156
1157@@ -9328,6 +9307,11 @@ static BSDDB_api bsddb_api;
1158 */
1159 #define ADD_INT(dict, NAME) _addIntToDict(dict, #NAME, NAME)
1160
1161+/*
1162+** We can rename the module at import time, so the string allocated
1163+** must be big enough, and any use of the name must use this particular
1164+** string.
1165+*/
1166 #define MODULE_NAME_MAX_LEN 11
1167 static char _bsddbModuleName[MODULE_NAME_MAX_LEN+1] = "_bsddb";
1168
1169@@ -9428,16 +9412,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1170 ADD_INT(d, DB_MAX_RECORDS);
1171
1172 #if (DBVER < 48)
1173-#if (DBVER >= 42)
1174 ADD_INT(d, DB_RPCCLIENT);
1175-#else
1176- ADD_INT(d, DB_CLIENT);
1177- /* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */
1178- _addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT);
1179-#endif
1180 #endif
1181
1182-#if (DBVER < 48)
1183+#if (DBVER < 48 || DBVER > 51)
1184 ADD_INT(d, DB_XA_CREATE);
1185 #endif
1186
1187@@ -9477,6 +9455,14 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1188 ADD_INT(d, DB_TXN_SYNC);
1189 ADD_INT(d, DB_TXN_NOWAIT);
1190
1191+#if (DBVER >= 51)
1192+ ADD_INT(d, DB_TXN_BULK);
1193+#endif
1194+
1195+#if (DBVER >= 48)
1196+ ADD_INT(d, DB_CURSOR_BULK);
1197+#endif
1198+
1199 #if (DBVER >= 46)
1200 ADD_INT(d, DB_TXN_WAIT);
1201 #endif
1202@@ -9561,9 +9547,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1203 ADD_INT(d, DB_ARCH_ABS);
1204 ADD_INT(d, DB_ARCH_DATA);
1205 ADD_INT(d, DB_ARCH_LOG);
1206-#if (DBVER >= 42)
1207 ADD_INT(d, DB_ARCH_REMOVE);
1208-#endif
1209
1210 ADD_INT(d, DB_BTREE);
1211 ADD_INT(d, DB_HASH);
1212@@ -9591,9 +9575,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1213 ADD_INT(d, DB_CACHED_COUNTS);
1214 #endif
1215
1216-#if (DBVER <= 41)
1217- ADD_INT(d, DB_COMMIT);
1218-#endif
1219 ADD_INT(d, DB_CONSUME);
1220 ADD_INT(d, DB_CONSUME_WAIT);
1221 ADD_INT(d, DB_CURRENT);
1222@@ -9651,8 +9632,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1223 ADD_INT(d, DB_LOCK_DEADLOCK);
1224 ADD_INT(d, DB_LOCK_NOTGRANTED);
1225 ADD_INT(d, DB_NOSERVER);
1226+#if (DBVER < 52)
1227 ADD_INT(d, DB_NOSERVER_HOME);
1228 ADD_INT(d, DB_NOSERVER_ID);
1229+#endif
1230 ADD_INT(d, DB_NOTFOUND);
1231 ADD_INT(d, DB_OLD_VERSION);
1232 ADD_INT(d, DB_RUNRECOVERY);
1233@@ -9671,6 +9654,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1234 #if (DBVER >= 43)
1235 ADD_INT(d, DB_STAT_SUBSYSTEM);
1236 ADD_INT(d, DB_STAT_MEMP_HASH);
1237+ ADD_INT(d, DB_STAT_LOCK_CONF);
1238+ ADD_INT(d, DB_STAT_LOCK_LOCKERS);
1239+ ADD_INT(d, DB_STAT_LOCK_OBJECTS);
1240+ ADD_INT(d, DB_STAT_LOCK_PARAMS);
1241 #endif
1242
1243 #if (DBVER >= 48)
1244@@ -9690,7 +9677,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1245 ADD_INT(d, DB_EID_INVALID);
1246 ADD_INT(d, DB_EID_BROADCAST);
1247
1248-#if (DBVER >= 42)
1249 ADD_INT(d, DB_TIME_NOTGRANTED);
1250 ADD_INT(d, DB_TXN_NOT_DURABLE);
1251 ADD_INT(d, DB_TXN_WRITE_NOSYNC);
1252@@ -9698,9 +9684,8 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1253 ADD_INT(d, DB_INIT_REP);
1254 ADD_INT(d, DB_ENCRYPT);
1255 ADD_INT(d, DB_CHKSUM);
1256-#endif
1257
1258-#if (DBVER >= 42) && (DBVER < 47)
1259+#if (DBVER < 47)
1260 ADD_INT(d, DB_LOG_AUTOREMOVE);
1261 ADD_INT(d, DB_DIRECT_LOG);
1262 #endif
1263@@ -9733,6 +9718,20 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1264 ADD_INT(d, DB_VERB_REPLICATION);
1265 ADD_INT(d, DB_VERB_WAITSFOR);
1266
1267+#if (DBVER >= 50)
1268+ ADD_INT(d, DB_VERB_REP_SYSTEM);
1269+#endif
1270+
1271+#if (DBVER >= 47)
1272+ ADD_INT(d, DB_VERB_REP_ELECT);
1273+ ADD_INT(d, DB_VERB_REP_LEASE);
1274+ ADD_INT(d, DB_VERB_REP_MISC);
1275+ ADD_INT(d, DB_VERB_REP_MSGS);
1276+ ADD_INT(d, DB_VERB_REP_SYNC);
1277+ ADD_INT(d, DB_VERB_REPMGR_CONNFAIL);
1278+ ADD_INT(d, DB_VERB_REPMGR_MISC);
1279+#endif
1280+
1281 #if (DBVER >= 45)
1282 ADD_INT(d, DB_EVENT_PANIC);
1283 ADD_INT(d, DB_EVENT_REP_CLIENT);
1284@@ -9748,16 +9747,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1285 ADD_INT(d, DB_EVENT_WRITE_FAILED);
1286 #endif
1287
1288+#if (DBVER >= 50)
1289+ ADD_INT(d, DB_REPMGR_CONF_ELECTIONS);
1290+ ADD_INT(d, DB_EVENT_REP_MASTER_FAILURE);
1291+ ADD_INT(d, DB_EVENT_REP_DUPMASTER);
1292+ ADD_INT(d, DB_EVENT_REP_ELECTION_FAILED);
1293+#endif
1294+#if (DBVER >= 48)
1295+ ADD_INT(d, DB_EVENT_REG_ALIVE);
1296+ ADD_INT(d, DB_EVENT_REG_PANIC);
1297+#endif
1298+
1299 ADD_INT(d, DB_REP_DUPMASTER);
1300 ADD_INT(d, DB_REP_HOLDELECTION);
1301 #if (DBVER >= 44)
1302 ADD_INT(d, DB_REP_IGNORE);
1303 ADD_INT(d, DB_REP_JOIN_FAILURE);
1304 #endif
1305-#if (DBVER >= 42)
1306 ADD_INT(d, DB_REP_ISPERM);
1307 ADD_INT(d, DB_REP_NOTPERM);
1308-#endif
1309 ADD_INT(d, DB_REP_NEWSITE);
1310
1311 ADD_INT(d, DB_REP_MASTER);
1312@@ -9766,7 +9774,13 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1313 ADD_INT(d, DB_REP_PERMANENT);
1314
1315 #if (DBVER >= 44)
1316+#if (DBVER >= 50)
1317+ ADD_INT(d, DB_REP_CONF_AUTOINIT);
1318+#else
1319 ADD_INT(d, DB_REP_CONF_NOAUTOINIT);
1320+#endif /* 5.0 */
1321+#endif /* 4.4 */
1322+#if (DBVER >= 44)
1323 ADD_INT(d, DB_REP_CONF_DELAYCLIENT);
1324 ADD_INT(d, DB_REP_CONF_BULK);
1325 ADD_INT(d, DB_REP_CONF_NOWAIT);
1326@@ -9774,9 +9788,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1327 ADD_INT(d, DB_REP_REREQUEST);
1328 #endif
1329
1330-#if (DBVER >= 42)
1331 ADD_INT(d, DB_REP_NOBUFFER);
1332-#endif
1333
1334 #if (DBVER >= 46)
1335 ADD_INT(d, DB_REP_LEASE_EXPIRED);
1336@@ -9819,6 +9831,28 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1337 ADD_INT(d, DB_STAT_ALL);
1338 #endif
1339
1340+#if (DBVER >= 51)
1341+ ADD_INT(d, DB_REPMGR_ACKS_ALL_AVAILABLE);
1342+#endif
1343+
1344+#if (DBVER >= 48)
1345+ ADD_INT(d, DB_REP_CONF_INMEM);
1346+#endif
1347+
1348+ ADD_INT(d, DB_TIMEOUT);
1349+
1350+#if (DBVER >= 50)
1351+ ADD_INT(d, DB_FORCESYNC);
1352+#endif
1353+
1354+#if (DBVER >= 48)
1355+ ADD_INT(d, DB_FAILCHK);
1356+#endif
1357+
1358+#if (DBVER >= 51)
1359+ ADD_INT(d, DB_HOTBACKUP_IN_PROGRESS);
1360+#endif
1361+
1362 #if (DBVER >= 43)
1363 ADD_INT(d, DB_BUFFER_SMALL);
1364 ADD_INT(d, DB_SEQ_DEC);
1365@@ -9856,6 +9890,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1366 ADD_INT(d, DB_SET_LOCK_TIMEOUT);
1367 ADD_INT(d, DB_SET_TXN_TIMEOUT);
1368
1369+#if (DBVER >= 48)
1370+ ADD_INT(d, DB_SET_REG_TIMEOUT);
1371+#endif
1372+
1373 /* The exception name must be correct for pickled exception *
1374 * objects to unpickle properly. */
1375 #ifdef PYBSDDB_STANDALONE /* different value needed for standalone pybsddb */
1376@@ -9912,8 +9950,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1377 MAKE_EX(DBRunRecoveryError);
1378 MAKE_EX(DBVerifyBadError);
1379 MAKE_EX(DBNoServerError);
1380+#if (DBVER >= 44 && DBVER < 52)
1381 MAKE_EX(DBNoServerHomeError);
1382 MAKE_EX(DBNoServerIDError);
1383+#endif
1384 MAKE_EX(DBPageNotFoundError);
1385 MAKE_EX(DBSecondaryBadError);
1386
1387@@ -9927,9 +9967,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1388 MAKE_EX(DBNoSuchFileError);
1389 MAKE_EX(DBPermissionsError);
1390
1391-#if (DBVER >= 42)
1392 MAKE_EX(DBRepHandleDeadError);
1393-#endif
1394 #if (DBVER >= 44)
1395 MAKE_EX(DBRepLockoutError);
1396 #endif
1397@@ -9947,6 +9985,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1398 #undef MAKE_EX
1399
1400 /* Initialise the C API structure and add it to the module */
1401+ bsddb_api.api_version = PYBSDDB_API_VERSION;
1402 bsddb_api.db_type = &DB_Type;
1403 bsddb_api.dbcursor_type = &DBCursor_Type;
1404 bsddb_api.dblogcursor_type = &DBLogCursor_Type;
1405@@ -9955,19 +9994,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1406 bsddb_api.dblock_type = &DBLock_Type;
1407 #if (DBVER >= 43)
1408 bsddb_api.dbsequence_type = &DBSequence_Type;
1409+#else
1410+ bsddb_api.dbsequence_type = NULL;
1411 #endif
1412 bsddb_api.makeDBError = makeDBError;
1413
1414 /*
1415- ** Capsules exist from Python 3.1, but I
1416- ** don't want to break the API compatibility
1417- ** for already published Python versions.
1418+ ** Capsules exist from Python 2.7 and 3.1.
1419+ ** We don't support Python 3.0 anymore, so...
1420+ ** #if (PY_VERSION_HEX < ((PY_MAJOR_VERSION < 3) ? 0x02070000 : 0x03020000))
1421 */
1422-#if (PY_VERSION_HEX < 0x03020000)
1423+#if (PY_VERSION_HEX < 0x02070000)
1424 py_api = PyCObject_FromVoidPtr((void*)&bsddb_api, NULL);
1425 #else
1426 {
1427- char py_api_name[250];
1428+ /*
1429+ ** The data must outlive the call!!. So, the static definition.
1430+ ** The buffer must be big enough...
1431+ */
1432+ static char py_api_name[MODULE_NAME_MAX_LEN+10];
1433
1434 strcpy(py_api_name, _bsddbModuleName);
1435 strcat(py_api_name, ".api");
1436diff --git a/Modules/bsddb.h b/Modules/bsddb.h
1437index a3a687b..c1d862a 100644
1438--- a/Modules/bsddb.h
1439+++ b/Modules/bsddb.h
1440@@ -109,7 +109,7 @@
1441 #error "eek! DBVER can't handle minor versions > 9"
1442 #endif
1443
1444-#define PY_BSDDB_VERSION "4.8.4.2"
1445+#define PY_BSDDB_VERSION "5.3.15"
1446
1447 /* Python object definitions */
1448
1449@@ -236,7 +236,7 @@ typedef struct DBSequenceObject {
1450 /* To access the structure from an external module, use code like the
1451 following (error checking missed out for clarity):
1452
1453- // If you are using Python before 3.2:
1454+ // If you are using Python before 2.7:
1455 BSDDB_api* bsddb_api;
1456 PyObject* mod;
1457 PyObject* cobj;
1458@@ -249,7 +249,7 @@ typedef struct DBSequenceObject {
1459 Py_DECREF(mod);
1460
1461
1462- // If you are using Python 3.2 or up:
1463+ // If you are using Python 2.7 or up: (except Python 3.0, unsupported)
1464 BSDDB_api* bsddb_api;
1465
1466 // Use "bsddb3._pybsddb.api" if you're using
1467@@ -257,10 +257,14 @@ typedef struct DBSequenceObject {
1468 bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1);
1469
1470
1471+ Check "api_version" number before trying to use the API.
1472+
1473 The structure's members must not be changed.
1474 */
1475
1476+#define PYBSDDB_API_VERSION 1
1477 typedef struct {
1478+ unsigned int api_version;
1479 /* Type objects */
1480 PyTypeObject* db_type;
1481 PyTypeObject* dbcursor_type;
1482@@ -268,9 +272,7 @@ typedef struct {
1483 PyTypeObject* dbenv_type;
1484 PyTypeObject* dbtxn_type;
1485 PyTypeObject* dblock_type;
1486-#if (DBVER >= 43)
1487- PyTypeObject* dbsequence_type;
1488-#endif
1489+ PyTypeObject* dbsequence_type; /* If DBVER < 43 -> NULL */
1490
1491 /* Functions */
1492 int (*makeDBError)(int err);
1493@@ -289,9 +291,9 @@ typedef struct {
1494 #define DBEnvObject_Check(v) ((v)->ob_type == bsddb_api->dbenv_type)
1495 #define DBTxnObject_Check(v) ((v)->ob_type == bsddb_api->dbtxn_type)
1496 #define DBLockObject_Check(v) ((v)->ob_type == bsddb_api->dblock_type)
1497-#if (DBVER >= 43)
1498-#define DBSequenceObject_Check(v) ((v)->ob_type == bsddb_api->dbsequence_type)
1499-#endif
1500+#define DBSequenceObject_Check(v) \
1501+ ((bsddb_api->dbsequence_type) && \
1502+ ((v)->ob_type == bsddb_api->dbsequence_type))
1503
1504 #endif /* COMPILING_BSDDB_C */
1505
1506diff --git a/setup.py b/setup.py
1507index 6b47451..e8ac96c 100644
1508--- a/setup.py
1509+++ b/setup.py
1510@@ -799,7 +799,7 @@ class PyBuildExt(build_ext):
1511 # a release. Most open source OSes come with one or more
1512 # versions of BerkeleyDB already installed.
1513
1514- max_db_ver = (4, 8)
1515+ max_db_ver = (5, 3)
1516 min_db_ver = (4, 1)
1517 db_setup_debug = False # verbose debug prints from this script?
1518
1519@@ -821,7 +821,11 @@ class PyBuildExt(build_ext):
1520 return True
1521
1522 def gen_db_minor_ver_nums(major):
1523- if major == 4:
1524+ if major == 5:
1525+ for x in range(max_db_ver[1]+1):
1526+ if allow_db_ver((5, x)):
1527+ yield x
1528+ elif major == 4:
1529 for x in range(max_db_ver[1]+1):
1530 if allow_db_ver((4, x)):
1531 yield x
1532@@ -835,6 +839,9 @@ class PyBuildExt(build_ext):
1533 # construct a list of paths to look for the header file in on
1534 # top of the normal inc_dirs.
1535 db_inc_paths = [
1536+ '/usr/include/db5',
1537+ '/usr/local/include/db5',
1538+ '/opt/sfw/include/db5',
1539 '/usr/include/db4',
1540 '/usr/local/include/db4',
1541 '/opt/sfw/include/db4',
1542@@ -845,6 +852,16 @@ class PyBuildExt(build_ext):
1543 '/sw/include/db4',
1544 '/sw/include/db3',
1545 ]
1546+ # 5.x minor number specific paths
1547+ for x in gen_db_minor_ver_nums(5):
1548+ db_inc_paths.append('/usr/include/db5%d' % x)
1549+ db_inc_paths.append('/usr/include/db5.%d' % x)
1550+ db_inc_paths.append('/usr/local/BerkeleyDB.5.%d/include' % x)
1551+ db_inc_paths.append('/usr/local/include/db5%d' % x)
1552+ db_inc_paths.append('/pkg/db-5.%d/include' % x)
1553+ db_inc_paths.append('/opt/db-5.%d/include' % x)
1554+ # MacPorts default (http://www.macports.org/)
1555+ db_inc_paths.append('/opt/local/include/db5%d' % x)
1556 # 4.x minor number specific paths
1557 for x in gen_db_minor_ver_nums(4):
1558 db_inc_paths.append('/usr/include/db4%d' % x)
1559@@ -871,6 +888,10 @@ class PyBuildExt(build_ext):
1560 for dn in inc_dirs:
1561 std_variants.append(os.path.join(dn, 'db3'))
1562 std_variants.append(os.path.join(dn, 'db4'))
1563+ std_variants.append(os.path.join(dn, 'db5'))
1564+ for x in gen_db_minor_ver_nums(5):
1565+ std_variants.append(os.path.join(dn, "db5%d"%x))
1566+ std_variants.append(os.path.join(dn, "db5.%d"%x))
1567 for x in gen_db_minor_ver_nums(4):
1568 std_variants.append(os.path.join(dn, "db4%d"%x))
1569 std_variants.append(os.path.join(dn, "db4.%d"%x))
1570--
15711.7.7
1572
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch b/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch
new file mode 100644
index 0000000000..216be0a448
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch
@@ -0,0 +1,28 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Remove the RPATH to avoid QA issue warning.
4
5RP: Added secondary unnecessary rpath to the list 2012/8/7
6Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
7
8
9Index: Python-2.7.3/setup.py
10===================================================================
11--- Python-2.7.3.orig/setup.py 2012-08-07 10:41:58.560132529 +0000
12+++ Python-2.7.3/setup.py 2012-08-07 11:09:47.852094515 +0000
13@@ -1042,7 +1042,6 @@
14 exts.append(Extension('_bsddb', ['_bsddb.c'],
15 depends = ['bsddb.h'],
16 library_dirs=dblib_dir,
17- runtime_library_dirs=dblib_dir,
18 include_dirs=db_incs,
19 libraries=dblibs))
20 else:
21@@ -1252,7 +1251,6 @@
22 print "building dbm using bdb"
23 dbmext = Extension('dbm', ['dbmmodule.c'],
24 library_dirs=dblib_dir,
25- runtime_library_dirs=dblib_dir,
26 include_dirs=db_incs,
27 define_macros=[
28 ('HAVE_BERKDB_H', None),
diff --git a/meta/recipes-devtools/python/python/python-fix-build-error-with-Readline-6.3.patch b/meta/recipes-devtools/python/python/python-fix-build-error-with-Readline-6.3.patch
new file mode 100644
index 0000000000..b84f8c3461
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-fix-build-error-with-Readline-6.3.patch
@@ -0,0 +1,62 @@
1python: fix build error with Readline 6.3
2
3Backport two patches from upstream:
4
5use new readline function types (closes #20374)
6Issue #20374: Avoid compiler warnings when compiling readline with libedit.
7
8Upstream-Status: Backport
9
10Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
11---
12 Modules/readline.c | 15 ++++++++++++---
13 1 file changed, 12 insertions(+), 3 deletions(-)
14
15diff --git a/Modules/readline.c b/Modules/readline.c
16index b5e258d..d3f52aa 100644
17--- a/Modules/readline.c
18+++ b/Modules/readline.c
19@@ -735,15 +735,24 @@ on_hook(PyObject *func)
20 return result;
21 }
22
23+
24 static int
25+#if defined(_RL_FUNCTION_TYPEDEF)
26 on_startup_hook(void)
27+#else
28+on_startup_hook()
29+#endif
30 {
31 return on_hook(startup_hook);
32 }
33
34 #ifdef HAVE_RL_PRE_INPUT_HOOK
35 static int
36+#if defined(_RL_FUNCTION_TYPEDEF)
37 on_pre_input_hook(void)
38+#else
39+on_pre_input_hook()
40+#endif
41 {
42 return on_hook(pre_input_hook);
43 }
44@@ -886,12 +895,12 @@ setup_readline(void)
45 rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
46 rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
47 /* Set our hook functions */
48- rl_startup_hook = (Function *)on_startup_hook;
49+ rl_startup_hook = (rl_hook_func_t *)on_startup_hook;
50 #ifdef HAVE_RL_PRE_INPUT_HOOK
51- rl_pre_input_hook = (Function *)on_pre_input_hook;
52+ rl_pre_input_hook = (rl_hook_func_t *)on_pre_input_hook;
53 #endif
54 /* Set our completion function */
55- rl_attempted_completion_function = (CPPFunction *)flex_complete;
56+ rl_attempted_completion_function = (rl_completion_func_t *)flex_complete;
57 /* Set Python word break characters */
58 rl_completer_word_break_characters =
59 strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?");
60--
611.7.9.5
62
diff --git a/meta/recipes-devtools/python/python/remove_sqlite_rpath.patch b/meta/recipes-devtools/python/python/remove_sqlite_rpath.patch
new file mode 100644
index 0000000000..4ec627ea51
--- /dev/null
+++ b/meta/recipes-devtools/python/python/remove_sqlite_rpath.patch
@@ -0,0 +1,19 @@
1This patch removes the RPATH setting which contains a pointer to
2the target relocated sysroot, which is incorrect.
3
4Upstream-Status: Inappropriate [Embedded Specific]
5
6Signed-off-by: Saul Wold <sgw@linux.intel.com>
7
8Index: Python-2.6.6/setup.py
9===================================================================
10--- Python-2.6.6.orig/setup.py 2011-09-28 14:22:57.000000000 -0700
11+++ Python-2.6.6/setup.py 2011-09-28 16:11:25.147279633 -0700
12@@ -1079,7 +1079,6 @@
13 include_dirs=["Modules/_sqlite",
14 sqlite_incdir],
15 library_dirs=sqlite_libdir,
16- runtime_library_dirs=sqlite_libdir,
17 extra_link_args=sqlite_extra_link_args,
18 libraries=["sqlite3",]))
19 else:
diff --git a/meta/recipes-devtools/python/python/run-ptest b/meta/recipes-devtools/python/python/run-ptest
new file mode 100644
index 0000000000..89a769f743
--- /dev/null
+++ b/meta/recipes-devtools/python/python/run-ptest
@@ -0,0 +1,5 @@
1#!/bin/sh
2#
3#This script is used to run python test suites
4
5make -f /usr/lib/python/ptest/Makefile -k runtest-TESTS srcdir=/usr/lib/python2.7 TESTPROG=/usr/lib/python2.7/test/regrtest.py | sed -e '/\.\.\. ok/ s/^/PASS: /g' -e '/\.\.\. [ERROR|FAIL]/ s/^/FAIL: /g' -e '/\.\.\. skipped/ s/^/SKIP: /g' -e 's/ \.\.\. ok//g' -e 's/ \.\.\. ERROR//g' -e 's/ \.\.\. FAIL//g' -e 's/ \.\.\. skipped//g'
diff --git a/meta/recipes-devtools/python/python/search_db_h_in_inc_dirs_and_avoid_warning.patch b/meta/recipes-devtools/python/python/search_db_h_in_inc_dirs_and_avoid_warning.patch
new file mode 100644
index 0000000000..0c1f1741cb
--- /dev/null
+++ b/meta/recipes-devtools/python/python/search_db_h_in_inc_dirs_and_avoid_warning.patch
@@ -0,0 +1,40 @@
1python should search for db.h in inc_dirs and not in a hardcoded path.
2If db.h is found but HASHVERSION is not 2 we avoid a warning by not
3adding this module to missing variable.
4
5Upstream-Status: Inappropriate [distribution]
6
7Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
8
9Index: Python-2.7.2/setup.py
10===================================================================
11--- Python-2.7.2.orig/setup.py 2012-04-05 22:27:22.437199989 +0300
12+++ Python-2.7.2/setup.py 2012-04-05 22:26:38.000000000 +0300
13@@ -1141,12 +1141,12 @@
14 # the more recent berkeleydb's db.h file first in the include path
15 # when attempting to compile and it will fail.
16 f = "/usr/include/db.h"
17-
18+ if len(inc_dirs) != 0:
19+ f = os.path.join(inc_dirs[0], "db.h")
20 if sys.platform == 'darwin':
21 if is_macosx_sdk_path(f):
22 sysroot = macosx_sdk_root()
23 f = os.path.join(sysroot, f[1:])
24-
25 if os.path.exists(f) and not db_incs:
26 data = open(f).read()
27 m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
28@@ -1161,8 +1161,10 @@
29 libraries=libraries))
30 else:
31 exts.append(Extension('bsddb185', ['bsddbmodule.c']))
32- else:
33- missing.append('bsddb185')
34+ # If a newer version is detected don't report an useless
35+ # warning
36+ #else:
37+ # missing.append('bsddb185')
38 else:
39 missing.append('bsddb185')
40
diff --git a/meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch b/meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch
new file mode 100644
index 0000000000..6ccdb948b9
--- /dev/null
+++ b/meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch
@@ -0,0 +1,27 @@
1This patch skips over the 'import check' setup.py does when building
2extensions. This generally won't work when cross-compiling.
3
4Upstream-Status: Inappropriate [embedded-specific]
5
6Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
7
8Index: Python-2.7.2/setup.py
9===================================================================
10--- Python-2.7.2.orig/setup.py 2011-11-04 16:46:34.553796410 -0500
11+++ Python-2.7.2/setup.py 2011-11-04 16:59:49.692802313 -0500
12@@ -287,6 +287,15 @@
13 (ext.name, sys.exc_info()[1]))
14 self.failed.append(ext.name)
15 return
16+
17+ # If we're cross-compiling, we want to skip the import check
18+ # i.e. we shouldn't be dynamically loading target shared libs
19+ if os.environ.get('CROSS_COMPILE') is not None:
20+ self.announce(
21+ 'WARNING: skipping import check for cross-compiled "%s"' %
22+ ext.name)
23+ return
24+
25 # Workaround for Mac OS X: The Carbon-based modules cannot be
26 # reliably imported into a command-line Python
27 if 'Carbon' in ext.extra_link_args:
diff --git a/meta/recipes-devtools/python/python/setuptweaks.patch b/meta/recipes-devtools/python/python/setuptweaks.patch
new file mode 100644
index 0000000000..c34ef160d3
--- /dev/null
+++ b/meta/recipes-devtools/python/python/setuptweaks.patch
@@ -0,0 +1,57 @@
1This patch removes various ways native system options can pass into the python
2compilation and somehow break C modules.
3
4Upstream-Status: Configuration [OE Specific]
5
6RP 2012/04/23
7
8Index: Python-2.7.2/setup.py
9===================================================================
10--- Python-2.7.2.orig/setup.py 2012-04-23 20:03:47.295582553 +0000
11+++ Python-2.7.2/setup.py 2012-04-23 20:03:15.000000000 +0000
12@@ -231,7 +231,13 @@
13 # compilers
14 if compiler is not None:
15 (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
16- args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
17+ # Need to filter out -isysroot from the flags. Ideally should
18+ # figure out target flags here.
19+ flags = []
20+ for f in cflags.split():
21+ if not f.startswith("-isystem"):
22+ flags.append(f)
23+ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + ' '.join(flags)
24 self.compiler.set_executables(**args)
25
26 build_ext.build_extensions(self)
27@@ -393,7 +399,6 @@
28 # into configure and stored in the Makefile (issue found on OS X 10.3).
29 for env_var, arg_name, dir_list in (
30 ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
31- ('LDFLAGS', '-L', self.compiler.library_dirs),
32 ('CPPFLAGS', '-I', self.compiler.include_dirs)):
33 env_val = sysconfig.get_config_var(env_var)
34 if env_val:
35@@ -419,16 +424,16 @@
36 for directory in reversed(options.dirs):
37 add_dir_to_list(dir_list, directory)
38
39- if os.path.normpath(sys.prefix) != '/usr' \
40- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
41+# if os.path.normpath(sys.prefix) != '/usr' \
42+# and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
43 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
44 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
45 # building a framework with different architectures than
46 # the one that is currently installed (issue #7473)
47- add_dir_to_list(self.compiler.library_dirs,
48- sysconfig.get_config_var("LIBDIR"))
49- add_dir_to_list(self.compiler.include_dirs,
50- sysconfig.get_config_var("INCLUDEDIR"))
51+# add_dir_to_list(self.compiler.library_dirs,
52+# sysconfig.get_config_var("LIBDIR"))
53+# add_dir_to_list(self.compiler.include_dirs,
54+# sysconfig.get_config_var("INCLUDEDIR"))
55
56 try:
57 have_unicode = unicode
diff --git a/meta/recipes-devtools/python/python/sitecustomize.py b/meta/recipes-devtools/python/python/sitecustomize.py
new file mode 100644
index 0000000000..273901898a
--- /dev/null
+++ b/meta/recipes-devtools/python/python/sitecustomize.py
@@ -0,0 +1,45 @@
1# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
2# GPLv2 or later
3# Version: 20081123
4# Features:
5# * set proper default encoding
6# * enable readline completion in the interactive interpreter
7# * load command line history on startup
8# * save command line history on exit
9
10import os
11
12def __exithandler():
13 try:
14 readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
15 except IOError:
16 pass
17
18def __registerExitHandler():
19 import atexit
20 atexit.register( __exithandler )
21
22def __enableReadlineSupport():
23 readline.set_history_length( 1000 )
24 readline.parse_and_bind( "tab: complete" )
25 try:
26 readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
27 except IOError:
28 pass
29
30def __enableDefaultEncoding():
31 import sys
32 try:
33 sys.setdefaultencoding( "utf8" )
34 except LookupError:
35 pass
36
37import sys
38try:
39 import rlcompleter, readline
40except ImportError:
41 pass
42else:
43 __enableDefaultEncoding()
44 __registerExitHandler()
45 __enableReadlineSupport()