Hello community,

here is the log from the commit of package python.2949 for openSUSE:13.1:Update 
checked in at 2014-08-20 18:31:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/python.2949 (Old)
 and      /work/SRC/openSUSE:13.1:Update/.python.2949.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python.2949"

Changes:
--------
New Changes file:

--- /dev/null   2014-07-24 01:57:42.080040256 +0200
+++ /work/SRC/openSUSE:13.1:Update/.python.2949.new/python-base.changes 
2014-08-20 18:31:19.000000000 +0200
@@ -0,0 +1,556 @@
+-------------------------------------------------------------------
+Wed Jul 23 16:48:38 UTC 2014 - jmate...@suse.com
+
+- CVE-2014-4650-CGIHTTPServer-traversal.patch: CGIHTTPServer file
+  disclosure and directory traversal through URL-encoded characters
+  (CVE-2014-4650, bnc#885882)
+- python-2.7.7-mhlib-linkcount.patch: remove link count optimizations
+  that are incorrect on btrfs (and possibly other filesystems)
+
+-------------------------------------------------------------------
+Thu Jun 26 16:46:05 UTC 2014 - jmate...@suse.com
+
+- fix bad bounds check in json parser, preventing arbitrary memory read
+  (CVE-2014-4616, bnc#884075, CVE-2014-4616-json-bounds-check.patch)
+
+-------------------------------------------------------------------
+Mon Feb 10 14:24:52 UTC 2014 - jmate...@suse.com
+
+- added patches for CVE-2013-1752 (bnc#856836) issues that are
+  missing in 2.7.6:
+  python-2.7.6-imaplib.patch
+  python-2.7.6-poplib.patch
+  smtplib_maxline-2.7.patch
+- CVE-2013-1753 (bnc#856835) gzip decompression bomb in xmlrpc client:
+  xmlrpc_gzip_27.patch
+- python-2.7.6-bdist-rpm.patch: fix broken "setup.py bdist_rpm" command
+  (bnc#857470, issue18045)
+- multilib patch: add "~/.local/lib64" paths to search path
+  (bnc#637176)
+- CVE-2014-1912-recvfrom_into.patch: fix potential buffer overflow
+  in socket.recvfrom_into (CVE-2014-1912, bnc#863741)
+
+-------------------------------------------------------------------
+Tue Dec 10 16:56:02 UTC 2013 - uweig...@de.ibm.com
+
+- Add Obsoletes/Provides for python-ctypes.
+
+-------------------------------------------------------------------
+Sat Dec  7 02:27:51 UTC 2013 - m...@suse.de
+
+- Ignore uuid testcase in the testsuite, it relies on unreliable
+  ifconfig output.
+
+-------------------------------------------------------------------
+Tue Dec  3 20:03:08 CET 2013 - m...@suse.de
+
+- adapt python-2.7.5-multilib.patch for ppc64le
+
+-------------------------------------------------------------------
+Tue Dec  3 17:30:26 UTC 2013 - dval...@suse.com
+
+- adjust %files for ppc64le
+
+-------------------------------------------------------------------
+Tue Dec  3 17:05:45 UTC 2013 - m...@suse.de
+
+- Support for ppc64le in _ctypes libffi copy.
+
+- added patches:
+  * libffi-ppc64le.diff
+-------------------------------------------------------------------
+Tue Dec  3 09:44:28 UTC 2013 - adr...@suse.de
+
+- add ppc64le rules
+- avoid errors from source-validator
+
+-------------------------------------------------------------------
+Thu Nov 21 15:39:28 UTC 2013 - jmate...@suse.com
+
+- update to 2.7.6
+  * bugfix-only release
+  * SSL-related fixes
+  * upstream fix for CVE-2013-4238
+  * upstream fixes for CVE-2013-1752
+- removed upstreamed patch CVE-2013-4238_py27.patch
+- reintroduce audioop.so as the problems with it seem to be fixed
+  (bnc#831442)
+
+-------------------------------------------------------------------
+Thu Oct 10 18:13:08 UTC 2013 - dmuel...@suse.com
+
+- exclude test_mmap under qemu_linux_user - emulation fails here
+  as the tests mmap address conflicts with qemu
+
+-------------------------------------------------------------------
+Tue Jul  9 07:55:50 UTC 2013 - jeng...@inai.de
+
+- Add python-bsddb6.diff to support building against libdb-6.0
+
+-------------------------------------------------------------------
+Sat Jul  6 17:17:11 UTC 2013 - co...@suse.com
+
+- have python-devel require python:
+  http://lists.opensuse.org/opensuse-factory/2013-06/msg00622.html
+
+-------------------------------------------------------------------
+Sun Jun 30 21:20:29 UTC 2013 - sch...@suse.de
+
+- Disable test_multiprocessing in QEmu build
+
+-------------------------------------------------------------------
+Wed Jun  5 15:17:51 UTC 2013 - sch...@suse.de
+
+- Disable test_asyncore in QEmu build
+- Reenable testsuite on arm
+
+-------------------------------------------------------------------
+Thu May 30 16:40:16 UTC 2013 - jmate...@suse.com
+
+- python-2.7.4-aarch64.patch: add missing bits of aarch64 support
+- python-2.7.4-no-REUSEPORT.patch: disable test of
+  missing kernel functionality
+- drop unnecessary patch: python-2.7.1-distutils_test_path.patch
+- switch to xz archive
+
+-------------------------------------------------------------------
+Tue May 28 08:42:49 UTC 2013 - speili...@suse.com
+
+- Update to version 2.7.5:
+  + bugfix-only release
+  + fixes several important regressions introduced in 2.7.4
+  + Issue #15535: Fixed regression in the pickling of named tuples by
+    removing the __dict__ property introduced in 2.7.4.
+  + Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
+    such as was shipped with Centos 5 and Mac OS X 10.4.
+  + Issue #17703: Fix a regression where an illegal use of Py_DECREF() after
+    interpreter finalization can cause a crash.
+  + Issue #16447: Fixed potential segmentation fault when setting __name__ on a
+    class.
+  + Issue #17610: Don't rely on non-standard behavior of the C qsort() 
function. 12 
+  See http://hg.python.org/cpython/file/ab05e7dd2788/Misc/NEWS for more
+- Drop upstreamed patches:
+  + python-2.7.3-fix-dbm-64bit-bigendian.patch
+  + python-test_structmembers.patch
+- Rebased other patches
+
+-------------------------------------------------------------------
+Mon May 13 09:24:29 UTC 2013 - dmuel...@suse.com
+
+- add aarch64 to the list of 64-bit platforms 
+
+-------------------------------------------------------------------
+Thu May  9 16:11:23 UTC 2013 - jmate...@suse.com
+
+- update to 2.7.4
+    * bugfix-only release
+- drop upstreamed patches:
+    pypirc-secure.diff
+    python-2.7.3-multiprocessing-join.patch
+    ctypes-libffi-aarch64.patch
+- drop python-2.7rc2-configure.patch as it doesn't seem necessary anymore
+
+-------------------------------------------------------------------
+Fri Apr  5 13:33:27 UTC 2013 - idon...@suse.com
+
+- Add Source URL, see https://en.opensuse.org/SourceUrls
+
+-------------------------------------------------------------------
+Wed Feb 27 17:04:32 UTC 2013 - sch...@suse.de
+
+- Add aarch64 to the list of lib64 platforms
+
+-------------------------------------------------------------------
+Sat Feb  9 16:24:10 UTC 2013 - sch...@suse.de
+
+- Add ctypes-libffi-aarch64.patch: import aarch64 support for libffi in
+  _ctypes module
+
+-------------------------------------------------------------------
+Fri Feb  8 14:49:45 UTC 2013 - jmate...@suse.com
+
+- multiprocessing: thread joining itself (bnc#747794)
+- gettext: fix cases where no bundle is found (bnc#794139)
+
+-------------------------------------------------------------------
+Thu Oct 25 11:21:06 UTC 2012 - co...@suse.com
+
+- add explicit buildrequire on libbz2-devel
+
+-------------------------------------------------------------------
+Mon Oct 15 10:39:15 UTC 2012 - co...@suse.com
+
+- buildrequire explicitly netcfg for the test suite
+
+-------------------------------------------------------------------
+Mon Oct  8 14:33:08 UTC 2012 - jmate...@suse.com
+
+- remove distutils.cfg (bnc#658604)
+  * this changes default prefix for distutils to /usr
+  * see ML for details:
+http://lists.opensuse.org/opensuse-packaging/2012-09/msg00254.html
+
+-------------------------------------------------------------------
+Fri Aug  3 18:43:32 UTC 2012 - dims...@opensuse.org
+
+- Add python-bundle-lang.patch: gettext: If bindtextdomain is
+  instructed to look in the default location of translations, we
++++ 359 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.1:Update/.python.2949.new/python-base.changes
New Changes file:

--- /dev/null   2014-07-24 01:57:42.080040256 +0200
+++ /work/SRC/openSUSE:13.1:Update/.python.2949.new/python-doc.changes  
2014-08-20 18:31:19.000000000 +0200
@@ -0,0 +1,122 @@
+-------------------------------------------------------------------
+Thu Nov 21 15:55:04 UTC 2013 - jmate...@suse.com
+
+- update to 2.7.6
+- docs are now versioned with patchlevel too
+
+-------------------------------------------------------------------
+Tue Jun  4 13:23:28 UTC 2013 - jmate...@suse.com
+
+- disable Source URLs for docs (the doc archives are regenerated
+  every day and autobuild detects this as "upstream file is different"
+  error)
+
+-------------------------------------------------------------------
+Tue May 28 08:42:49 UTC 2013 - speili...@suse.com
+
+- Update to version 2.7.5
+
+-------------------------------------------------------------------
+Thu May  9 16:14:17 UTC 2013 - jmate...@suse.com
+
+- update to 2.7.4
+- removed %docdir/python/README from package (conflict with python-base)
+- removed ACKS (is now part of Misc docs)
+
+-------------------------------------------------------------------
+Fri Apr  5 13:33:29 UTC 2013 - idon...@suse.com
+
+- Add Source URL, see https://en.opensuse.org/SourceUrls
+- Fix installation so we don't create double sub-directories
+
+-------------------------------------------------------------------
+Thu May 17 17:49:31 UTC 2012 - jf...@funktronics.ca
+
+- Support directory-based certificate stores with the ca_certs parameter of SSL
+  functions [bnc#761501]
+
+-------------------------------------------------------------------
+Mon Nov 28 09:21:32 UTC 2011 - sasc...@suse.de
+
+- Spec file cleanup:
+  * Run spec-cleaner
+  * Remove outdated %clean section, AutoReqProv and authors from descr.
+- Fix license to Python-2.0 (also SPDX style)
+
+-------------------------------------------------------------------
+Tue May 24 14:30:36 UTC 2011 - jmate...@novell.com
+
+- updated to build against 2.7.1
+
+-------------------------------------------------------------------
+Thu Aug 26 11:43:28 UTC 2010 - jmate...@novell.com
+
+- updated to 2.7
+
+-------------------------------------------------------------------
+Thu Mar 11 19:19:07 CET 2010 - matej...@suse.cz
+
+- updated to build against 2.6.5 source
+
+-------------------------------------------------------------------
+Wed Dec 23 08:36:27 UTC 2009 - a...@suse.de
+
+- Apply patches with fuzz=0
+
+-------------------------------------------------------------------
+Mon Apr 27 15:21:03 CEST 2009 - matej...@suse.cz
+
+- update to build against 2.6.2 source
+
+-------------------------------------------------------------------
+Wed Mar 11 10:52:59 CET 2009 - co...@suse.de
+
+- fix build in actually packaging the docs
+
+-------------------------------------------------------------------
+Thu Oct  9 18:58:15 CEST 2008 - matej...@suse.cz
+
+- updated docs to version 2.6
+
+-------------------------------------------------------------------
+Mon Sep 15 18:34:58 CEST 2008 - matej...@suse.cz
+
+- updated to build against 2.6rc1
+
+-------------------------------------------------------------------
+Wed Jun 25 21:55:18 CEST 2008 - matej...@suse.cz
+
+- updated to build against 2.6b1
+- will update the docs when 2.6 final is out
+
+-------------------------------------------------------------------
+Thu May 24 18:51:37 CEST 2007 - jmate...@suse.cz
+
+- updated to version 2.5.1
+
+-------------------------------------------------------------------
+Tue Sep 19 18:30:50 CEST 2006 - jmate...@suse.cz
+
+- updated to version 2.5 final, going into STABLE dist
+
+-------------------------------------------------------------------
+Wed Sep 13 19:11:36 CEST 2006 - jmate...@suse.cz
+
+- updated to build against 2.5c2
+
+-------------------------------------------------------------------
+Tue Sep  5 14:01:05 CEST 2006 - jmate...@suse.cz
+
+- updated to build against 2.5c1
+- will actually update the docs as soon as this goes into STABLE
+
+-------------------------------------------------------------------
+Mon Apr 24 20:08:41 CEST 2006 - jmate...@suse.cz
+
+- update to 2.4.3
+
+-------------------------------------------------------------------
+Tue Mar 21 18:11:38 CET 2006 - jmate...@suse.cz
+
+- created separate noarch specfile
+
New Changes file:

--- /dev/null   2014-07-24 01:57:42.080040256 +0200
+++ /work/SRC/openSUSE:13.1:Update/.python.2949.new/python.changes      
2014-08-20 18:31:19.000000000 +0200
@@ -0,0 +1,1416 @@
+-------------------------------------------------------------------
+Thu Nov 21 15:54:55 UTC 2013 - jmate...@suse.com
+
+- update to 2.7.6
+
+-------------------------------------------------------------------
+Thu Sep 19 17:40:05 UTC 2013 - crrodrig...@opensuse.org
+
+- build with -DOPENSSL_LOAD_CONF so python honours 
+ the system's openSSL configuration if any, allowing it to
+ benefit from openssl ENGINE functionality.
+
+-------------------------------------------------------------------
+Mon Aug 26 13:55:35 UTC 2013 - lnus...@suse.de
+
+- update python-2.7.3-ssl_ca_path.patch patch to load default verify locations
+  if no ca_certs file is specified (bnc#827982, bnc#836739)
+
+-------------------------------------------------------------------
+Fri Aug 16 11:25:49 UTC 2013 - jmate...@suse.com
+
+- handle NULL bytes in certain fields of SSL certificates
+  (CVE-2013-4238, bnc#834601)
+
+-------------------------------------------------------------------
+Tue Jul  9 07:55:50 UTC 2013 - jeng...@inai.de
+
+- Add python-bsddb6.diff to support building against libdb-6.0
+
+-------------------------------------------------------------------
+Wed Jun  5 15:19:14 UTC 2013 - sch...@suse.de
+
+- Reenable testsuite on arm
+
+-------------------------------------------------------------------
+Thu May 30 16:40:16 UTC 2013 - jmate...@suse.com
+
+- switch to xz archive
+
+-------------------------------------------------------------------
+Tue May 28 08:42:49 UTC 2013 - speili...@suse.com
+
+- Update to version 2.7.5:
+  + bugfix-only release
+  + fixes several important regressions introduced in 2.7.4
+  + Issue #15535: Fixed regression in the pickling of named tuples by
+    removing the __dict__ property introduced in 2.7.4.
+  + Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
+    such as was shipped with Centos 5 and Mac OS X 10.4.
+  + Issue #17703: Fix a regression where an illegal use of Py_DECREF() after
+    interpreter finalization can cause a crash.
+  + Issue #16447: Fixed potential segmentation fault when setting __name__ on a
+    class.
+  + Issue #17610: Don't rely on non-standard behavior of the C qsort() 
function. 12 
+  See http://hg.python.org/cpython/file/ab05e7dd2788/Misc/NEWS for more
+
+-------------------------------------------------------------------
+Thu May  9 16:14:07 UTC 2013 - jmate...@suse.com
+
+- update to 2.7.4
+  * bugfix-only release
+
+-------------------------------------------------------------------
+Fri Apr  5 13:33:33 UTC 2013 - idon...@suse.com
+
+- Add Source URL, see https://en.opensuse.org/SourceUrls
+
+-------------------------------------------------------------------
+Mon Feb 25 17:24:52 UTC 2013 - jmate...@suse.com
+
+- fix pythonstart failing on $HOME-less users (bnc#804978)
+
+-------------------------------------------------------------------
+Sun Aug 12 11:46:22 UTC 2012 - idon...@suse.com
+
+- python & python-base Release numbers can differ, take that into
+  account. See bnc#766778 comment 12.
+
+-------------------------------------------------------------------
+Tue Jun 26 11:54:22 UTC 2012 - dval...@suse.com
+
+- Fix failing test_dbm on ppc64
+
+-------------------------------------------------------------------
+Thu May 17 17:49:31 UTC 2012 - jf...@funktronics.ca
+
+- Support directory-based certificate stores with the ca_certs parameter of SSL
+  functions [bnc#761501]
+
+-------------------------------------------------------------------
+Tue May 15 14:17:43 UTC 2012 - jmate...@suse.com
+
+- enabled some tests
+
+-------------------------------------------------------------------
+Thu Dec  8 13:30:29 UTC 2011 - jmate...@suse.com
+
+- %python_version now correctly refers to %tarversion
+
+-------------------------------------------------------------------
+Thu Dec 01 09:21:32 UTC 2011 - sasc...@suse.de
+
+- Spec file cleanup:
+  * Run spec-cleaner
+  * Remove outdated %clean section, AutoReqProv and authors from descr.
+- Fix license to Python-2.0 (also SPDX style)
+
+-------------------------------------------------------------------
+Wed Nov 30 09:52:31 UTC 2011 - co...@suse.com
+
+- add automake as buildrequire to avoid implicit dependency
+
+-------------------------------------------------------------------
+Fri Sep 16 16:21:44 UTC 2011 - jmate...@suse.com
+
+- dropped newslist.py from demos because of bad license
+  (bnc#718009)
+
+-------------------------------------------------------------------
+Mon Jul 11 01:59:56 CEST 2011 - r...@suse.de
+
+- update to 2.7.2:
+  * Bug fix only release, see
+  http://hg.python.org/cpython/raw-file/eb3c9b74884c/Misc/NEWS
+  for details
+- introduce a pre_checkin.sh file that synchronizes
+  patches between python and python-base
+- rediff patches for 2.7.2
+- replace kernel3 patch with the upstream solution
+
+-------------------------------------------------------------------
+Tue May 24 14:30:10 UTC 2011 - jmate...@novell.com
+
+- updated to 2.7.1
+    * bugfix-only release
+
+-------------------------------------------------------------------
+Wed May  4 14:18:08 UTC 2011 - jmate...@novell.com
+
+- added "fix-parallel-make" patch to python main package as well,
+  because build process is the same
+
+-------------------------------------------------------------------
+Thu Feb 17 17:37:09 CET 2011 - p...@suse.de
+
+- Prefix DATE and TIME with PY_BUILD_ and COMPILER with PYTHON_ as
+  to not break external code (bnc#673071).
+
+-------------------------------------------------------------------
+Tue Aug 31 02:51:56 UTC 2010 - cristian.rodrig...@opensuse.org
+
+- Provide "fake" build enviroment information
+* build date replaced by source tarball modify date
+* compiler string replaced by "GCC"
+* This is intended to avoid republishing the packages
+  over and over again. 
+
+-------------------------------------------------------------------
+Thu Aug 26 11:42:44 UTC 2010 - jmate...@novell.com
+
+- update to 2.7
+  * see changes in python-base.changes
+- cleaned up the spec and patches
+
+-------------------------------------------------------------------
+Fri Jul  2 13:57:02 UTC 2010 - jeng...@medozas.de
+
+- add patch from http://bugs.python.org/issue6029
+- use %_smp_mflags
+
+-------------------------------------------------------------------
+Wed Apr  7 20:36:11 CEST 2010 - matej...@suse.cz
+
+- update to 2.6.5
+
+-------------------------------------------------------------------
+Wed Feb  3 16:07:54 UTC 2010 - jeng...@medozas.de
+
+- exclude dl.so from SPARC64 (not built like on x86_64)
+
+-------------------------------------------------------------------
+Fri Jan 29 15:44:28 CET 2010 - matej...@suse.cz
+
+- enabled ipv6 in configure (bnc#572673)
+
+-------------------------------------------------------------------
+Wed Dec 23 08:36:32 UTC 2009 - a...@suse.de
+
+- Apply patches with fuzz=0
+
+-------------------------------------------------------------------
+Wed Dec  2 18:40:21 UTC 2009 - co...@novell.com
+
+- update patch again
+
+-------------------------------------------------------------------
+Wed Nov  4 19:04:16 CET 2009 - matej...@suse.cz
++++ 1219 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.1:Update/.python.2949.new/python.changes

New:
----
  CVE-2014-1912-recvfrom_into.patch
  CVE-2014-4616-json-bounds-check.patch
  CVE-2014-4650-CGIHTTPServer-traversal.patch
  Python-2.7.6.tar.xz
  README.SUSE
  baselibs.conf
  libffi-ppc64le.diff
  local.pth
  macros.python
  pre_checkin.sh
  python-2.5.1-sqlite.patch
  python-2.6-gettext-plurals.patch
  python-2.6b3-curses-panel.patch
  python-2.7-dirs.patch
  python-2.7.2-disable-tests-in-test_io.patch
  python-2.7.2-fix_date_time_compiler.patch
  python-2.7.3-ssl_ca_path.patch
  python-2.7.4-aarch64.patch
  python-2.7.4-canonicalize2.patch
  python-2.7.4-no-REUSEPORT.patch
  python-2.7.5-multilib.patch
  python-2.7.6-bdist-rpm.patch
  python-2.7.6-docs-html.tar.bz2
  python-2.7.6-docs-pdf-a4.tar.bz2
  python-2.7.6-docs-pdf-letter.tar.bz2
  python-2.7.6-imaplib.patch
  python-2.7.6-poplib.patch
  python-2.7.7-mhlib-linkcount.patch
  python-base.changes
  python-base.spec
  python-bsddb6.diff
  python-bundle-lang.patch
  python-distutils-rpm-8.patch
  python-doc.changes
  python-doc.spec
  python.changes
  python.csh
  python.sh
  python.spec
  pythonstart
  remove-static-libpython.diff
  smtplib_maxline-2.7.patch
  sparc_longdouble.patch
  xmlrpc_gzip_27.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-base.spec ++++++
#
# spec file for package python-base
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python-base
Version:        2.7.6
Release:        0
Summary:        Python Interpreter base package
License:        Python-2.0
Group:          Development/Languages/Python
Url:            http://www.python.org/
%define         tarversion %{version}
%define         tarname Python-%{tarversion}
Source0:        http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
Source1:        macros.python
Source2:        baselibs.conf
Source3:        README.SUSE
Source5:        local.pth
# COMMON-PATCH-BEGIN
Patch1:         python-2.7-dirs.patch
Patch2:         python-distutils-rpm-8.patch
Patch3:         python-2.7.5-multilib.patch
Patch4:         python-2.5.1-sqlite.patch
Patch5:         python-2.7.4-canonicalize2.patch
Patch7:         python-2.6-gettext-plurals.patch
Patch8:         python-2.6b3-curses-panel.patch
Patch10:        sparc_longdouble.patch
Patch13:        python-2.7.2-fix_date_time_compiler.patch
Patch15:        python-2.7.2-disable-tests-in-test_io.patch
Patch17:        remove-static-libpython.diff
# PATCH-FIX-OPENSUSE python-2.7.3-ssl_ca_path.patch [bnc#761501] -- Support 
directory-based certificate stores with the ca_certs parameter of SSL functions
Patch18:        python-2.7.3-ssl_ca_path.patch
# PATCH-FEATURE-OPENSUSE python-bundle-lang.patch bnc#617751 
dims...@opensuse.org -- gettext: when looking in default_localedir also check 
in locale-bundle.
Patch20:        python-bundle-lang.patch
# PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module
Patch22:        python-2.7.4-aarch64.patch
Patch23:        python-2.7.4-no-REUSEPORT.patch
Patch24:        python-bsddb6.diff
# PATCH-FIX-OPENSUSE Properly support ppc64le in _ctypes module
Patch25:        libffi-ppc64le.diff
# CVE-2013-1753 [bnc#856835] unbounded gzip decompression in xmlrpc client
Patch26:        xmlrpc_gzip_27.patch
# CVE-2013-1752 patches missing in 2.7.6: imaplib, poplib, smtplib
Patch27:        python-2.7.6-imaplib.patch
Patch28:        smtplib_maxline-2.7.patch
Patch29:        python-2.7.6-poplib.patch
# [bnc#857470] add missing import to bdist_rpm command
Patch30:        python-2.7.6-bdist-rpm.patch
# CVE-2014-1912 [bnc#863741] buffer overflow in recvfrom_into
Patch31:        CVE-2014-1912-recvfrom_into.patch
# CVE-2014-4616 [bnc#884075] incorrect bounds check when parsing json
Patch32:        CVE-2014-4616-json-bounds-check.patch
# CVE-2014-4650 - File disclosure and directory traversal in CGIHTTPServer
Patch33:        CVE-2014-4650-CGIHTTPServer-traversal.patch
# remove link count optimization that breaks mhlib on btrfs (and possibly 
elsewhere)
Patch34:        python-2.7.7-mhlib-linkcount.patch
# COMMON-PATCH-END
%define         python_version    %(echo %{tarversion} | head -c 3)
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  libbz2-devel
BuildRequires:  pkg-config
BuildRequires:  xz
BuildRequires:  zlib-devel
# for the test suite
BuildRequires:  netcfg
# explicitly, see bnc#697251:
Requires:       libpython2_7-1_0 = %{version}
Provides:       %{name} = %{python_version}
# bug437293
%ifarch ppc64
Obsoletes:      python-64bit
%endif
Provides:       python-ctypes = 1.1.0
Obsoletes:      python-ctypes < 1.1.0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Python is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java.  You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.

This package contains all of stand-alone Python files, minus binary
modules that would pull in extra dependencies.

%package -n python-devel
Summary:        Include Files and Libraries Mandatory for Building Python 
Modules
Group:          Development/Languages/Python
Requires:       glibc-devel
Requires:       python = %{version}
Requires:       python-base = %{version}-%{release}

%description -n python-devel
The Python programming language's interpreter can be extended with
dynamically loaded extensions and can be embedded in other programs.

This package contains header files, a static library, and development
tools for building Python modules, extending the Python interpreter or
embedding Python in applications.

%package -n python-xml
Summary:        A Python XML Interface
Group:          Development/Libraries/Python
Requires:       python-base = %{version}-%{release}
# pyxml used to live out of tree
Provides:       pyxml = 0.8.5
Obsoletes:      pyxml < 0.8.5

%description -n python-xml
The expat module is a Python interface to the expat XML parser. Since
Python2.x, it is part of the core Python distribution.

%package -n libpython2_7-1_0
Summary:        Python Interpreter shared library
Group:          Development/Languages/Python

%description -n libpython2_7-1_0
Python is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java.  You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.

This package contains libpython2.7 shared library for embedding in
other applications.

%prep
%setup -q -n %{tarname}
# patching
# COMMON-PREP-BEGIN
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch10 -p1
%patch13 -p1
#skip test_io test for ppc,ppc64 as it is broken.
%ifarch ppc ppc64 ppc64le
%patch15 -p1
%endif
%patch17 -p1
%patch18 -p1
%patch20 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p0
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1

# drop Autoconf version requirement
sed -i 's/^version_required/dnl version_required/' configure.ac
# COMMON-PREP-END

%build
export OPT="%{optflags} -DOPENSSL_LOAD_CONF"

autoreconf -f -i . # Modules/_ctypes/libffi

# provide a stable timestamp
touch -r %{SOURCE0} Makefile.pre.in

# prevent make from trying to rebuild asdl stuff, which requires existing
# python installation
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h

%configure \
    --docdir=%{_docdir}/python \
    --with-fpectl \
    --enable-ipv6 \
    --enable-shared \
    --enable-unicode=ucs4

LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
    make %{?_smp_mflags} profile-opt

%check
# on hppa, the threading of glibc is quite broken. The tests just stop
# at some point, and the machine does not build anything more until a
# timeout several hours later.
%ifnarch hppa
# test_file(2k) fails in autobuild env - "stdin.seek(-1)" wrongly succeeds. 
probably an issue with autobuild's stdin
# test_urllib2 relies on being able to resolve local address, which is 
notoriously impossible in autobuild
EXCLUDE="-x test_urllib2 -x test_file -x test_file2k"
# test_nis and test_threading are AWFULLY slow.
EXCLUDE="$EXCLUDE -x test_nis -x test_threading"
# test_gdb fails if gdb with (different) python support is part of the 
buildsystem
EXCLUDE="$EXCLUDE -x test_gdb"
%ifarch ia64
# test_smtplib's testSend is known to be broken and on ia64 it actually fails 
most of the time, preventing the build.
EXCLUDE="$EXCLUDE -x test_smtplib"
%endif
# test_unicode fails in Factory
EXCLUDE="$EXCLUDE -x test_unicode"
%if 0%{?qemu_user_space_build}
# test_asyncore fails because of unimplemented sockopt
EXCLUDE="$EXCLUDE -x test_asyncore -x test_mmap"
# emulation is unreliable
EXCLUDE="$EXCLUDE -x test_multiprocessing"
%endif

# This test (part of test_uuid) requires real network interfaces
# so that ifconfig output has "HWaddr <something>".  Some kvm instances
# don't have any such interface breaking the uuid module test.
EXCLUDE="$EXCLUDE -x test_uuid"

# Limit virtual memory to avoid spurious failures
if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then
  ulimit -v 10000000 || :
fi
make test TESTOPTS="-l $EXCLUDE" TESTPYTHONOPTS="-R"
# use network, be verbose:
#make test TESTOPTS="-l -u network -v"
%endif

%install
# replace rest of /usr/local/bin/python or /usr/bin/python2.5 with 
/usr/bin/python
find . -wholename "./Parser" -prune -o -name '*.py' -type f -print0 | xargs -0 
grep -lE '^#! *(/usr/.*bin/(env +)?)?python' | xargs sed -r -i -e 
'1s@^#![[:space:]]*(/usr/(local/)?bin/(env 
+)?)?python([0-9]+\.[0-9]+)?@#!/usr/bin/python@'
# the grep inbetween makes it much faster
########################################
# install it
########################################
%make_install OPT="%{optflags} -fPIC"
install -m 644 %{SOURCE5} 
%{buildroot}%{_libdir}/python%{python_version}/site-packages/_local.pth
install -d -m 755 %{buildroot}%{_sysconfdir}/rpm
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm
# make sure /usr/lib/python/site-packages exists even on lib64 machines
mkdir -p %{buildroot}%{_prefix}/lib/python%{python_version}/site-packages
########################################
# some cleanups
########################################
# remove hard links and replace them with symlinks
for dir in bin include %{_lib} ; do
    rm -f %{buildroot}/%{_prefix}/$dir/python
    ln -s python%{python_version} %{buildroot}/%{_prefix}/$dir/python
done
CLEANUP_DIR="%{buildroot}%{_libdir}/python%{python_version}"
# don't distribute precompiled windows installers (duh)
rm -f $CLEANUP_DIR/distutils/command/*.exe
# kill imageop.so - it used to be insecure and it is deprecated anyway
rm -f $CLEANUP_DIR/lib-dynload/imageop.so
# link shared library instead of static library that tools expect
ln -s ../../libpython%{python_version}.so 
%{buildroot}%{_libdir}/python%{python_version}/config/libpython%{python_version}.so
# remove various things that don't need to be in python-base
rm %{buildroot}%{_bindir}/idle
rm -rf $CLEANUP_DIR/{curses,bsddb,idlelib,lib-tk,sqlite3}
rm $CLEANUP_DIR/ssl.py*
#        does not work without _ssl.so anyway
# replace duplicate .pyo/.pyc with hardlinks
%fdupes %{buildroot}/%{_libdir}/python%{python_version}
########################################
# documentation
########################################
export PDOCS=%{buildroot}%{_docdir}/%{name}
install -d -m 755 $PDOCS
install -c -m 644 %{SOURCE3}                        $PDOCS/
install -c -m 644 LICENSE                           $PDOCS/
install -c -m 644 README                            $PDOCS/
ln -s python%{python_version}.1.gz %{buildroot}%{_mandir}/man1/python.1.gz
########################################
# devel
########################################
# install Makefile.pre.in and Makefile.pre
cp Makefile Makefile.pre.in Makefile.pre 
%{buildroot}%{_libdir}/python%{python_version}/config/

%post -n libpython2_7-1_0 -p %{run_ldconfig}
%postun -n libpython2_7-1_0 -p %{run_ldconfig}

%files -n python-devel
%defattr(-, root, root)
%{_libdir}/python%{python_version}/config/*
%exclude %{_libdir}/python%{python_version}/config/Setup
%exclude %{_libdir}/python%{python_version}/config/Makefile
%defattr(644, root, root, 755)
%{_libdir}/libpython*.so
%{_libdir}/pkgconfig/python-%{python_version}.pc
%{_libdir}/pkgconfig/python.pc
%{_libdir}/pkgconfig/python2.pc
%{_includedir}/python*
%exclude %{_includedir}/python%{python_version}/pyconfig.h
%{_libdir}/python%{python_version}/test
%defattr(755, root, root)
%{_bindir}/python-config
%{_bindir}/python2-config
%{_bindir}/python%{python_version}-config

%files -n python-xml
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/xml
%{_libdir}/python%{python_version}/lib-dynload/pyexpat.so

%files -n libpython2_7-1_0
%defattr(644, root, root)
%{_libdir}/libpython*.so.*

%files
%defattr(644, root, root, 755)
%config %{_sysconfdir}/rpm/macros.python
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/README
%doc %{_docdir}/%{name}/LICENSE
%doc %{_docdir}/%{name}/README.SUSE
%doc %{_mandir}/man1/python.1*
%doc %{_mandir}/man1/python2.1*
%doc %{_mandir}/man1/python%{python_version}.1*
%dir %{_includedir}/python%{python_version}
%{_includedir}/python%{python_version}/pyconfig.h
%{_libdir}/python
%dir %{_prefix}/lib/python%{python_version}
%dir %{_prefix}/lib/python%{python_version}/site-packages
%dir %{_libdir}/python%{python_version}
%dir %{_libdir}/python%{python_version}/config
%{_libdir}/python%{python_version}/config/Setup
%{_libdir}/python%{python_version}/config/Makefile
%{_libdir}/python%{python_version}/*.*
%{_libdir}/python%{python_version}/compiler
%{_libdir}/python%{python_version}/ctypes
%{_libdir}/python%{python_version}/distutils
%{_libdir}/python%{python_version}/email
%{_libdir}/python%{python_version}/encodings
%{_libdir}/python%{python_version}/hotshot
%{_libdir}/python%{python_version}/importlib
%{_libdir}/python%{python_version}/json
%{_libdir}/python%{python_version}/lib2to3
%{_libdir}/python%{python_version}/logging
%{_libdir}/python%{python_version}/multiprocessing
%{_libdir}/python%{python_version}/plat-*
%{_libdir}/python%{python_version}/pydoc_data
%{_libdir}/python%{python_version}/unittest
%{_libdir}/python%{python_version}/wsgiref
%dir %{_libdir}/python%{python_version}/site-packages
%{_libdir}/python%{python_version}/site-packages/README
%{_libdir}/python%{python_version}/site-packages/_local.pth
%dir %{_libdir}/python%{python_version}/lib-dynload
%{_libdir}/python%{python_version}/lib-dynload/_bisect.so
#%%{_libdir}/python%%{python_version}/lib-dynload/_bytesio.so
%{_libdir}/python%{python_version}/lib-dynload/_csv.so
%{_libdir}/python%{python_version}/lib-dynload/_collections.so
%{_libdir}/python%{python_version}/lib-dynload/_ctypes.so
%{_libdir}/python%{python_version}/lib-dynload/_ctypes_test.so
%{_libdir}/python%{python_version}/lib-dynload/_elementtree.so
#%%{_libdir}/python%%{python_version}/lib-dynload/_fileio.so
%{_libdir}/python%{python_version}/lib-dynload/_functools.so
%{_libdir}/python%{python_version}/lib-dynload/_heapq.so
%{_libdir}/python%{python_version}/lib-dynload/_hotshot.so
%{_libdir}/python%{python_version}/lib-dynload/_io.so
%{_libdir}/python%{python_version}/lib-dynload/_json.so
%{_libdir}/python%{python_version}/lib-dynload/_locale.so
%{_libdir}/python%{python_version}/lib-dynload/_lsprof.so
%{_libdir}/python%{python_version}/lib-dynload/_md5.so
%{_libdir}/python%{python_version}/lib-dynload/_multiprocessing.so
%{_libdir}/python%{python_version}/lib-dynload/_random.so
%{_libdir}/python%{python_version}/lib-dynload/_sha.so
%{_libdir}/python%{python_version}/lib-dynload/_sha256.so
%{_libdir}/python%{python_version}/lib-dynload/_sha512.so
%{_libdir}/python%{python_version}/lib-dynload/_socket.so
%{_libdir}/python%{python_version}/lib-dynload/_struct.so
%{_libdir}/python%{python_version}/lib-dynload/_testcapi.so
%{_libdir}/python%{python_version}/lib-dynload/array.so
%{_libdir}/python%{python_version}/lib-dynload/audioop.so
%{_libdir}/python%{python_version}/lib-dynload/binascii.so
%{_libdir}/python%{python_version}/lib-dynload/bz2.so
%{_libdir}/python%{python_version}/lib-dynload/cPickle.so
%{_libdir}/python%{python_version}/lib-dynload/cStringIO.so
%{_libdir}/python%{python_version}/lib-dynload/cmath.so
%{_libdir}/python%{python_version}/lib-dynload/crypt.so
%{_libdir}/python%{python_version}/lib-dynload/datetime.so
%{_libdir}/python%{python_version}/lib-dynload/fcntl.so
%{_libdir}/python%{python_version}/lib-dynload/future_builtins.so
%{_libdir}/python%{python_version}/lib-dynload/grp.so
%{_libdir}/python%{python_version}/lib-dynload/itertools.so
%{_libdir}/python%{python_version}/lib-dynload/linuxaudiodev.so
%{_libdir}/python%{python_version}/lib-dynload/math.so
%{_libdir}/python%{python_version}/lib-dynload/mmap.so
%{_libdir}/python%{python_version}/lib-dynload/nis.so
%{_libdir}/python%{python_version}/lib-dynload/operator.so
%{_libdir}/python%{python_version}/lib-dynload/ossaudiodev.so
%{_libdir}/python%{python_version}/lib-dynload/parser.so
%{_libdir}/python%{python_version}/lib-dynload/resource.so
%{_libdir}/python%{python_version}/lib-dynload/select.so
%{_libdir}/python%{python_version}/lib-dynload/spwd.so
%{_libdir}/python%{python_version}/lib-dynload/strop.so
%{_libdir}/python%{python_version}/lib-dynload/syslog.so
%{_libdir}/python%{python_version}/lib-dynload/termios.so
%{_libdir}/python%{python_version}/lib-dynload/time.so
%{_libdir}/python%{python_version}/lib-dynload/unicodedata.so
%{_libdir}/python%{python_version}/lib-dynload/zlib.so
%{_libdir}/python%{python_version}/lib-dynload/_codecs*.so
%{_libdir}/python%{python_version}/lib-dynload/_multibytecodec.so
%{_libdir}/python%{python_version}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info
# these modules don't support 64-bit arches (disabled by setup.py)
%ifnarch alpha ia64 x86_64 s390x ppc64 ppc64le sparc64 aarch64
# requires sizeof(int) == sizeof(long) == sizeof(char*)
%{_libdir}/python%{python_version}/lib-dynload/dl.so
%endif
%attr(755, root, root) %{_bindir}/pydoc
%attr(755, root, root) %{_bindir}/python
%attr(755, root, root) %{_bindir}/python%{python_version}
%attr(755, root, root) %{_bindir}/smtpd.py
%{_bindir}/python2
%exclude %{_bindir}/2to3

%changelog
++++++ python-doc.spec ++++++
#
# spec file for package python-doc
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python-doc
Version:        2.7.6
Release:        0
Summary:        Additional Package Documentation for Python
License:        Python-2.0
Group:          Development/Languages/Python
Url:            http://www.python.org/
%define         tarname Python-%{version}
Source0:        %{tarname}.tar.xz
# docs for current version are regenerated every day
# this messes with autobuild "file changed" checks
#Source1:        
http://docs.python.org/%{version}/archives/python-%{pyver}-docs-html.tar.bz2
#Source2:        
http://docs.python.org/%{version}/archives/python-%{pyver}-docs-pdf-a4.tar.bz2
#Source3:        
http://docs.python.org/%{version}/archives/python-%{pyver}-docs-pdf-letter.tar.bz2
Source1:        python-%{version}-docs-html.tar.bz2
Source2:        python-%{version}-docs-pdf-a4.tar.bz2
Source3:        python-%{version}-docs-pdf-letter.tar.bz2
%if 0%{suse_version} <= 1210
BuildRequires:  xz
%endif
# COMMON-PATCH-BEGIN
Patch1:         python-2.7-dirs.patch
Patch2:         python-distutils-rpm-8.patch
Patch3:         python-2.7.5-multilib.patch
Patch4:         python-2.5.1-sqlite.patch
Patch5:         python-2.7.4-canonicalize2.patch
Patch7:         python-2.6-gettext-plurals.patch
Patch8:         python-2.6b3-curses-panel.patch
Patch10:        sparc_longdouble.patch
Patch13:        python-2.7.2-fix_date_time_compiler.patch
Patch15:        python-2.7.2-disable-tests-in-test_io.patch
Patch17:        remove-static-libpython.diff
# PATCH-FIX-OPENSUSE python-2.7.3-ssl_ca_path.patch [bnc#761501] -- Support 
directory-based certificate stores with the ca_certs parameter of SSL functions
Patch18:        python-2.7.3-ssl_ca_path.patch
# PATCH-FEATURE-OPENSUSE python-bundle-lang.patch bnc#617751 
dims...@opensuse.org -- gettext: when looking in default_localedir also check 
in locale-bundle.
Patch20:        python-bundle-lang.patch
# PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module
Patch22:        python-2.7.4-aarch64.patch
Patch23:        python-2.7.4-no-REUSEPORT.patch
Patch24:        python-bsddb6.diff
# PATCH-FIX-OPENSUSE Properly support ppc64le in _ctypes module
Patch25:        libffi-ppc64le.diff
# CVE-2013-1753 [bnc#856835] unbounded gzip decompression in xmlrpc client
Patch26:        xmlrpc_gzip_27.patch
# CVE-2013-1752 patches missing in 2.7.6: imaplib, poplib, smtplib
Patch27:        python-2.7.6-imaplib.patch
Patch28:        smtplib_maxline-2.7.patch
Patch29:        python-2.7.6-poplib.patch
# [bnc#857470] add missing import to bdist_rpm command
Patch30:        python-2.7.6-bdist-rpm.patch
# CVE-2014-1912 [bnc#863741] buffer overflow in recvfrom_into
Patch31:        CVE-2014-1912-recvfrom_into.patch
# CVE-2014-4616 [bnc#884075] incorrect bounds check when parsing json
Patch32:        CVE-2014-4616-json-bounds-check.patch
# CVE-2014-4650 - File disclosure and directory traversal in CGIHTTPServer
Patch33:        CVE-2014-4650-CGIHTTPServer-traversal.patch
# remove link count optimization that breaks mhlib on btrfs (and possibly 
elsewhere)
Patch34:        python-2.7.7-mhlib-linkcount.patch
# COMMON-PATCH-END
Provides:       pyth_doc
Provides:       pyth_ps
Obsoletes:      pyth_doc
Obsoletes:      pyth_ps
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Enhances:       python = %{version}

%description
Tutorial, Global Module Index, Language Reference, Library Reference,
Extending and Embedding Reference, Python/C API Reference, Documenting
Python, and Macintosh Module Reference in HTML format.

%package pdf
Summary:        Python PDF Documentation
Group:          Development/Languages/Python
Provides:       pyth_pdf
Obsoletes:      pyth_pdf

%description pdf
Tutorial, Global Module Index, Language Reference, Library Reference,
Extending and Embedding Reference, Python/C API Reference, Documenting
Python, and Macintosh Module Reference in PDF format.

%prep
%setup -q -n %{tarname}
# COMMON-PREP-BEGIN
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch10 -p1
%patch13 -p1
#skip test_io test for ppc,ppc64 as it is broken.
%ifarch ppc ppc64 ppc64le
%patch15 -p1
%endif
%patch17 -p1
%patch18 -p1
%patch20 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p0
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1

# drop Autoconf version requirement
sed -i 's/^version_required/dnl version_required/' configure.ac
# COMMON-PREP-END

%build
# nothing to do (...whistles innocently)

%install
export PDOCS=%{buildroot}%{_docdir}/python
install -d -m 755 $PDOCS/Misc
tar xfj %{SOURCE1} -C $PDOCS/
mv $PDOCS/python-%{version}-docs-html $PDOCS/html
tar xfj %{SOURCE2} -C $PDOCS
mv $PDOCS/docs-pdf $PDOCS/paper-a4
tar xfj %{SOURCE3} -C $PDOCS
mv $PDOCS/docs-pdf $PDOCS/paper-letter
# this is part of main package
#install -c -m 644 README $PDOCS/README 
for i in Misc/* ; do
  [ -f $i ] && install -c -m 644 $i $PDOCS/Misc/
done

%files
%defattr(644,root,root,755)
%dir %{_docdir}/python
%doc %{_docdir}/python/Misc
%doc %{_docdir}/python/html
#%doc %{_docdir}/python/README

%files pdf
%defattr(644,root,root,755)
%doc %{_docdir}/python/paper-a4
%doc %{_docdir}/python/paper-letter

%changelog
++++++ python.spec ++++++
#
# spec file for package python
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python
Version:        2.7.6
Release:        0
Summary:        Python Interpreter
License:        Python-2.0
Group:          Development/Languages/Python
Url:            http://www.python.org/
%define         tarversion %{version}
%define         tarname Python-%{tarversion}
Source0:        http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
Source1:        README.SUSE
Source2:        pythonstart
Source3:        python.sh
Source4:        python.csh
#Source11:       testfiles.tar.bz2
# issues with copyrighted Unicode testing files

# !!!!!!!!!!!!!!
# do not add or edit patches here. please edit python-base.spec
# instead and run pre_checkin.sh
# !!!!!!!!!!!!!!
# COMMON-PATCH-BEGIN
Patch1:         python-2.7-dirs.patch
Patch2:         python-distutils-rpm-8.patch
Patch3:         python-2.7.5-multilib.patch
Patch4:         python-2.5.1-sqlite.patch
Patch5:         python-2.7.4-canonicalize2.patch
Patch7:         python-2.6-gettext-plurals.patch
Patch8:         python-2.6b3-curses-panel.patch
Patch10:        sparc_longdouble.patch
Patch13:        python-2.7.2-fix_date_time_compiler.patch
Patch15:        python-2.7.2-disable-tests-in-test_io.patch
Patch17:        remove-static-libpython.diff
# PATCH-FIX-OPENSUSE python-2.7.3-ssl_ca_path.patch [bnc#761501] -- Support 
directory-based certificate stores with the ca_certs parameter of SSL functions
Patch18:        python-2.7.3-ssl_ca_path.patch
# PATCH-FEATURE-OPENSUSE python-bundle-lang.patch bnc#617751 
dims...@opensuse.org -- gettext: when looking in default_localedir also check 
in locale-bundle.
Patch20:        python-bundle-lang.patch
# PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module
Patch22:        python-2.7.4-aarch64.patch
Patch23:        python-2.7.4-no-REUSEPORT.patch
Patch24:        python-bsddb6.diff
# PATCH-FIX-OPENSUSE Properly support ppc64le in _ctypes module
Patch25:        libffi-ppc64le.diff
# CVE-2013-1753 [bnc#856835] unbounded gzip decompression in xmlrpc client
Patch26:        xmlrpc_gzip_27.patch
# CVE-2013-1752 patches missing in 2.7.6: imaplib, poplib, smtplib
Patch27:        python-2.7.6-imaplib.patch
Patch28:        smtplib_maxline-2.7.patch
Patch29:        python-2.7.6-poplib.patch
# [bnc#857470] add missing import to bdist_rpm command
Patch30:        python-2.7.6-bdist-rpm.patch
# CVE-2014-1912 [bnc#863741] buffer overflow in recvfrom_into
Patch31:        CVE-2014-1912-recvfrom_into.patch
# CVE-2014-4616 [bnc#884075] incorrect bounds check when parsing json
Patch32:        CVE-2014-4616-json-bounds-check.patch
# CVE-2014-4650 - File disclosure and directory traversal in CGIHTTPServer
Patch33:        CVE-2014-4650-CGIHTTPServer-traversal.patch
# remove link count optimization that breaks mhlib on btrfs (and possibly 
elsewhere)
Patch34:        python-2.7.7-mhlib-linkcount.patch
# COMMON-PATCH-END
BuildRequires:  automake
BuildRequires:  db-devel
BuildRequires:  fdupes
BuildRequires:  gdbm-devel
BuildRequires:  gmp-devel
BuildRequires:  libbz2-devel
BuildRequires:  libopenssl-devel
BuildRequires:  ncurses-devel
BuildRequires:  readline-devel
BuildRequires:  sqlite-devel
BuildRequires:  tk-devel
BuildRequires:  xorg-x11-devel
BuildRequires:  xz
%define         python_version    %(echo %{tarversion} | head -c 3)
%define         idle_name         idle
Requires:       python-base = %{version}
Provides:       %{name} = %{python_version}
Obsoletes:      python-elementtree
Obsoletes:      python-nothreads
Obsoletes:      python-sqlite
Obsoletes:      python21
# bug437293
%ifarch ppc64
Obsoletes:      python-64bit
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Python is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java.  You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.

If you want to install third party modules using distutils, you need to
install python-devel package.

%package idle
Summary:        An Integrated Development Environment for Python
Group:          Development/Languages/Python
Requires:       python-base = %{version}
Requires:       python-tk

%description idle
IDLE is a Tkinter based integrated development environment for Python.
It features a multi-window text editor with multiple undo, Python
colorizing, and many other things, as well as a Python shell window and
a debugger.

%package demo
Summary:        Python Demonstration Scripts
Group:          Development/Languages/Python
Requires:       python-base = %{version}
Provides:       pyth_dmo
Obsoletes:      pyth_dmo

%description demo
Various demonstrations of what you can do with Python and a number of
programs that are useful for building or extending Python.

%package tk
Summary:        TkInter - Python Tk Interface
Group:          Development/Libraries/Python
Requires:       python-base = %{version}
Provides:       pyth_tk
Provides:       pyth_tkl
Provides:       python-tkinter
Provides:       python_tkinter_lib
#%ifarch %ix86
#Provides:       _tkinter.so
#%endif
Obsoletes:      pyth_tk
Obsoletes:      pyth_tkl
Obsoletes:      python-tkinter

%description tk
Python interface to Tk. Tk is the GUI toolkit that comes with Tcl. The
"xrpm" package uses this Python interface.

%package curses
Summary:        Python Interface to the (N)Curses Library
Group:          Development/Libraries/Python
Requires:       python-base = %{version}
Obsoletes:      pyth_cur
Provides:       pyth_cur

%description curses
An easy to use interface to the (n)curses CUI library. CUI stands for
Console User Interface.

%package gdbm
Summary:        Python Interface to the GDBM Library
Group:          Development/Libraries/Python
Requires:       python-base = %{version}
Obsoletes:      pygdmod
Provides:       pygdmod

%description gdbm
An easy to use interface for GDBM databases. GDBM is the GNU
implementation of the standard Unix DBM databases.

%prep
%setup -q -n %{tarname}
# COMMON-PREP-BEGIN
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch10 -p1
%patch13 -p1
#skip test_io test for ppc,ppc64 as it is broken.
%ifarch ppc ppc64 ppc64le
%patch15 -p1
%endif
%patch17 -p1
%patch18 -p1
%patch20 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p0
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1

# drop Autoconf version requirement
sed -i 's/^version_required/dnl version_required/' configure.ac
# COMMON-PREP-END

# remove newslist.py because of bad license
rm Demo/scripts/newslist.*

%build
# necessary for correct linking with GDBM:
export SUSE_ASNEEDED=0

export OPT="%{optflags} -DOPENSSL_LOAD_CONF"

autoreconf -f -i . # Modules/_ctypes/libffi
# prevent make from trying to rebuild asdl stuff, which requires existing
# python installation
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h

%configure \
    --docdir=%{_docdir}/python \
    --enable-ipv6 \
    --with-fpectl \
    --enable-shared \
    --enable-unicode=ucs4

make %{?_smp_mflags}

%check
# on hppa, the threading of glibc is quite broken. The tests just stop
# at some point, and the machine does not build anything more until a
# timeout several hours later.
%ifnarch hppa
# Limit virtual memory to avoid spurious failures
if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then
  ulimit -v 10000000 || :
fi
LIST="test_urllib test_ssl test_hashlib test_hmac test_urllib2_localnet 
test_unicodedata test_tarfile test_sqlite test_tcl test_dbm test_anydbm 
test_dumbdbm test_gdbm test_whichdb test_tk test_ttk_textonly test_bsddb 
test_bsddb3 test_readline"
make test TESTOPTS="$LIST" TESTPYTHONOPTS="-R"
%endif

%install
# replace rest of /usr/local/bin/python or /usr/bin/python2.x with 
/usr/bin/python
find . -wholename "./Parser" -prune -o -name '*.py' -type f -print0 | xargs -0 
grep -lE '^#! *(/usr/.*bin/(env +)?)?python' | xargs sed -r -i -e 
'1s@^#![[:space:]]*(/usr/(local/)?bin/(env 
+)?)?python([0-9]+\.[0-9]+)?@#!/usr/bin/python@'
# the grep inbetween makes it much faster
########################################
# install it
########################################
%make_install OPT="%{optflags} -fPIC"
########################################
# some cleanups
########################################
# remove hard links and replace them with symlinks
for dir in bin include %{_lib} ; do
    rm -f %{buildroot}/%{_prefix}/$dir/python
    ln -s python%{python_version} %{buildroot}/%{_prefix}/$dir/python
done
# kill imageop.so, it's insecure
rm -f %{buildroot}/%{_libdir}/python%{python_version}/lib-dynload/imageop.so
#cleanup for -base
rm %{buildroot}%{_bindir}/python%{python_version}
rm %{buildroot}%{_bindir}/python2
rm %{buildroot}%{_bindir}/python
rm %{buildroot}%{_bindir}/smtpd.py
rm %{buildroot}%{_bindir}/pydoc
rm %{buildroot}%{_bindir}/2to3
rm %{buildroot}%{_mandir}/man1/python*
rm %{buildroot}%{_libdir}/libpython*.so.*
rm %{buildroot}%{_libdir}/python
find %{buildroot}%{_libdir}/python%{python_version} -maxdepth 1 ! \( -name 
"ssl.py" \) -exec rm {} ";"
rm %{buildroot}%{_bindir}/python%{python_version}-config
rm %{buildroot}%{_bindir}/python2-config
rm %{buildroot}%{_bindir}/python-config
rm %{buildroot}%{_libdir}/pkgconfig/*
rm -r %{buildroot}%{_includedir}/python
rm -r %{buildroot}%{_includedir}/python%{python_version}
rm -r %{buildroot}%{_libdir}/python%{python_version}/compiler
rm -r %{buildroot}%{_libdir}/python%{python_version}/config
rm -r %{buildroot}%{_libdir}/python%{python_version}/ctypes
rm -r %{buildroot}%{_libdir}/python%{python_version}/distutils
rm -r %{buildroot}%{_libdir}/python%{python_version}/email
rm -r %{buildroot}%{_libdir}/python%{python_version}/encodings
rm -r %{buildroot}%{_libdir}/python%{python_version}/hotshot
rm -r %{buildroot}%{_libdir}/python%{python_version}/importlib
rm -r %{buildroot}%{_libdir}/python%{python_version}/json
rm -r %{buildroot}%{_libdir}/python%{python_version}/lib2to3
rm -r %{buildroot}%{_libdir}/python%{python_version}/logging
rm -r %{buildroot}%{_libdir}/python%{python_version}/multiprocessing
rm -r %{buildroot}%{_libdir}/python%{python_version}/plat-*
rm -r %{buildroot}%{_libdir}/python%{python_version}/pydoc_data
rm -r %{buildroot}%{_libdir}/python%{python_version}/test
rm -r %{buildroot}%{_libdir}/python%{python_version}/unittest
rm -r %{buildroot}%{_libdir}/python%{python_version}/wsgiref
rm -r %{buildroot}%{_libdir}/python%{python_version}/xml
rm %{buildroot}%{_libdir}/libpython%{python_version}.so
rm %{buildroot}%{_libdir}/python%{python_version}/site-packages/README
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_bisect.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_csv.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_collections.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_ctypes.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_ctypes_test.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_elementtree.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_functools.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_heapq.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_hotshot.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_io.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_json.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_locale.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_lsprof.so
rm 
%{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_multiprocessing.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_random.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_socket.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_struct.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_testcapi.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/array.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/binascii.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/bz2.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/cPickle.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/cStringIO.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/cmath.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/crypt.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/datetime.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/fcntl.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/future_builtins.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/grp.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/itertools.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/linuxaudiodev.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/math.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/mmap.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/nis.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/operator.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/ossaudiodev.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/parser.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/pyexpat.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/resource.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/select.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/spwd.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/strop.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/syslog.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/termios.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/time.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/unicodedata.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/zlib.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_codecs*.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/_multibytecodec.so
rm %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/audioop.so
rm -f %{buildroot}%{_libdir}/python%{python_version}/lib-dynload/dl.so
rm 
%{buildroot}%{_libdir}/python%{python_version}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info
# replace duplicate .pyo/.pyc with hardlinks
%fdupes %{buildroot}/%{_libdir}/python%{python_version}
########################################
# documentation
########################################
export PDOCS=%{buildroot}%{_docdir}/%{name}
install -d -m 755 $PDOCS
install -c -m 644 %{SOURCE1}                        $PDOCS/
install -c -m 644 LICENSE                           $PDOCS/
install -c -m 644 README                            $PDOCS/
########################################
# tools and demos
########################################
find Tools/ Demo/ -type d \( -regex ".*/.cvsignore" \) -exec rm -f \{\} \;
for x in `find Tools/ Demo/ \( -not -name Makefile \) -print | sort` ; do
  test -d $x && ( install -c -m 755 -d $PDOCS/$x ) \
             || ( install -c -m 644 $x $PDOCS/$x )
done
########################################
# idle
########################################
# move idle config into /etc
install -d -m755 %{buildroot}%{_sysconfdir}/%{idle_name}
(
    cd %{buildroot}/%{_libdir}/python%{python_version}/idlelib/
    for file in *.def ; do
        mv $file %{buildroot}%{_sysconfdir}/%{idle_name}/
        ln -sf /etc/%{idle_name}/$file  
%{buildroot}/%{_libdir}/python%{python_version}/idlelib/
    done
)
########################################
# startup script
########################################
install -m 644 %{SOURCE2} %{buildroot}/etc
install -d -m 755 %{buildroot}%{_sysconfdir}/profile.d
install -m 644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files idle
%defattr(644, root, root, 755)
%dir %{_sysconfdir}/%{idle_name}
%config %{_sysconfdir}/%{idle_name}/*
%doc Lib/idlelib/NEWS.txt
%doc Lib/idlelib/README.txt
%doc Lib/idlelib/TODO.txt
%doc Lib/idlelib/extend.txt
%doc Lib/idlelib/ChangeLog
%{_libdir}/python%{python_version}/idlelib
%attr(755, root, root) %{_bindir}/%{idle_name}

%files demo
%defattr(644, root, root, 755)
%doc %{_docdir}/%{name}/Demo
%doc %{_docdir}/%{name}/Tools

%files tk
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/lib-tk/
%{_libdir}/python%{python_version}/lib-dynload/_tkinter.so

%files curses
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/curses
%{_libdir}/python%{python_version}/lib-dynload/_curses.so
%{_libdir}/python%{python_version}/lib-dynload/_curses_panel.so

%files gdbm
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/lib-dynload/gdbm.so
%{_libdir}/python%{python_version}/lib-dynload/dbm.so

%files
%defattr(644, root, root, 755)
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/README
%doc %{_docdir}/%{name}/LICENSE
%doc %{_docdir}/%{name}/README.SUSE
%config %{_sysconfdir}/pythonstart
%config %{_sysconfdir}/profile.d/python.*
%dir %{_libdir}/python%{python_version}
%{_libdir}/python%{python_version}/ssl.py*
%{_libdir}/python%{python_version}/bsddb
%{_libdir}/python%{python_version}/sqlite3
%dir %{_libdir}/python%{python_version}/lib-dynload
%{_libdir}/python%{python_version}/lib-dynload/_bsddb.so
%{_libdir}/python%{python_version}/lib-dynload/_hashlib.so
%{_libdir}/python%{python_version}/lib-dynload/_sqlite3.so
%{_libdir}/python%{python_version}/lib-dynload/_ssl.so
%{_libdir}/python%{python_version}/lib-dynload/readline.so

%changelog
++++++ CVE-2014-1912-recvfrom_into.patch ++++++

# HG changeset patch
# User Benjamin Peterson <benja...@python.org>
# Date 1389671978 18000
# Node ID 87673659d8f7ba1623cd4914f09ad3d2ade034e9
# Parent  2631d33ee7fbd5f0288931ef37872218d511d2e8
complain when nbytes > buflen to fix possible buffer overflow (closes #20246)

Index: Python-2.7.6/Lib/test/test_socket.py
===================================================================
--- Python-2.7.6.orig/Lib/test/test_socket.py   2013-11-10 08:36:40.000000000 
+0100
+++ Python-2.7.6/Lib/test/test_socket.py        2014-02-13 18:04:12.710244327 
+0100
@@ -1616,6 +1616,16 @@
 
     _testRecvFromIntoMemoryview = _testRecvFromIntoArray
 
+    def testRecvFromIntoSmallBuffer(self):
+        # See issue #20246.
+        buf = bytearray(8)
+        self.assertRaises(ValueError, self.cli_conn.recvfrom_into, buf, 1024)
+
+    def _testRecvFromIntoSmallBuffer(self):
+        with test_support.check_py3k_warnings():
+            buf = buffer(MSG)
+        self.serv_conn.send(buf)
+
 
 TIPC_STYPE = 2000
 TIPC_LOWER = 200
Index: Python-2.7.6/Misc/ACKS
===================================================================
--- Python-2.7.6.orig/Misc/ACKS 2013-11-10 08:36:41.000000000 +0100
+++ Python-2.7.6/Misc/ACKS      2014-02-13 18:04:12.710244327 +0100
@@ -973,6 +973,7 @@
 Christopher Smith
 Gregory P. Smith
 Roy Smith
+Ryan Smith-Roberts
 Rafal Smotrzyk
 Dirk Soede
 Paul Sokolovsky
Index: Python-2.7.6/Modules/socketmodule.c
===================================================================
--- Python-2.7.6.orig/Modules/socketmodule.c    2013-11-10 08:36:41.000000000 
+0100
+++ Python-2.7.6/Modules/socketmodule.c 2014-02-13 18:04:12.711244332 +0100
@@ -2742,6 +2742,10 @@
     if (recvlen == 0) {
         /* If nbytes was not specified, use the buffer's length */
         recvlen = buflen;
+    } else if (recvlen > buflen) {
+        PyErr_SetString(PyExc_ValueError,
+                        "nbytes is greater than the length of the buffer");
+        goto error;
     }
 
     readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr);
++++++ CVE-2014-4616-json-bounds-check.patch ++++++

# HG changeset patch
# User Benjamin Peterson <benja...@python.org>
# Date 1397441438 14400
# Node ID 50c07ed1743da9cd4540d83de0c30bd17aeb41b0
# Parent  218e28a935ab4494d05215c243e2129625a71893
in scan_once, prevent the reading of arbitrary memory when passed a negative 
index

Bug reported by Guido Vranken.

Index: Python-2.7.6/Lib/json/tests/test_decode.py
===================================================================
--- Python-2.7.6.orig/Lib/json/tests/test_decode.py     2014-06-26 
18:40:10.825269130 +0200
+++ Python-2.7.6/Lib/json/tests/test_decode.py  2014-06-26 18:40:21.962323035 
+0200
@@ -60,5 +60,10 @@
         msg = 'escape'
         self.assertRaisesRegexp(ValueError, msg, self.loads, s)
 
+    def test_negative_index(self):
+        d = self.json.JSONDecoder()
+        self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000)
+        self.assertRaises(ValueError, d.raw_decode, u'a'*42, -50000)
+
 class TestPyDecode(TestDecode, PyTest): pass
 class TestCDecode(TestDecode, CTest): pass
Index: Python-2.7.6/Misc/ACKS
===================================================================
--- Python-2.7.6.orig/Misc/ACKS 2014-06-26 18:40:10.826269135 +0200
+++ Python-2.7.6/Misc/ACKS      2014-06-26 18:40:21.962323035 +0200
@@ -1085,6 +1085,7 @@
 Frank Visser
 Johannes Vogel
 Alex Volkov
+Guido Vranken
 Martijn Vries
 Niki W. Waibel
 Wojtek Walczak
Index: Python-2.7.6/Modules/_json.c
===================================================================
--- Python-2.7.6.orig/Modules/_json.c   2014-06-26 18:40:10.828269145 +0200
+++ Python-2.7.6/Modules/_json.c        2014-06-26 18:40:21.965323049 +0200
@@ -1491,7 +1491,10 @@
     PyObject *res;
     char *str = PyString_AS_STRING(pystr);
     Py_ssize_t length = PyString_GET_SIZE(pystr);
-    if (idx >= length) {
+    if (idx < 0)
+        /* Compatibility with the Python version. */
+        idx += length;
+    if (idx < 0 || idx >= length) {
         PyErr_SetNone(PyExc_StopIteration);
         return NULL;
     }
@@ -1578,7 +1581,10 @@
     PyObject *res;
     Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr);
     Py_ssize_t length = PyUnicode_GET_SIZE(pystr);
-    if (idx >= length) {
+    if (idx < 0)
+        /* Compatibility with Python version. */
+        idx += length;
+    if (idx < 0 || idx >= length) {
         PyErr_SetNone(PyExc_StopIteration);
         return NULL;
     }
++++++ CVE-2014-4650-CGIHTTPServer-traversal.patch ++++++

# HG changeset patch
# User Benjamin Peterson <benja...@python.org>
# Date 1402796189 25200
# Node ID b4bab078876811c7d95231d08aa6fa7142fdda66
# Parent  bb8b0c7fefd0c5ed99b3f336178a4f9554a1d0ef
url unquote the path before checking if it refers to a CGI script (closes 
#21766)

diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -84,7 +84,7 @@ class CGIHTTPRequestHandler(SimpleHTTPSe
         path begins with one of the strings in self.cgi_directories
         (and the next character is a '/' or the end of the string).
         """
-        collapsed_path = _url_collapse_path(self.path)
+        collapsed_path = _url_collapse_path(urllib.unquote(self.path))
         dir_sep = collapsed_path.find('/', 1)
         head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
         if head in self.cgi_directories:
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -510,6 +510,11 @@ class CGIHTTPServerTestCase(BaseTestCase
                 (res.read(), res.getheader('Content-type'), res.status))
         self.assertEqual(os.environ['SERVER_SOFTWARE'], signature)
 
+    def test_urlquote_decoding_in_cgi_check(self):
+        res = self.request('/cgi-bin%2ffile1.py')
+        self.assertEqual((b'Hello World\n', 'text/html', 200),
+                (res.read(), res.getheader('Content-type'), res.status))
+
 
 class SimpleHTTPRequestHandlerTestCase(unittest.TestCase):
     """ Test url parsing """
++++++ README.SUSE ++++++
Python in SUSE
==============

* Documentation *

You can find documentation in seprarate packages: python-doc and
python-doc-pdf. These contan following documents:

    Tutorial, What's New in Python, Global Module Index, Library Reference,
    Macintosh Module Reference, Installing Python Modules, Distributing Python
    Modules, Language Reference, Extending and Embedding, Python/C API,
    Documenting Python 

The python-doc package constains many text files from source tarball.


* Interactive mode *

Interactive mode is by default enhanced with of history and command completion.
If you don't like these features, you can unset PYTHONSTARTUP variable in your
.profile or disable it system wide in /etc/profile.d/python.sh.
++++++ baselibs.conf ++++++
python
  requires "python-base-<targettype> = <version>"
python-base
libpython2_7-1_0
++++++ libffi-ppc64le.diff ++++++
++++ 1757 lines (skipped)

++++++ local.pth ++++++
import site; import sys; site.addsitedir("/usr/local/" + sys.lib + 
"/python"+sys.version[:3]+"/site-packages", set()); sys.lib != "lib" and 
site.addsitedir("/usr/local/lib/python"+sys.version[:3]+"/site-packages", set())
++++++ macros.python ++++++
%py_ver                 %(python -c "import sys; v=sys.version_info[:2]; print 
'%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
%py_prefix              %(python -c "import sys; print sys.prefix" 2>/dev/null 
|| echo PYTHON-NOT-FOUND)
%py_libdir              %{py_prefix}/%{_lib}/python%{py_ver}
%py_incdir              %{py_prefix}/include/python%{py_ver}
%py_sitedir             %{py_libdir}/site-packages
%py_compile(O)  \
find %1 -name '*.pyc' -exec rm -f {} \\; \
python -c "import sys, os, compileall; br='%{buildroot}'; 
compileall.compile_dir(sys.argv[1], ddir=br and 
(sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
%{-O: \
find %1 -name '*.pyo' -exec rm -f {} \\; \
python -O -c "import sys, os, compileall; br='%{buildroot}'; 
compileall.compile_dir(sys.argv[1], ddir=br and 
(sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
}
%py_requires(d) \
BuildRequires: /usr/bin/python %{-d:python-devel} \
PreReq: python = %{py_ver}

%python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; 
print get_python_lib();")
%python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; 
print get_python_lib(True);")
++++++ pre_checkin.sh ++++++
#!/bin/bash
# This script is called automatically during autobuild checkin.

for spec in python-doc.spec python.spec; do
{ sed -n -e '1,/COMMON-PATCH-BEGIN/p' $spec
  sed -n -e '/COMMON-PATCH-BEGIN/,/COMMON-PATCH-END/p' python-base.spec
  sed -n -e '/COMMON-PATCH-END/,/COMMON-PREP-BEGIN/p' $spec
  sed -n -e '/COMMON-PREP-BEGIN/,/COMMON-PREP-END/p' python-base.spec
  sed -n -e '/COMMON-PREP-END/,$p' $spec;
 } | uniq > $spec.tmp && mv $spec.tmp $spec
done
++++++ python-2.5.1-sqlite.patch ++++++
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -837,6 +837,9 @@
             goto error;
         }
 
+        if (! statement)
+            break;
+
         /* execute statement, and ignore results of SELECT statements */
         rc = SQLITE_ROW;
         while (rc == SQLITE_ROW) {
++++++ python-2.6-gettext-plurals.patch ++++++
Index: Lib/gettext.py
===================================================================
--- a/Lib/gettext.py.orig
+++ b/Lib/gettext.py
@@ -311,8 +311,9 @@ class GNUTranslations(NullTranslations):
                         self._charset = v.split('charset=')[1]
                     elif k == 'plural-forms':
                         v = v.split(';')
-                        plural = v[1].split('plural=')[1]
-                        self.plural = c2py(plural)
+                        if len(v) > 1:
+                            plural = v[1].split('plural=')[1]
+                            self.plural = c2py(plural)
             # Note: we unconditionally convert both msgids and msgstrs to
             # Unicode using the character encoding specified in the charset
             # parameter of the Content-Type header.  The gettext documentation
++++++ python-2.6b3-curses-panel.patch ++++++
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -14,7 +14,7 @@
 
 #include "py_curses.h"
 
-#include <panel.h>
+#include <ncurses/panel.h>
 
 static PyObject *PyCursesError;
 
++++++ python-2.7-dirs.patch ++++++
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -106,7 +106,7 @@
 MANDIR=                @mandir@
 INCLUDEDIR=    @includedir@
 CONFINCLUDEDIR=        $(exec_prefix)/include
-SCRIPTDIR=     $(prefix)/lib
+SCRIPTDIR=     @libdir@
 
 # Detailed destination directories
 BINLIBDEST=    $(LIBDIR)/python$(VERSION)
++++++ python-2.7.2-disable-tests-in-test_io.patch ++++++
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -2970,6 +2970,7 @@
         self.check_interrupted_read_retry(lambda x: x,
                                           mode="r")
 
+    @unittest.skip('rhbz#732998')
     @unittest.skipUnless(threading, 'Threading required for this test.')
     def check_interrupted_write_retry(self, item, **fdopen_kwargs):
         """Check that a buffered write, when it gets interrupted (either
++++++ python-2.7.2-fix_date_time_compiler.patch ++++++
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -573,8 +573,15 @@
              -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
              -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
              -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \
+             -DDATE="\"`LC_ALL=C date -u -r Makefile.pre.in +"%b %d %Y"`\"" \
+             -DTIME="\"`LC_ALL=C date -u -r Makefile.pre.in +"%T"`\"" \
              -o $@ $(srcdir)/Modules/getbuildinfo.c
 
+Python/getcompiler.o: $(srcdir)/Python/getcompiler.c Makefile
+       $(CC) -c $(PY_CFLAGS) \
+               -DCOMPILER='"[GCC]"' \
+               -o $@ $(srcdir)/Python/getcompiler.c
+
 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
        $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
                -DPREFIX='"$(prefix)"' \
++++++ python-2.7.3-ssl_ca_path.patch ++++++
Index: Python-2.7.5/Modules/_ssl.c
===================================================================
--- Python-2.7.5.orig/Modules/_ssl.c
+++ Python-2.7.5/Modules/_ssl.c
@@ -271,6 +271,7 @@ newPySSLObject(PySocketSockObject *Sock,
     char *errstr = NULL;
     int ret;
     int verification_mode;
+    struct stat stat_buf;
 
     self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */
     if (self == NULL)
@@ -327,20 +328,32 @@ newPySSLObject(PySocketSockObject *Sock,
 
     if (certreq != PY_SSL_CERT_NONE) {
         if (cacerts_file == NULL) {
-            errstr = ERRSTR("No root certificates specified for "
-                            "verification of other-side certificates.");
-            goto fail;
-        } else {
             PySSL_BEGIN_ALLOW_THREADS
-            ret = SSL_CTX_load_verify_locations(self->ctx,
-                                                cacerts_file,
-                                                NULL);
+            ret = SSL_CTX_set_default_verify_paths(self->ctx);
             PySSL_END_ALLOW_THREADS
-            if (ret != 1) {
-                _setSSLError(NULL, 0, __FILE__, __LINE__);
-                goto fail;
+        } else {
+            /* If cacerts_file is a directory-based cert store, pass it as the
+               third parameter, CApath, instead
+            */
+            if (stat(cacerts_file, &stat_buf) == 0 && 
S_ISDIR(stat_buf.st_mode)) {
+                PySSL_BEGIN_ALLOW_THREADS
+                ret = SSL_CTX_load_verify_locations(self->ctx,
+                                                    NULL,
+                                                    cacerts_file);
+                PySSL_END_ALLOW_THREADS
+            } else {
+                PySSL_BEGIN_ALLOW_THREADS
+                ret = SSL_CTX_load_verify_locations(self->ctx,
+                                                    cacerts_file,
+                                                    NULL);
+                PySSL_END_ALLOW_THREADS
             }
         }
+
+        if (ret != 1) {
+            _setSSLError(NULL, 0, __FILE__, __LINE__);
+            goto fail;
+        }
     }
     if (key_file) {
         PySSL_BEGIN_ALLOW_THREADS
++++++ python-2.7.4-aarch64.patch ++++++
# HG changeset patch
# User Andreas Schwab <sch...@suse.de>
# Date 1367276434 -7200
# Node ID 05e8999a3901b4853e60d6701510e9b3dd54a7f3
# Parent  84cef4f1999ad9e362694cdac2f65f0981e3d5d0
Add missing fficonfig.py bits for aarch64

diff -r 84cef4f1999a -r 05e8999a3901 Modules/_ctypes/libffi/fficonfig.py.in
--- a/Modules/_ctypes/libffi/fficonfig.py.in    Mon Apr 29 16:09:39 2013 -0400
+++ b/Modules/_ctypes/libffi/fficonfig.py.in    Tue Apr 30 01:00:34 2013 +0200
@@ -28,6 +28,7 @@
     'PA': ['src/pa/linux.S', 'src/pa/ffi.c'],
     'PA_LINUX': ['src/pa/linux.S', 'src/pa/ffi.c'],
     'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'],
+    'AARCH64' : ['src/aarch64/ffi.c', 'src/aarch64/sysv.S'],
 }
 
 ffi_sources += ffi_platforms['@TARGET@']
++++++ python-2.7.4-canonicalize2.patch ++++++
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1620,7 +1620,20 @@
         char *p = NULL;
         Py_ssize_t n = 0;
         PyObject *a;
-#ifdef HAVE_READLINK
+#ifdef HAVE_CANONICALIZE_FILE_NAME
+        int errnum;
+
+        if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
+            argv0 = canonicalize_file_name(argv0);
+            if (argv0 == NULL) argv0 = strdup(argv[0]);
+        }
+#elif defined(HAVE_REALPATH)
+        if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
+            if (realpath(argv0, fullpath)) {
+                argv0 = fullpath;
+            }
+        }
+#elif defined(HAVE_READLINK)
         char link[MAXPATHLEN+1];
         char argv0copy[2*MAXPATHLEN+1];
         int nr = 0;
@@ -1647,7 +1660,8 @@
                 }
             }
         }
-#endif /* HAVE_READLINK */
+#endif /* resolve method selection */
+        
 #if SEP == '\\' /* Special case for MS filename syntax */
         if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
             char *q;
@@ -1676,11 +1690,6 @@
         }
 #else /* All other filename syntaxes */
         if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) {
-#if defined(HAVE_REALPATH)
-            if (realpath(argv0, fullpath)) {
-                argv0 = fullpath;
-            }
-#endif
             p = strrchr(argv0, SEP);
         }
         if (p != NULL) {
@@ -1698,6 +1707,9 @@
         a = PyString_FromStringAndSize(argv0, n);
         if (a == NULL)
             Py_FatalError("no mem for sys.path insertion");
+#ifdef HAVE_CANONICALIZE_FILE_NAME
+        if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) free(argv0);
+#endif /* HAVE_CANONICALIZE_FILE_NAME */
         if (PyList_Insert(path, 0, a) < 0)
             Py_FatalError("sys.path.insert(0) failed");
         Py_DECREF(a);
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -106,6 +106,9 @@
 /* Define to 1 if you have the 'chflags' function. */
 #undef HAVE_CHFLAGS
 
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+#undef HAVE_CANONICALIZE_FILE_NAME
+
 /* Define to 1 if you have the `chown' function. */
 #undef HAVE_CHOWN
 
--- a/configure.ac
+++ b/configure.ac
@@ -2913,7 +2913,7 @@
  getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
  initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
  mremap nice pathconf pause plock poll pthread_init \
- putenv readlink realpath \
+ putenv readlink realpath canonicalize_file_name \
  select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
  setgid \
  setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
++++++ python-2.7.4-no-REUSEPORT.patch ++++++
Index: Python-2.7.4/Lib/test/test_support.py
===================================================================
--- Python-2.7.4.orig/Lib/test/test_support.py  2013-04-06 16:02:32.000000000 
+0200
+++ Python-2.7.4/Lib/test/test_support.py       2013-05-09 17:46:46.789663295 
+0200
@@ -371,10 +371,10 @@
             if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1:
                 raise TestFailed("tests should never set the SO_REUSEADDR "   \
                                  "socket option on TCP/IP sockets!")
-        if hasattr(socket, 'SO_REUSEPORT'):
-            if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
-                raise TestFailed("tests should never set the SO_REUSEPORT "   \
-                                 "socket option on TCP/IP sockets!")
+#        if hasattr(socket, 'SO_REUSEPORT'):
+#            if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
+#                raise TestFailed("tests should never set the SO_REUSEPORT "   
\
+#                                 "socket option on TCP/IP sockets!")
         if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'):
             sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
 
++++++ python-2.7.5-multilib.patch ++++++
Index: Python-2.7.6/configure.ac
===================================================================
--- Python-2.7.6.orig/configure.ac      2013-11-10 08:36:41.000000000 +0100
+++ Python-2.7.6/configure.ac   2014-02-11 20:08:16.265571499 +0100
@@ -733,6 +733,41 @@
     ;;
 esac
 
+AC_SUBST(ARCH)
+AC_MSG_CHECKING(ARCH)
+ARCH=`uname -m`
+case $ARCH in
+i?86) ARCH=i386;;
+esac
+AC_MSG_RESULT($ARCH)
+
+AC_SUBST(LIB)
+AC_MSG_CHECKING(LIB)
+case $ac_sys_system in
+Linux*)
+  # Test if the compiler is 64bit
+  echo 'int i;' > conftest.$ac_ext
+  python_cv_cc_64bit_output=no
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *"ELF 64"*)
+      python_cv_cc_64bit_output=yes
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+case $ARCH:$python_cv_cc_64bit_output in
+aarch64:yes | ppc64:yes | ppc64le:yes | powerpc64:yes | s390x:yes | 
sparc64:yes | x86_64:yes)
+  LIB="lib64"
+  ;;
+*:*)
+  LIB="lib"
+  ;;
+esac
+AC_MSG_RESULT($LIB)
 
 AC_SUBST(LIBRARY)
 AC_MSG_CHECKING(LIBRARY)
Index: Python-2.7.6/Include/pythonrun.h
===================================================================
--- Python-2.7.6.orig/Include/pythonrun.h       2013-11-10 08:36:39.000000000 
+0100
+++ Python-2.7.6/Include/pythonrun.h    2014-02-11 20:08:16.265571499 +0100
@@ -108,6 +108,8 @@
 /* In their own files */
 PyAPI_FUNC(const char *) Py_GetVersion(void);
 PyAPI_FUNC(const char *) Py_GetPlatform(void);
+PyAPI_FUNC(const char *) Py_GetArch(void);
+PyAPI_FUNC(const char *) Py_GetLib(void);
 PyAPI_FUNC(const char *) Py_GetCopyright(void);
 PyAPI_FUNC(const char *) Py_GetCompiler(void);
 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
Index: Python-2.7.6/Lib/distutils/command/install.py
===================================================================
--- Python-2.7.6.orig/Lib/distutils/command/install.py  2014-02-11 
20:08:15.760568524 +0100
+++ Python-2.7.6/Lib/distutils/command/install.py       2014-02-11 
20:08:16.265571499 +0100
@@ -22,6 +22,8 @@
 from site import USER_SITE
 
 
+libname = sys.lib
+
 if sys.version < "2.2":
     WINDOWS_SCHEME = {
         'purelib': '$base',
@@ -42,7 +44,7 @@
 INSTALL_SCHEMES = {
     'unix_prefix': {
         'purelib': '$base/lib/python$py_version_short/site-packages',
-        'platlib': '$platbase/lib/python$py_version_short/site-packages',
+        'platlib': 
'$platbase/'+libname+'/python$py_version_short/site-packages',
         'headers': '$base/include/python$py_version_short/$dist_name',
         'scripts': '$base/bin',
         'data'   : '$base',
Index: Python-2.7.6/Lib/distutils/sysconfig.py
===================================================================
--- Python-2.7.6.orig/Lib/distutils/sysconfig.py        2013-11-10 
08:36:40.000000000 +0100
+++ Python-2.7.6/Lib/distutils/sysconfig.py     2014-02-11 20:08:16.265571499 
+0100
@@ -119,8 +119,11 @@
         prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
-        libpython = os.path.join(prefix,
-                                 "lib", "python" + get_python_version())
+        if plat_specific or standard_lib:
+            lib = sys.lib
+        else:
+            lib = "lib"
+        libpython = os.path.join(prefix, lib, "python" + get_python_version())
         if standard_lib:
             return libpython
         else:
Index: Python-2.7.6/Lib/pydoc.py
===================================================================
--- Python-2.7.6.orig/Lib/pydoc.py      2013-11-10 08:36:40.000000000 +0100
+++ Python-2.7.6/Lib/pydoc.py   2014-02-11 20:08:16.266571506 +0100
@@ -352,7 +352,7 @@
 
         docloc = os.environ.get("PYTHONDOCS",
                                 "http://docs.python.org/library";)
-        basedir = os.path.join(sys.exec_prefix, "lib",
+        basedir = os.path.join(sys.exec_prefix, sys.lib,
                                "python"+sys.version[0:3])
         if (isinstance(object, type(os)) and
             (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
Index: Python-2.7.6/Lib/site.py
===================================================================
--- Python-2.7.6.orig/Lib/site.py       2013-11-10 08:36:40.000000000 +0100
+++ Python-2.7.6/Lib/site.py    2014-02-11 20:12:51.208189992 +0100
@@ -231,29 +231,38 @@
     USER_BASE = get_config_var('userbase')
     return USER_BASE
 
-def getusersitepackages():
+def getusersitepackages(lib_kind = 'purelib'):
     """Returns the user-specific site-packages directory path.
 
     If the global variable ``USER_SITE`` is not initialized yet, this
     function will also set it.
     """
+
+    set_user_site = (lib_kind == 'purelib')
+
     global USER_SITE
     user_base = getuserbase() # this will also set USER_BASE
 
-    if USER_SITE is not None:
+    if USER_SITE is not None and set_user_site:
         return USER_SITE
 
     from sysconfig import get_path
     import os
 
+    user_site = None
+
     if sys.platform == 'darwin':
         from sysconfig import get_config_var
         if get_config_var('PYTHONFRAMEWORK'):
-            USER_SITE = get_path('purelib', 'osx_framework_user')
-            return USER_SITE
+            user_site = get_path(lib_kind, 'osx_framework_user')
 
-    USER_SITE = get_path('purelib', '%s_user' % os.name)
-    return USER_SITE
+    if user_site is None:
+        user_site = get_path(lib_kind, '%s_user' % os.name)
+
+    if set_user_site:
+        USER_SITE = user_site
+
+    return user_site
 
 def addusersitepackages(known_paths):
     """Add a per user site-package to sys.path
@@ -263,10 +272,12 @@
     """
     # get the per user site-package path
     # this call will also make sure USER_BASE and USER_SITE are set
-    user_site = getusersitepackages()
+    for kind in ('purelib', 'platlib'):
+        user_site = getusersitepackages(kind)
+
+        if ENABLE_USER_SITE and os.path.isdir(user_site):
+            addsitedir(user_site, known_paths)
 
-    if ENABLE_USER_SITE and os.path.isdir(user_site):
-        addsitedir(user_site, known_paths)
     return known_paths
 
 def getsitepackages():
@@ -288,13 +299,18 @@
         if sys.platform in ('os2emx', 'riscos'):
             sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
         elif os.sep == '/':
-            sitepackages.append(os.path.join(prefix, "lib",
+            sitepackages.append(os.path.join(prefix, sys.lib,
                                         "python" + sys.version[:3],
                                         "site-packages"))
-            sitepackages.append(os.path.join(prefix, "lib", "site-python"))
+            sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
+            if sys.lib != "lib":
+                sitepackages.append(os.path.join(prefix, "lib",
+                                            "python" + sys.version[:3],
+                                            "site-packages"))
+                sitepackages.append(os.path.join(prefix, "lib", "site-python"))
         else:
             sitepackages.append(prefix)
-            sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+            sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
         if sys.platform == "darwin":
             # for framework builds *only* we add the standard Apple
             # locations.
Index: Python-2.7.6/Lib/sysconfig.py
===================================================================
--- Python-2.7.6.orig/Lib/sysconfig.py  2013-11-10 08:36:40.000000000 +0100
+++ Python-2.7.6/Lib/sysconfig.py       2014-02-11 20:08:16.266571506 +0100
@@ -7,10 +7,10 @@
 
 _INSTALL_SCHEMES = {
     'posix_prefix': {
-        'stdlib': '{base}/lib/python{py_version_short}',
-        'platstdlib': '{platbase}/lib/python{py_version_short}',
+        'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
+        'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
         'purelib': '{base}/lib/python{py_version_short}/site-packages',
-        'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+        'platlib': 
'{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
         'include': '{base}/include/python{py_version_short}',
         'platinclude': '{platbase}/include/python{py_version_short}',
         'scripts': '{base}/bin',
@@ -65,10 +65,10 @@
         'data'   : '{userbase}',
         },
     'posix_user': {
-        'stdlib': '{userbase}/lib/python{py_version_short}',
-        'platstdlib': '{userbase}/lib/python{py_version_short}',
+        'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
+        'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
         'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
-        'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+        'platlib': 
'{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
         'include': '{userbase}/include/python{py_version_short}',
         'scripts': '{userbase}/bin',
         'data'   : '{userbase}',
Index: Python-2.7.6/Lib/test/test_dl.py
===================================================================
--- Python-2.7.6.orig/Lib/test/test_dl.py       2013-11-10 08:36:40.000000000 
+0100
+++ Python-2.7.6/Lib/test/test_dl.py    2014-02-11 20:08:16.266571506 +0100
@@ -5,10 +5,11 @@
 import unittest
 from test.test_support import verbose, import_module
 dl = import_module('dl', deprecated=True)
+import sys
 
 sharedlibs = [
-    ('/usr/lib/libc.so', 'getpid'),
-    ('/lib/libc.so.6', 'getpid'),
+    ('/usr/'+sys.lib+'/libc.so', 'getpid'),
+    ('/'+sys.lib+'/libc.so.6', 'getpid'),
     ('/usr/bin/cygwin1.dll', 'getpid'),
     ('/usr/lib/libc.dylib', 'getpid'),
     ]
Index: Python-2.7.6/Lib/test/test_site.py
===================================================================
--- Python-2.7.6.orig/Lib/test/test_site.py     2013-11-10 08:36:40.000000000 
+0100
+++ Python-2.7.6/Lib/test/test_site.py  2014-02-11 20:08:16.266571506 +0100
@@ -241,12 +241,16 @@
             self.assertEqual(dirs[2], wanted)
         elif os.sep == '/':
             # OS X non-framwework builds, Linux, FreeBSD, etc
-            self.assertEqual(len(dirs), 2)
             wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
                                   'site-packages')
-            self.assertEqual(dirs[0], wanted)
+            self.assertTrue(wanted in dirs)
             wanted = os.path.join('xoxo', 'lib', 'site-python')
-            self.assertEqual(dirs[1], wanted)
+            self.assertTrue(wanted in dirs)
+            wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
+                                  'site-packages')
+            self.assertTrue(wanted in dirs)
+            wanted = os.path.join('xoxo', sys.lib, 'site-python')
+            self.assertTrue(wanted in dirs)
         else:
             # other platforms
             self.assertEqual(len(dirs), 2)
Index: Python-2.7.6/Lib/trace.py
===================================================================
--- Python-2.7.6.orig/Lib/trace.py      2013-11-10 08:36:40.000000000 +0100
+++ Python-2.7.6/Lib/trace.py   2014-02-11 20:08:16.266571506 +0100
@@ -754,10 +754,10 @@
                 # should I also call expanduser? (after all, could use $HOME)
 
                 s = s.replace("$prefix",
-                              os.path.join(sys.prefix, "lib",
+                              os.path.join(sys.prefix, sys.lib,
                                            "python" + sys.version[:3]))
                 s = s.replace("$exec_prefix",
-                              os.path.join(sys.exec_prefix, "lib",
+                              os.path.join(sys.exec_prefix, sys.lib,
                                            "python" + sys.version[:3]))
                 s = os.path.normpath(s)
                 ignore_dirs.append(s)
Index: Python-2.7.6/Makefile.pre.in
===================================================================
--- Python-2.7.6.orig/Makefile.pre.in   2014-02-11 20:08:15.175565077 +0100
+++ Python-2.7.6/Makefile.pre.in        2014-02-11 20:08:16.267571511 +0100
@@ -87,6 +87,8 @@
 
 # Machine-dependent subdirectories
 MACHDEP=       @MACHDEP@
+LIB=           @LIB@
+ARCH=          @ARCH@
 
 # Multiarch directory (may be empty)
 MULTIARCH=     @MULTIARCH@
@@ -584,6 +586,7 @@
                -DEXEC_PREFIX='"$(exec_prefix)"' \
                -DVERSION='"$(VERSION)"' \
                -DVPATH='"$(VPATH)"' \
+               -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' \
                -o $@ $(srcdir)/Modules/getpath.c
 
 Modules/python.o: $(srcdir)/Modules/python.c
@@ -626,7 +629,7 @@
 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
 
 Python/getplatform.o: $(srcdir)/Python/getplatform.c
-               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ 
$(srcdir)/Python/getplatform.c
+               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' 
-DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
 
 Python/importdl.o: $(srcdir)/Python/importdl.c
                $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ 
$(srcdir)/Python/importdl.c
Index: Python-2.7.6/Modules/getpath.c
===================================================================
--- Python-2.7.6.orig/Modules/getpath.c 2013-11-10 08:36:41.000000000 +0100
+++ Python-2.7.6/Modules/getpath.c      2014-02-11 20:08:16.267571511 +0100
@@ -116,9 +116,11 @@
 #define EXEC_PREFIX PREFIX
 #endif
 
+#define LIB_PYTHON LIB "/python" VERSION
+
 #ifndef PYTHONPATH
-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
-              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
+              EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
 #endif
 
 #ifndef LANDMARK
@@ -129,7 +131,7 @@
 static char exec_prefix[MAXPATHLEN+1];
 static char progpath[MAXPATHLEN+1];
 static char *module_search_path = NULL;
-static char lib_python[] = "lib/python" VERSION;
+static char lib_python[] = LIB_PYTHON;
 
 static void
 reduce(char *dir)
Index: Python-2.7.6/Python/getplatform.c
===================================================================
--- Python-2.7.6.orig/Python/getplatform.c      2013-11-10 08:36:41.000000000 
+0100
+++ Python-2.7.6/Python/getplatform.c   2014-02-11 20:08:16.267571511 +0100
@@ -10,3 +10,23 @@
 {
        return PLATFORM;
 }
+
+#ifndef ARCH
+#define ARCH "unknown"
+#endif
+
+const char *
+Py_GetArch(void)
+{
+       return ARCH;
+}
+
+#ifndef LIB
+#define LIB "lib"
+#endif
+
+const char *
+Py_GetLib(void)
+{
+       return LIB;
+}
Index: Python-2.7.6/Python/sysmodule.c
===================================================================
--- Python-2.7.6.orig/Python/sysmodule.c        2013-11-10 08:36:41.000000000 
+0100
+++ Python-2.7.6/Python/sysmodule.c     2014-02-11 20:08:16.267571511 +0100
@@ -1419,6 +1419,10 @@
                         PyString_FromString(Py_GetCopyright()));
     SET_SYS_FROM_STRING("platform",
                         PyString_FromString(Py_GetPlatform()));
+    SET_SYS_FROM_STRING("arch",
+                        PyString_FromString(Py_GetArch()));
+    SET_SYS_FROM_STRING("lib",
+                        PyString_FromString(Py_GetLib()));
     SET_SYS_FROM_STRING("executable",
                         PyString_FromString(Py_GetProgramFullPath()));
     SET_SYS_FROM_STRING("prefix",
Index: Python-2.7.6/setup.py
===================================================================
--- Python-2.7.6.orig/setup.py  2013-11-10 08:36:41.000000000 +0100
+++ Python-2.7.6/setup.py       2014-02-11 20:08:16.268571517 +0100
@@ -438,7 +438,7 @@
     def detect_modules(self):
         # Ensure that /usr/local is always used
         if not cross_compiling:
-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+            add_dir_to_list(self.compiler.library_dirs, '/usr/local/' + 
sys.lib)
             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
         if cross_compiling:
             self.add_gcc_paths()
@@ -758,11 +758,11 @@
             elif curses_library:
                 readline_libs.append(curses_library)
             elif self.compiler.find_library_file(lib_dirs +
-                                                     ['/usr/lib/termcap'],
+                                                     
['/usr/'+sys.lib+'/termcap'],
                                                      'termcap'):
                 readline_libs.append('termcap')
             exts.append( Extension('readline', ['readline.c'],
-                                   library_dirs=['/usr/lib/termcap'],
+                                   library_dirs=['/usr/'+sys.lib+'/termcap'],
                                    extra_link_args=readline_extra_link_args,
                                    libraries=readline_libs) )
         else:
@@ -1910,18 +1910,17 @@
         # Check for various platform-specific directories
         if host_platform == 'sunos5':
             include_dirs.append('/usr/openwin/include')
-            added_lib_dirs.append('/usr/openwin/lib')
+            added_lib_dirs.append('/usr/openwin/' + sys.lib)
         elif os.path.exists('/usr/X11R6/include'):
             include_dirs.append('/usr/X11R6/include')
-            added_lib_dirs.append('/usr/X11R6/lib64')
-            added_lib_dirs.append('/usr/X11R6/lib')
+            added_lib_dirs.append('/usr/X11R6/' + sys.lib)
         elif os.path.exists('/usr/X11R5/include'):
             include_dirs.append('/usr/X11R5/include')
-            added_lib_dirs.append('/usr/X11R5/lib')
+            added_lib_dirs.append('/usr/X11R5/' + sys.lib)
         else:
             # Assume default location for X11
             include_dirs.append('/usr/X11/include')
-            added_lib_dirs.append('/usr/X11/lib')
+            added_lib_dirs.append('/usr/X11/' + sys.lib)
 
         # If Cygwin, then verify that X is installed before proceeding
         if host_platform == 'cygwin':
++++++ python-2.7.6-bdist-rpm.patch ++++++
Index: Python-2.7.6/Lib/distutils/command/bdist_rpm.py
===================================================================
--- Python-2.7.6.orig/Lib/distutils/command/bdist_rpm.py        2013-11-10 
08:36:40.000000000 +0100
+++ Python-2.7.6/Lib/distutils/command/bdist_rpm.py     2014-02-11 
19:19:26.739708837 +0100
@@ -14,6 +14,7 @@
 from distutils.file_util import write_file
 from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
                               DistutilsFileError, DistutilsExecError)
+from distutils.sysconfig import get_python_version
 from distutils import log
 
 class bdist_rpm (Command):
++++++ python-2.7.6-imaplib.patch ++++++

# HG changeset patch
# User R David Murray <rdmur...@bitdance.com>
# Date 1388775562 18000
# Node ID dd906f4ab9237020a7a275c2d361fa288e553481
# Parent  69b5f692455306c98aa27ecea17e6290787ebd3f
closes 16039: CVE-2013-1752: limit line length in imaplib readline calls.

diff --git a/Lib/imaplib.py b/Lib/imaplib.py
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -35,6 +35,15 @@ IMAP4_PORT = 143
 IMAP4_SSL_PORT = 993
 AllowedVersions = ('IMAP4REV1', 'IMAP4')        # Most recent first
 
+# Maximal line length when calling readline(). This is to prevent
+# reading arbitrary length lines. RFC 3501 and 2060 (IMAP 4rev1)
+# don't specify a line length. RFC 2683 however suggests limiting client
+# command lines to 1000 octets and server command lines to 8000 octets.
+# We have selected 10000 for some extra margin and since that is supposedly
+# also what UW and Panda IMAP does.
+_MAXLINE = 10000
+
+
 #       Commands
 
 Commands = {
@@ -237,7 +246,10 @@ class IMAP4:
 
     def readline(self):
         """Read line from remote."""
-        return self.file.readline()
+        line = self.file.readline(_MAXLINE + 1)
+        if len(line) > _MAXLINE:
+            raise self.error("got more than %d bytes" % _MAXLINE)
+        return line
 
 
     def send(self, data):
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -165,6 +165,16 @@ class BaseThreadedNetworkedTests(unittes
                               self.imap_class, *server.server_address)
 
 
+    def test_linetoolong(self):
+        class TooLongHandler(SimpleIMAPHandler):
+            def handle(self):
+                # Send a very long response line
+                self.wfile.write('* OK ' + imaplib._MAXLINE*'x' + '\r\n')
+
+        with self.reaped_server(TooLongHandler) as server:
+            self.assertRaises(imaplib.IMAP4.error,
+                              self.imap_class, *server.server_address)
+
 class ThreadedNetworkedTests(BaseThreadedNetworkedTests):
 
     server_class = SocketServer.TCPServer
++++++ python-2.7.6-poplib.patch ++++++

# HG changeset patch
# User Georg Brandl <ge...@python.org>
# Date 1382855033 -3600
# Node ID 68029048c9c6833b71c3121e5178f7f57f21b565
# Parent  10d0edadbcddfd983c2c6c22d06c5a535197f8bf
Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to
prevent readline() calls from consuming too much memory.  Patch by Jyrki
Pulliainen.

Index: Python-2.7.6/Lib/poplib.py
===================================================================
--- Python-2.7.6.orig/Lib/poplib.py     2013-11-10 08:36:40.000000000 +0100
+++ Python-2.7.6/Lib/poplib.py  2014-02-07 18:45:45.454259311 +0100
@@ -32,6 +32,12 @@
 LF = '\n'
 CRLF = CR+LF
 
+# maximal line length when calling readline(). This is to prevent
+# reading arbitrary lenght lines. RFC 1939 limits POP3 line length to
+# 512 characters, including CRLF. We have selected 2048 just to be on
+# the safe side.
+_MAXLINE = 2048
+
 
 class POP3:
 
@@ -103,7 +109,10 @@
     # Raise error_proto('-ERR EOF') if the connection is closed.
 
     def _getline(self):
-        line = self.file.readline()
+        line = self.file.readline(_MAXLINE + 1)
+        if len(line) > _MAXLINE:
+            raise error_proto('line too long')
+
         if self._debugging > 1: print '*get*', repr(line)
         if not line: raise error_proto('-ERR EOF')
         octets = len(line)
Index: Python-2.7.6/Lib/test/test_poplib.py
===================================================================
--- Python-2.7.6.orig/Lib/test/test_poplib.py   2013-11-10 08:36:40.000000000 
+0100
+++ Python-2.7.6/Lib/test/test_poplib.py        2014-02-07 18:44:24.419856656 
+0100
@@ -81,7 +81,7 @@
 
     def cmd_list(self, arg):
         if arg:
-            self.push('+OK %s %s' %(arg, arg))
+            self.push('+OK %s %s' % (arg, arg))
         else:
             self.push('+OK')
             asynchat.async_chat.push(self, LIST_RESP)
@@ -198,6 +198,10 @@
                     113)
         self.assertEqual(self.client.retr('foo'), expected)
 
+    def test_too_long_lines(self):
+        self.assertRaises(poplib.error_proto, self.client._shortcmd,
+                          'echo +%s' % ((poplib._MAXLINE + 10) * 'a'))
+
     def test_dele(self):
         self.assertOK(self.client.dele('foo'))
 
++++++ python-2.7.7-mhlib-linkcount.patch ++++++
Index: Python-2.7.7/Lib/mhlib.py
===================================================================
--- Python-2.7.7.orig/Lib/mhlib.py      2014-05-31 20:58:39.000000000 +0200
+++ Python-2.7.7/Lib/mhlib.py   2014-07-24 16:08:26.049343760 +0200
@@ -156,11 +156,6 @@
         """Return the names of the subfolders in a given folder
         (prefixed with the given folder name)."""
         fullname = os.path.join(self.path, name)
-        # Get the link count so we can avoid listing folders
-        # that have no subfolders.
-        nlinks = os.stat(fullname).st_nlink
-        if nlinks <= 2:
-            return []
         subfolders = []
         subnames = os.listdir(fullname)
         for subname in subnames:
@@ -168,11 +163,6 @@
             if os.path.isdir(fullsubname):
                 name_subname = os.path.join(name, subname)
                 subfolders.append(name_subname)
-                # Stop looking for subfolders when
-                # we've seen them all
-                nlinks = nlinks - 1
-                if nlinks <= 2:
-                    break
         subfolders.sort()
         return subfolders
 
@@ -183,11 +173,6 @@
     def listallsubfolders(self, name):
         """Return the names of subfolders in a given folder, recursively."""
         fullname = os.path.join(self.path, name)
-        # Get the link count so we can avoid listing folders
-        # that have no subfolders.
-        nlinks = os.stat(fullname).st_nlink
-        if nlinks <= 2:
-            return []
         subfolders = []
         subnames = os.listdir(fullname)
         for subname in subnames:
@@ -200,11 +185,6 @@
                     subsubfolders = self.listallsubfolders(
                               name_subname)
                     subfolders = subfolders + subsubfolders
-                # Stop looking for subfolders when
-                # we've seen them all
-                nlinks = nlinks - 1
-                if nlinks <= 2:
-                    break
         subfolders.sort()
         return subfolders
 
++++++ python-bsddb6.diff ++++++
From: Jan Engelhardt <jeng...@inai.de>
Date: 2013-07-06 16:07:31.146616589 +0200

This patch was partially autogenerated:
 - copying python-bsddb3-6.0.0 sources into the python-2.7.5 tree
 - creating a diff -w against the unmodified python-2.7.5
 - stripped all hunks that pertained to module renaming
 - manually added db6 searching to setup.py

---
 Lib/bsddb/test/test_all.py         |   15 +++--
 Lib/bsddb/test/test_misc.py        |    5 +
 Lib/bsddb/test/test_replication.py |   25 +-------
 Modules/_bsddb.c                   |  108 +++++++++++++++++++++++++++++++++----
 Modules/bsddb.h                    |    2 
 setup.py                           |    6 +-
 6 files changed, 120 insertions(+), 41 deletions(-)

Index: Python-2.7.5/Lib/bsddb/test/test_all.py
===================================================================
--- Python-2.7.5.orig/Lib/bsddb/test/test_all.py
+++ Python-2.7.5/Lib/bsddb/test/test_all.py
@@ -74,8 +74,9 @@ if sys.version_info[0] >= 3 :
                 key = key.decode(charset)
             return (key, value.decode(charset))
 
-        def __next__(self) :
-            v = getattr(self._dbcursor, "next")()
+        def __next__(self, flags=0, dlen=-1, doff=-1) :
+            v = getattr(self._dbcursor, "next")(flags=flags, dlen=dlen,
+                    doff=doff)
             return self._fix(v)
 
         next = __next__
@@ -128,8 +129,8 @@ if sys.version_info[0] >= 3 :
             v = self._dbcursor.current(flags=flags, dlen=dlen, doff=doff)
             return self._fix(v)
 
-        def first(self) :
-            v = self._dbcursor.first()
+        def first(self, flags=0, dlen=-1, doff=-1) :
+            v = self._dbcursor.first(flags=flags, dlen=dlen, doff=doff)
             return self._fix(v)
 
         def pget(self, key=None, data=None, flags=0) :
@@ -492,7 +493,11 @@ def print_versions():
     print 'py module:            %s' % getattr(bsddb, "__file"+suffix)
     print 'extension module:     %s' % getattr(bsddb, "__file"+suffix)
 
-    print 'python version:       %s' % sys.version
+    print 'Test working dir:     %s' % get_test_path_prefix()
+    import platform
+    print 'python version:       %s %s' % \
+            (sys.version.replace("\r", "").replace("\n", ""), \
+            platform.architecture()[0])
     print 'My pid:               %s' % os.getpid()
     print '-=' * 38
 
Index: Python-2.7.5/Lib/bsddb/test/test_misc.py
===================================================================
--- Python-2.7.5.orig/Lib/bsddb/test/test_misc.py
+++ Python-2.7.5/Lib/bsddb/test/test_misc.py
@@ -46,8 +46,9 @@ class MiscTestCase(unittest.TestCase):
             d[repr(i)] = repr(100*i)
         db.close()
         db = hashopen(self.filename)
-        rp = repr(db)
-        self.assertEqual(rp, repr(d))
+        rp = repr(sorted(db.items()))
+        rd = repr(sorted(d.items()))
+        self.assertEqual(rp, rd)
         db.close()
 
     # 
http://sourceforge.net/tracker/index.php?func=detail&aid=1708868&group_id=13900&atid=313900
Index: Python-2.7.5/Lib/bsddb/test/test_replication.py
===================================================================
--- Python-2.7.5.orig/Lib/bsddb/test/test_replication.py
+++ Python-2.7.5/Lib/bsddb/test/test_replication.py
@@ -165,21 +165,10 @@ class DBReplicationManager(DBReplication
         # is not generated if the master has no new transactions.
         # This is solved in BDB 4.6 (#15542).
         import time
-        timeout = time.time()+60
+        timeout = time.time()+10
         while (time.time()<timeout) and not (self.confirmed_master and 
self.client_startupdone) :
             time.sleep(0.02)
-        # self.client_startupdone does not always get set to True within
-        # the timeout.  On windows this may be a deep issue, on other
-        # platforms it is likely just a timing issue, especially on slow
-        # virthost buildbots (see issue 3892 for more).  Even though
-        # the timeout triggers, the rest of this test method usually passes
-        # (but not all of it always, see below).  So we just note the
-        # timeout on stderr and keep soldering on.
-        if time.time()>timeout:
-            import sys
-            print >> sys.stderr, ("XXX: timeout happened before"
-                "startup was confirmed - see issue 3892")
-            startup_timeout = True
+        self.assertTrue(time.time()<timeout)
 
         d = self.dbenvMaster.repmgr_site_list()
         self.assertEqual(len(d), 1)
@@ -239,14 +228,6 @@ class DBReplicationManager(DBReplication
             txn.commit()
             if v is None :
                 time.sleep(0.02)
-        # If startup did not happen before the timeout above, then this test
-        # sometimes fails.  This happens randomly, which causes buildbot
-        # instability, but all the other bsddb tests pass.  Since bsddb3 in the
-        # stdlib is currently not getting active maintenance, and is gone in
-        # py3k, we just skip the end of the test in that case.
-        if time.time()>=timeout and startup_timeout:
-            self.skipTest("replication test skipped due to random failure, "
-                "see issue 3892")
         self.assertTrue(time.time()<timeout)
         self.assertEqual("123", v)
 
@@ -377,7 +358,7 @@ class DBBaseReplication(DBReplication) :
         # is not generated if the master has no new transactions.
         # This is solved in BDB 4.6 (#15542).
         import time
-        timeout = time.time()+60
+        timeout = time.time()+10
         while (time.time()<timeout) and not (self.confirmed_master and
                 self.client_startupdone) :
             time.sleep(0.02)
Index: Python-2.7.5/Modules/_bsddb.c
===================================================================
--- Python-2.7.5.orig/Modules/_bsddb.c
+++ Python-2.7.5/Modules/_bsddb.c
@@ -124,10 +124,14 @@ typedef int Py_ssize_t;
 #define NUMBER_Check    PyLong_Check
 #define NUMBER_AsLong   PyLong_AsLong
 #define NUMBER_FromLong PyLong_FromLong
+#define NUMBER_FromUnsignedLong PyLong_FromUnsignedLong
 #else
 #define NUMBER_Check    PyInt_Check
 #define NUMBER_AsLong   PyInt_AsLong
 #define NUMBER_FromLong PyInt_FromLong
+#if (PY_VERSION_HEX >= 0x02050000)
+#define NUMBER_FromUnsignedLong PyInt_FromSize_t
+#endif
 #endif
 
 #ifdef WITH_THREAD
@@ -853,6 +857,18 @@ static void _addIntToDict(PyObject* dict
     Py_XDECREF(v);
 }
 
+#if (DBVER >= 60) && (PY_VERSION_HEX >= 0x02050000)
+/* add an unsigned integer to a dictionary using the given name as a key */
+static void _addUnsignedIntToDict(PyObject* dict, char *name, unsigned int 
value)
+{
+    PyObject* v = NUMBER_FromUnsignedLong((unsigned long) value);
+    if (!v || PyDict_SetItemString(dict, name, v))
+        PyErr_Clear();
+
+    Py_XDECREF(v);
+}
+#endif
+
 /* The same, when the value is a time_t */
 static void _addTimeTToDict(PyObject* dict, char *name, time_t value)
 {
@@ -2662,13 +2678,21 @@ _default_cmp(const DBT *leftKey,
 static int
 _db_compareCallback(DB* db,
                     const DBT *leftKey,
-                    const DBT *rightKey)
+            const DBT *rightKey
+#if (DBVER >= 60)
+          , size_t *locp
+#endif
+            )
 {
     int res = 0;
     PyObject *args;
     PyObject *result = NULL;
     DBObject *self = (DBObject *)db->app_private;
 
+# if (DBVER >= 60)
+    locp = NULL;  /* As required by documentation */
+#endif
+
     if (self == NULL || self->btCompareCallback == NULL) {
         MYDB_BEGIN_BLOCK_THREADS;
         PyErr_SetString(PyExc_TypeError,
@@ -2776,13 +2800,21 @@ DB_set_bt_compare(DBObject* self, PyObje
 static int
 _db_dupCompareCallback(DB* db,
                    const DBT *leftKey,
-                   const DBT *rightKey)
+            const DBT *rightKey
+#if (DBVER >= 60)
+          , size_t *locp
+#endif
+        )
 {
     int res = 0;
     PyObject *args;
     PyObject *result = NULL;
     DBObject *self = (DBObject *)db->app_private;
 
+#if (DBVER >= 60)
+    locp = NULL;  /* As required by documentation */
+#endif
+
     if (self == NULL || self->dupCompareCallback == NULL) {
        MYDB_BEGIN_BLOCK_THREADS;
        PyErr_SetString(PyExc_TypeError,
@@ -3559,13 +3591,14 @@ Py_ssize_t DB_length(PyObject* _self)
     err = self->db->stat(self->db, /*txnid*/ NULL, &sp, 0);
     MYDB_END_ALLOW_THREADS;
 
+    if (makeDBError(err)) {
+        return -1;
+    }
+
     /* All the stat structures have matching fields upto the ndata field,
        so we can use any of them for the type cast */
     size = ((DB_BTREE_STAT*)sp)->bt_ndata;
 
-    if (err)
-        return -1;
-
     free(sp);
     return size;
 }
@@ -8406,12 +8439,22 @@ static PyObject*
 DBSequence_get(DBSequenceObject* self, PyObject* args, PyObject* kwargs)
 {
     int err, flags = 0;
+#if (DBVER >= 60)
+    unsigned
+#endif
     int delta = 1;
     db_seq_t value;
     PyObject *txnobj = NULL;
     DB_TXN *txn = NULL;
     static char* kwnames[] = {"delta", "txn", "flags", NULL };
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iOi:get", kwnames, 
&delta, &txnobj, &flags))
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+#if (DBVER >=60)
+            "|IOi:get",
+#else
+            "|iOi:get",
+#endif
+            kwnames, &delta, &txnobj, &flags))
         return NULL;
     CHECK_SEQUENCE_NOT_CLOSED(self)
 
@@ -8541,8 +8584,19 @@ DBSequence_remove(DBSequenceObject* self
 static PyObject*
 DBSequence_set_cachesize(DBSequenceObject* self, PyObject* args)
 {
-    int err, size;
-    if (!PyArg_ParseTuple(args,"i:set_cachesize", &size))
+    int err;
+#if (DBVER >= 60)
+    unsigned
+#endif
+    int size;
+
+    if (!PyArg_ParseTuple(args,
+#if (DBVER >= 60)
+            "I:set_cachesize",
+#else
+            "i:set_cachesize",
+#endif
+            &size))
         return NULL;
     CHECK_SEQUENCE_NOT_CLOSED(self)
 
@@ -8557,7 +8611,11 @@ DBSequence_set_cachesize(DBSequenceObjec
 static PyObject*
 DBSequence_get_cachesize(DBSequenceObject* self)
 {
-    int err, size;
+    int err;
+#if (DBVER >= 60)
+    unsigned
+#endif
+    int size;
 
     CHECK_SEQUENCE_NOT_CLOSED(self)
 
@@ -8686,6 +8744,9 @@ DBSequence_stat(DBSequenceObject* self,
 
 
 #define MAKE_INT_ENTRY(name)  _addIntToDict(dict_stat, #name, sp->st_##name)
+#if (DBVER >= 60) && (PY_VERSION_HEX >= 0x02050000)
+#define MAKE_UNSIGNED_INT_ENTRY(name)   _addUnsignedIntToDict(dict_stat, 
#name, sp->st_##name)
+#endif
 #define MAKE_LONG_LONG_ENTRY(name)  _addDb_seq_tToDict(dict_stat, #name, 
sp->st_##name)
 
     MAKE_INT_ENTRY(wait);
@@ -8695,10 +8756,15 @@ DBSequence_stat(DBSequenceObject* self,
     MAKE_LONG_LONG_ENTRY(last_value);
     MAKE_LONG_LONG_ENTRY(min);
     MAKE_LONG_LONG_ENTRY(max);
+#if (DBVER >= 60) && (PY_VERSION_HEX >= 0x02050000)
+    MAKE_UNSIGNED_INT_ENTRY(cache_size);
+#else
     MAKE_INT_ENTRY(cache_size);
+#endif
     MAKE_INT_ENTRY(flags);
 
 #undef MAKE_INT_ENTRY
+#undef MAKE_UNSIGNED_INT_ENTRY
 #undef MAKE_LONG_LONG_ENTRY
 
     free(sp);
@@ -9000,7 +9066,7 @@ static PyMethodDef DBEnv_methods[] = {
     {"txn_recover",     (PyCFunction)DBEnv_txn_recover,     METH_NOARGS},
 #if (DBVER < 48)
     {"set_rpc_server",  (PyCFunction)DBEnv_set_rpc_server,
-        METH_VARARGS|METH_KEYWORDS},
+        METH_VARARGS||METH_KEYWORDS},
 #endif
     {"set_mp_max_openfd", (PyCFunction)DBEnv_set_mp_max_openfd, METH_VARARGS},
     {"get_mp_max_openfd", (PyCFunction)DBEnv_get_mp_max_openfd, METH_NOARGS},
@@ -9972,6 +10038,10 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
     ADD_INT(d, DB_LOG_ZERO);
 #endif
 
+#if (DBVER >= 60)
+    ADD_INT(d, DB_LOG_BLOB);
+#endif
+
 #if (DBVER >= 44)
     ADD_INT(d, DB_DSYNC_DB);
 #endif
@@ -10032,6 +10102,10 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
     ADD_INT(d, DB_EVENT_REG_PANIC);
 #endif
 
+#if (DBVER >= 60)
+    ADD_INT(d, DB_EVENT_REP_AUTOTAKEOVER_FAILED);
+#endif
+
 #if (DBVER >=52)
     ADD_INT(d, DB_EVENT_REP_SITE_ADDED);
     ADD_INT(d, DB_EVENT_REP_SITE_REMOVED);
@@ -10136,6 +10210,20 @@ PyMODINIT_FUNC  PyInit__bsddb(void)    /
     ADD_INT(d, DB_REP_CONF_INMEM);
 #endif
 
+#if (DBVER >= 60)
+    ADD_INT(d, DB_REPMGR_ISVIEW);
+#endif
+
+#if (DBVER >= 60)
+    ADD_INT(d, DB_DBT_BLOB);
+#endif
+
+#if (DBVER >= 60)
+    ADD_INT(d, DB_STREAM_READ);
+    ADD_INT(d, DB_STREAM_WRITE);
+    ADD_INT(d, DB_STREAM_SYNC_WRITE);
+#endif
+
     ADD_INT(d, DB_TIMEOUT);
 
 #if (DBVER >= 50)
Index: Python-2.7.5/Modules/bsddb.h
===================================================================
--- Python-2.7.5.orig/Modules/bsddb.h
+++ Python-2.7.5/Modules/bsddb.h
@@ -110,7 +110,7 @@
 #error "eek! DBVER can't handle minor versions > 9"
 #endif
 
-#define PY_BSDDB_VERSION "5.3.0"
+#define PY_BSDDB_VERSION "6.0.0"
 
 /* Python object definitions */
 
Index: Python-2.7.5/setup.py
===================================================================
--- Python-2.7.5.orig/setup.py
+++ Python-2.7.5/setup.py
@@ -879,7 +879,7 @@ class PyBuildExt(build_ext):
         # a release.  Most open source OSes come with one or more
         # versions of BerkeleyDB already installed.
 
-        max_db_ver = (5, 3)
+        max_db_ver = (6, 0)
         min_db_ver = (4, 3)
         db_setup_debug = False   # verbose debug prints from this script?
 
@@ -919,6 +919,7 @@ class PyBuildExt(build_ext):
         # construct a list of paths to look for the header file in on
         # top of the normal inc_dirs.
         db_inc_paths = [
+            '/usr/include/db6',
             '/usr/include/db4',
             '/usr/local/include/db4',
             '/opt/sfw/include/db4',
@@ -958,6 +959,7 @@ class PyBuildExt(build_ext):
         for dn in inc_dirs:
             std_variants.append(os.path.join(dn, 'db3'))
             std_variants.append(os.path.join(dn, 'db4'))
+            std_variants.append(os.path.join(dn, 'db6'))
             for x in gen_db_minor_ver_nums(4):
                 std_variants.append(os.path.join(dn, "db4%d"%x))
                 std_variants.append(os.path.join(dn, "db4.%d"%x))
++++++ python-bundle-lang.patch ++++++
Index: Python-2.7.3/Lib/gettext.py
===================================================================
--- Python-2.7.3.orig/Lib/gettext.py
+++ Python-2.7.3/Lib/gettext.py
@@ -56,6 +56,7 @@ __all__ = ['NullTranslations', 'GNUTrans
            ]
 
 _default_localedir = os.path.join(sys.prefix, 'share', 'locale')
+_default_bundlelocaledir = os.path.join(sys.prefix, 'share', 'locale-bundle')
 
 
 def test(condition, true, false):
@@ -420,6 +421,10 @@ class GNUTranslations(NullTranslations):
 
 # Locate a .mo file using the gettext strategy
 def find(domain, localedir=None, languages=None, all=0):
+    if localedir in [None, _default_localedir]:
+        bundle = find(domain, localedir=_default_bundlelocaledir, 
languages=languages, all=all)
+        if bundle:
+            return bundle
     # Get some reasonable defaults for arguments that were not supplied
     if localedir is None:
         localedir = _default_localedir
++++++ python-distutils-rpm-8.patch ++++++
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -154,6 +154,8 @@
 
         ('record=', None,
          "filename in which to record list of installed files"),
+        ('record-rpm=', None,
+         "filename in which to record list of installed files and directories 
suitable as filelist for rpm"),
         ]
 
     boolean_options = ['compile', 'force', 'skip-build', 'user']
@@ -229,6 +231,7 @@
         #self.install_info = None
 
         self.record = None
+        self.record_rpm = None
 
 
     # -- Option finalizing methods -------------------------------------
@@ -578,12 +581,61 @@
             self.create_path_file()
 
         # write list of installed files, if requested.
-        if self.record:
+        if self.record or self.record_rpm:
             outputs = self.get_outputs()
             if self.root:               # strip any package prefix
                 root_len = len(self.root)
                 for counter in xrange(len(outputs)):
                     outputs[counter] = outputs[counter][root_len:]
+            if self.record_rpm:         # add directories
+                self.record = self.record_rpm
+                dirs = []
+                # directories to reject:
+                rejectdirs = [
+                    '/etc',
+                    '/',
+                    '',
+                    self.prefix,
+                    self.exec_prefix,
+                    self.install_base,
+                    self.install_platbase,
+                    self.install_purelib,
+                    self.install_platlib,
+                    self.install_headers[:len(self.install_headers) - 
len(self.distribution.get_name()) - 1],
+                    self.install_libbase,
+                    self.install_scripts,
+                    self.install_data,
+                    os.path.join(self.install_data, 'share'),
+                    os.path.join(self.install_data, 'share', 'doc'),
+                    ]
+                # directories whose childs reject:
+                rejectdirs2 = [
+                    os.path.join(self.install_data, 'share', 'man'),
+                    ]
+                # directories whose grandsons reject:
+                rejectdirs3 = [
+                    os.path.join(self.install_data, 'share', 'man'),
+                    os.path.join(self.install_data, 'share', 'locale'),
+                    ]
+                for counter in xrange(len(rejectdirs)):
+                    if len(rejectdirs[counter]) > root_len:
+                        rejectdirs[counter] = rejectdirs[counter][root_len:]
+                for counter in xrange(len(rejectdirs2)):
+                    if len(rejectdirs2[counter]) > root_len:
+                        rejectdirs2[counter] = rejectdirs2[counter][root_len:]
+                for counter in xrange(len(rejectdirs3)):
+                    if len(rejectdirs3[counter]) > root_len:
+                        rejectdirs3[counter] = rejectdirs3[counter][root_len:]
+                for counter in xrange(len(outputs)):
+                    directory = os.path.dirname(outputs[counter])
+                    while directory not in rejectdirs and \
+                            os.path.dirname(directory) not in rejectdirs2 and \
+                            os.path.dirname(os.path.dirname(directory)) not in 
rejectdirs3:
+                        dirname = '%dir ' + directory
+                        if dirname not in dirs:
+                            dirs.append(dirname)
+                        directory = os.path.dirname(directory)
+                outputs += dirs
             self.execute(write_file,
                          (self.record, outputs),
                          "writing list of installed files to '%s'" %
++++++ python.csh ++++++
# add python startup script for interactive sessions
setenv PYTHONSTARTUP /etc/pythonstart
++++++ python.sh ++++++
# add python startup script for interactive sessions
export PYTHONSTARTUP=/etc/pythonstart
++++++ pythonstart ++++++
# startup script for python to enable saving of interpreter history and
# enabling name completion

# import needed modules
import atexit
import os
import readline
import rlcompleter

# where is history saved
historyPath = os.path.expanduser("~/.pyhistory")

# handler for saving history
def save_history(historyPath=historyPath):
    import readline
    try:
        readline.write_history_file(historyPath)
    except:
        pass

# read history, if it exists
if os.path.exists(historyPath):
    readline.set_history_length(10000)
    readline.read_history_file(historyPath)

# register saving handler
atexit.register(save_history)

# enable completion
readline.parse_and_bind('tab: complete')

# cleanup
del os, atexit, readline, rlcompleter, save_history, historyPath
++++++ remove-static-libpython.diff ++++++
Index: Python-2.7.6/Makefile.pre.in
===================================================================
--- Python-2.7.6.orig/Makefile.pre.in   2013-11-19 17:36:56.968106247 +0100
+++ Python-2.7.6/Makefile.pre.in        2013-11-19 17:36:56.972106270 +0100
@@ -438,7 +438,7 @@
 
 
 # Build the interpreter
-$(BUILDPYTHON):        Modules/python.o $(LIBRARY) $(LDLIBRARY)
+$(BUILDPYTHON):        Modules/python.o $(LDLIBRARY)
                $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
                        Modules/python.o \
                        $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
@@ -465,18 +465,6 @@
                _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' 
\
                $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
 
-# Build static library
-# avoid long command lines, same as LIBRARY_OBJS
-$(LIBRARY): $(LIBRARY_OBJS)
-       -rm -f $@
-       $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
-       $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
-       $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
-       $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
-       $(AR) $(ARFLAGS) $@ $(MODOBJS)
-       $(RANLIB) $@
-
 libpython$(VERSION).so: $(LIBRARY_OBJS)
        if test $(INSTSONAME) != $(LDLIBRARY); then \
                $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) 
$(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
@@ -1094,18 +1082,6 @@
                else    true; \
                fi; \
        done
-       @if test -d $(LIBRARY); then :; else \
-               if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
-                       if test "$(SO)" = .dll; then \
-                               $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) 
; \
-                       else \
-                               $(INSTALL_DATA) $(LIBRARY) 
$(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
-                               $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
-                       fi; \
-               else \
-                       echo Skip install of $(LIBRARY) - use make 
frameworkinstall; \
-               fi; \
-       fi
        $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
        $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
        $(INSTALL_DATA) $(srcdir)/Modules/config.c.in 
$(DESTDIR)$(LIBPL)/config.c.in
++++++ smtplib_maxline-2.7.patch ++++++
diff -r 44ac81e6d584 Lib/smtplib.py
--- a/Lib/smtplib.py    Sun Oct 20 16:57:07 2013 +0300
+++ b/Lib/smtplib.py    Sun Oct 20 17:44:15 2013 +0300
@@ -57,6 +57,7 @@
 SMTP_PORT = 25
 SMTP_SSL_PORT = 465
 CRLF = "\r\n"
+_MAXLINE = 8192 # more than 8 times larger than RFC 821, 4.5.3
 
 OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I)
 
@@ -179,10 +180,14 @@
         def __init__(self, sslobj):
             self.sslobj = sslobj
 
-        def readline(self):
+        def readline(self, size=-1):
+            if size < 0:
+                size = None
             str = ""
             chr = None
             while chr != "\n":
+                if size is not None and len(str) >= size:
+                    break
                 chr = self.sslobj.read(1)
                 if not chr:
                     break
@@ -353,7 +358,7 @@
             self.file = self.sock.makefile('rb')
         while 1:
             try:
-                line = self.file.readline()
+                line = self.file.readline(_MAXLINE + 1)
             except socket.error as e:
                 self.close()
                 raise SMTPServerDisconnected("Connection unexpectedly closed: "
@@ -363,6 +368,8 @@
                 raise SMTPServerDisconnected("Connection unexpectedly closed")
             if self.debuglevel > 0:
                 print>>stderr, 'reply:', repr(line)
+            if len(line) > _MAXLINE:
+                raise SMTPResponseException(500, "Line too long.")
             resp.append(line[4:].strip())
             code = line[:3]
             # Check that the error code is syntactically correct.
diff -r 44ac81e6d584 Lib/test/test_smtplib.py
--- a/Lib/test/test_smtplib.py  Sun Oct 20 16:57:07 2013 +0300
+++ b/Lib/test/test_smtplib.py  Sun Oct 20 17:44:15 2013 +0300
@@ -292,6 +292,33 @@
                             HOST, self.port, 'localhost', 3)
 
 
+@unittest.skipUnless(threading, 'Threading required for this test.')
+class TooLongLineTests(unittest.TestCase):
+    respdata = '250 OK' + ('.' * smtplib._MAXLINE * 2) + '\n'
+
+    def setUp(self):
+        self.old_stdout = sys.stdout
+        self.output = StringIO.StringIO()
+        sys.stdout = self.output
+
+        self.evt = threading.Event()
+        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        self.sock.settimeout(15)
+        self.port = test_support.bind_port(self.sock)
+        servargs = (self.evt, self.respdata, self.sock)
+        threading.Thread(target=server, args=servargs).start()
+        self.evt.wait()
+        self.evt.clear()
+
+    def tearDown(self):
+        self.evt.wait()
+        sys.stdout = self.old_stdout
+
+    def testLineTooLong(self):
+        self.assertRaises(smtplib.SMTPResponseException, smtplib.SMTP,
+                          HOST, self.port, 'localhost', 3)
+
+
 sim_users = {'m...@somewhere.com':'John A',
              'm...@somewhere.com':'Sally B',
              'mr...@somewhereesle.com':'Ruth C',
@@ -511,7 +538,8 @@
 def test_main(verbose=None):
     test_support.run_unittest(GeneralTests, DebuggingServerTests,
                               NonConnectingTests,
-                              BadHELOServerTests, SMTPSimTests)
+                              BadHELOServerTests, SMTPSimTests,
+                              TooLongLineTests)
 
 if __name__ == '__main__':
     test_main()
++++++ sparc_longdouble.patch ++++++
Python ticket 6029

==== //tools/python/2.6.2/src/base/Modules/_ctypes/libffi/src/sparc/ffi.c#1 - 
/home/build/clifford/gpdb/tools/python/2.6.2/src/base/Modules/_ctypes/libffi/src/sparc/ffi.c
 ====
---
 Modules/_ctypes/libffi/src/sparc/ffi.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/Modules/_ctypes/libffi/src/sparc/ffi.c
+++ b/Modules/_ctypes/libffi/src/sparc/ffi.c
@@ -652,6 +652,11 @@
        }
       else
        {
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+         /* SparcV9 long double is 16-byte aligned; skip arg if necessary */
+         if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn & 1))
+           argn++;
+#endif
          /* Right-justify.  */
          argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
 
++++++ xmlrpc_gzip_27.patch ++++++
diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst
--- a/Doc/library/xmlrpclib.rst
+++ b/Doc/library/xmlrpclib.rst
@@ -120,6 +120,15 @@
       *__dict__* attribute and don't have a base class that is marshalled in a
       special way.
 
+.. data:: MAX_GZIP_DECODE
+
+   The module constant specifies the amount of bytes that are decompressed by
+   :func:`gzip_decode`. The default value is *20 MB*. A value of *-1* disables
+   the protection.
+
+   .. versionadded:: 2.7.4
+      The constant was added to strengthen the module against gzip bomb
+      attacks.
 
 .. seealso::
 
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -19,6 +19,11 @@
     threading = None
 
 try:
+    import gzip
+except ImportError:
+    gzip = None
+
+try:
     unicode
 except NameError:
     have_unicode = False
@@ -731,7 +736,7 @@
         with cm:
             p.pow(6, 8)
 
-    def test_gsip_response(self):
+    def test_gzip_response(self):
         t = self.Transport()
         p = xmlrpclib.ServerProxy(URL, transport=t)
         old = self.requestHandler.encode_threshold
@@ -744,6 +749,27 @@
         self.requestHandler.encode_threshold = old
         self.assertTrue(a>b)
 
+    def test_gzip_decode_limit(self):
+        data = '\0' * xmlrpclib.MAX_GZIP_DECODE
+        encoded = xmlrpclib.gzip_encode(data)
+        decoded = xmlrpclib.gzip_decode(encoded)
+        self.assertEqual(len(decoded), xmlrpclib.MAX_GZIP_DECODE)
+
+        data = '\0' * (xmlrpclib.MAX_GZIP_DECODE + 1)
+        encoded = xmlrpclib.gzip_encode(data)
+
+        with self.assertRaisesRegexp(ValueError,
+                                     "max gzipped payload length exceeded"):
+            xmlrpclib.gzip_decode(encoded)
+
+        oldmax = xmlrpclib.MAX_GZIP_DECODE
+        try:
+            xmlrpclib.MAX_GZIP_DECODE = -1
+            xmlrpclib.gzip_decode(encoded)
+        finally:
+            xmlrpclib.MAX_GZIP_DECODE = oldmax
+
+
 #Test special attributes of the ServerProxy object
 class ServerProxyTestCase(unittest.TestCase):
     def setUp(self):
@@ -1011,11 +1037,8 @@
     xmlrpc_tests.append(SimpleServerTestCase)
     xmlrpc_tests.append(KeepaliveServerTestCase1)
     xmlrpc_tests.append(KeepaliveServerTestCase2)
-    try:
-        import gzip
+    if gzip is not None:
         xmlrpc_tests.append(GzipServerTestCase)
-    except ImportError:
-        pass #gzip not supported in this build
     xmlrpc_tests.append(MultiPathServerTestCase)
     xmlrpc_tests.append(ServerProxyTestCase)
     xmlrpc_tests.append(FailingServerTestCase)
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py
--- a/Lib/xmlrpclib.py
+++ b/Lib/xmlrpclib.py
@@ -49,6 +49,7 @@
 # 2003-07-12 gp  Correct marshalling of Faults
 # 2003-10-31 mvl Add multicall support
 # 2004-08-20 mvl Bump minimum supported Python version to 2.1
+# 2013-01-20 ch  Add workaround for gzip bomb vulnerability
 #
 # Copyright (c) 1999-2002 by Secret Labs AB.
 # Copyright (c) 1999-2002 by Fredrik Lundh.
@@ -147,6 +148,10 @@
 except ImportError:
     gzip = None #python can be built without zlib/gzip support
 
+# Limit the maximum amount of decoded data that is decompressed. The
+# limit prevents gzip bomb attacks.
+MAX_GZIP_DECODE = 20 * 1024 * 1024 # 20 MB
+
 # --------------------------------------------------------------------
 # Internal stuff
 
@@ -1178,11 +1183,16 @@
     f = StringIO.StringIO(data)
     gzf = gzip.GzipFile(mode="rb", fileobj=f)
     try:
-        decoded = gzf.read()
+        if MAX_GZIP_DECODE < 0: # no limit
+            decoded = gzf.read()
+        else:
+            decoded = gzf.read(MAX_GZIP_DECODE + 1)
     except IOError:
         raise ValueError("invalid data")
     f.close()
     gzf.close()
+    if MAX_GZIP_DECODE >= 0 and len(decoded) > MAX_GZIP_DECODE:
+        raise ValueError("max gzipped payload length exceeded")
     return decoded
 
 ##
-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to