Revert "Update python to 2.7.10"

This seems to cause issue 517460.
This reverts commit 820463a78e4483c6d5b59e7aecaafdbfcdabd0f8.

Change-Id: Iddb94db380ffe0992c894044b374993908539e35
Reviewed-on: https://chromium-review.googlesource.com/291187
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>
Trybot-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index ed92b59..bb0cc36 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -1,2 +1,2 @@
-DIST Python-2.7.10.tar.xz 12250696 SHA256 1cd3730781b91caf0fa1c4d472dc29274186480161a150294c42ce9b5c5effc0 SHA512 67615a6defbcda062f15a09f9dd3b9441afd01a8cc3255e5bc45b925378a0ddc38d468b7701176f6cc153ec52a4f21671b433780d9bde343aa9b9c1b2ae29feb WHIRLPOOL 3a9dcfc55b107dc55ad0ae93fb24a11eab7d4d9b4cfbe6b6830a090b6e5f71bb2ac91526b89c6f3e4f2610fa1a2cc4e82b58a83c599aa71f94894c74181b504b
-DIST python-gentoo-patches-2.7.10-0.tar.xz 12892 SHA256 c9a838bd62ae50cc385da23a837acfd05f2b74e4f086c9c76eb4d3aa5366ef6d SHA512 5f100944635e360691dc0a2b340a906646c4ae9ee558246ddffc56e8b15d389f25f1fbdc1db4cc08e7d29560d04d66b058b3904902899d58ecae8c408ebdf056 WHIRLPOOL f69e9a518bb7ee50c1b262a21e70e1e2443f859ee6d2f4fa84421120dbd054a06ce8dd6cfea8512cbc64bce806322b879c25c561d5eb05e1ba6cc15035b373a9
+DIST Python-2.7.3.tar.bz2 11793433 RMD160 bfc511d54080898d7008d4b84d49f957859d66c3 SHA1 842c4e2aff3f016feea3c6e992c7fa96e49c9aa0 SHA256 726457e11cb153adc3f428aaf1901fc561a374c30e5e7da6742c0742a338663c
+DIST python-gentoo-patches-2.7.3-1.tar.bz2 13858 RMD160 beeef5c66d9641f1f06153efcf386c4a6fa19beb SHA1 d1fca7b5903b415bde0f00271ee57077e3c63231 SHA256 51f6981ba02064998dfb020725c33233641b3743c4f5cf04091657313a49b8fd
diff --git a/dev-lang/python/files/python-2.7.10-cross-distutils.patch b/dev-lang/python/files/python-2.7.3-cross-distutils.patch
similarity index 82%
rename from dev-lang/python/files/python-2.7.10-cross-distutils.patch
rename to dev-lang/python/files/python-2.7.3-cross-distutils.patch
index adf8977..1644cb6 100644
--- a/dev-lang/python/files/python-2.7.10-cross-distutils.patch
+++ b/dev-lang/python/files/python-2.7.3-cross-distutils.patch
@@ -48,15 +48,7 @@
                  self.library_dirs.append('.')
 --- a/Lib/distutils/sysconfig.py
 +++ b/Lib/distutils/sysconfig.py
-@@ -12,6 +12,7 @@
- __revision__ = "$Id$"
- 
- import os
-+import imp
- import re
- import string
- import sys
-@@ -19,9 +20,16 @@
+@@ -19,9 +19,16 @@
  from distutils.errors import DistutilsPlatformError
  
  # These are needed in a couple of spots, so just compute them once.
@@ -73,7 +65,7 @@
  # Path to the base directory of the project. On Windows the binary may
  # live in project/PCBuild9.  If we're dealing with an x64 Windows build,
  # it'll live in project/PCbuild/amd64.
-@@ -114,13 +122,21 @@
+@@ -110,6 +117,12 @@
  
      If 'prefix' is supplied, use it instead of sys.prefix or
      sys.exec_prefix -- i.e., ignore 'plat_specific'.
@@ -86,6 +78,8 @@
      """
      if prefix is None:
          prefix = plat_specific and EXEC_PREFIX or PREFIX
+@@ -119,8 +119,10 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
+         prefix = plat_specific and EXEC_PREFIX or PREFIX
  
      if os.name == "posix":
 -        libpython = os.path.join(prefix,
@@ -97,20 +91,3 @@
          if standard_lib:
              return libpython
          else:
-@@ -409,10 +425,14 @@
- def _init_posix():
-     """Initialize the module as appropriate for POSIX systems."""
-     # _sysconfigdata is generated at build time, see the sysconfig module
--    from _sysconfigdata import build_time_vars
-+    lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
-+    sysconfig_path = os.path.join(lib_dir, "_sysconfigdata.py")
-+    if not os.path.exists(sysconfig_path):
-+        _, sysconfig_path, _ = imp.find_module("_sysconfigdata")
-+    sysconfig_module = imp.load_source("_sysconfigdata", sysconfig_path)
-     global _config_vars
-     _config_vars = {}
--    _config_vars.update(build_time_vars)
-+    _config_vars.update(sysconfig_module.build_time_vars)
- 
- 
- def _init_nt():
diff --git a/dev-lang/python/files/python-2.7.10-cross-h2py.patch b/dev-lang/python/files/python-2.7.3-cross-h2py.patch
similarity index 81%
rename from dev-lang/python/files/python-2.7.10-cross-h2py.patch
rename to dev-lang/python/files/python-2.7.3-cross-h2py.patch
index de0e382..8801fa8 100644
--- a/dev-lang/python/files/python-2.7.10-cross-h2py.patch
+++ b/dev-lang/python/files/python-2.7.3-cross-h2py.patch
@@ -1,5 +1,20 @@
 use the host python when running the h2py code, and have that search sysroot
 
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -431,10 +431,10 @@
+ $(srcdir)/Lib/$(PLATDIR):
+ 	mkdir $(srcdir)/Lib/$(PLATDIR)
+ 	cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
+-	export PATH; PATH="`pwd`:$$PATH"; \
++	export INCLUDE="$(SYSROOT)$(INCLUDEDIR)"; \
+ 	export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
+ 	export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
+-	export EXE; EXE="$(BUILDEXE)"; \
++	export HOSTPYTHON="`realpath $(HOSTPYTHON)`"; \
+ 	cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
+ 
+ python-config: $(srcdir)/Misc/python-config.in
 --- a/Tools/scripts/h2py.py
 +++ b/Tools/scripts/h2py.py
 @@ -60,6 +60,7 @@ except KeyError:
@@ -19,18 +34,3 @@
              outfile = os.path.basename(filename)
              i = outfile.rfind('.')
              if i > 0: outfile = outfile[:i]
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1082,10 +1082,10 @@
- $(srcdir)/Lib/$(PLATDIR):
- 	mkdir $(srcdir)/Lib/$(PLATDIR)
- 	cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
--	export PATH; PATH="`pwd`:$$PATH"; \
-+	export INCLUDE="$(SYSROOT)$(INCLUDEDIR)"; \
- 	export PYTHONPATH; PYTHONPATH="$(srcdir)/Lib:$(abs_builddir)/`cat pybuilddir.txt`"; \
- 	export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
--	export EXE; EXE="$(BUILDEXE)"; \
-+	export HOSTPYTHON="`realpath $(HOSTPYTHON)`"; \
- 	if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
- 	export PYTHON_FOR_BUILD; \
- 	if [ "$(build)" = "$(host)" ]; then \
diff --git a/dev-lang/python/files/python-2.7.3-cross-install-compile.patch b/dev-lang/python/files/python-2.7.3-cross-install-compile.patch
new file mode 100644
index 0000000..93bac05
--- /dev/null
+++ b/dev-lang/python/files/python-2.7.3-cross-install-compile.patch
@@ -0,0 +1,35 @@
+some of the modules that we compile need more modules on the host to make work
+
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -952,25 +952,25 @@ libinstall:
+ 		$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
+ 			$(DESTDIR)$(LIBDEST)/distutils/tests ; \
+ 	fi
+-	PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
++	PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+ 		./$(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+ 		-d $(LIBDEST) -f \
+ 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ 		$(DESTDIR)$(LIBDEST)
+-	PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
++	PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ 		./$(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ 		-d $(LIBDEST) -f \
+ 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ 		$(DESTDIR)$(LIBDEST)
+-	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
++	-PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+ 		./$(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+ 		-d $(LIBDEST)/site-packages -f \
+ 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+-	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
++	-PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ 		./$(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ 		-d $(LIBDEST)/site-packages -f \
+ 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+-	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
++	-PYTHONPATH=$(HOSTPYTHONPATH):$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ 		./$(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+ 
+ # Create the PLATDIR source directory, if one wasn't distributed..
diff --git a/dev-lang/python/files/python-2.7.10-cross-setup-sysroot.patch b/dev-lang/python/files/python-2.7.3-cross-setup-sysroot.patch
similarity index 77%
rename from dev-lang/python/files/python-2.7.10-cross-setup-sysroot.patch
rename to dev-lang/python/files/python-2.7.3-cross-setup-sysroot.patch
index b3dbf4a..e7ce4b1 100644
--- a/dev-lang/python/files/python-2.7.10-cross-setup-sysroot.patch
+++ b/dev-lang/python/files/python-2.7.3-cross-setup-sysroot.patch
@@ -2,7 +2,7 @@
 
 --- a/setup.py
 +++ b/setup.py
-@@ -455,10 +455,14 @@
+@@ -337,9 +337,13 @@
  
      def detect_modules(self):
          global disable_ssl
@@ -11,15 +11,14 @@
 +        sysroot = os.getenv('SYSROOT', '')
 +
          # Ensure that /usr/local is always used
-         if not cross_compiling:
--            add_dir_to_list(self.compiler.library_dirs, '/usr/local/@@GENTOO_LIBDIR@@')
--            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-+            add_dir_to_list(self.compiler.library_dirs, sysroot + '/usr/local/@@GENTOO_LIBDIR@@')
-+            add_dir_to_list(self.compiler.include_dirs, sysroot + '/usr/local/include')
-         if cross_compiling:
-             self.add_gcc_paths()
+-        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+-        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++        add_dir_to_list(self.compiler.library_dirs, sysroot + '/usr/local/lib')
++        add_dir_to_list(self.compiler.include_dirs, sysroot + '/usr/local/include')
          self.add_multiarch_paths()
-@@ -504,9 +508,15 @@
+ 
+         # Add paths specified in the environment variables LDFLAGS and
+@@ -375,10 +379,16 @@
              # building a framework with different architectures than
              # the one that is currently installed (issue #7473)
              add_dir_to_list(self.compiler.library_dirs,
@@ -28,26 +27,27 @@
              add_dir_to_list(self.compiler.include_dirs,
 -                            sysconfig.get_config_var("INCLUDEDIR"))
 +                            sysroot + sysconfig.get_config_var("INCLUDEDIR"))
-+
+ 
 +        # We should always look into sysroot/usr/include and consider
 +        # also the lib dirs there for searching for files
 +        add_dir_to_list(self.compiler.include_dirs, sysroot + '/usr/include')
 +        add_dir_to_list(self.compiler.library_dirs, sysroot + '/@@GENTOO_LIBDIR@@')
 +        add_dir_to_list(self.compiler.library_dirs, sysroot + '/usr/@@GENTOO_LIBDIR@@')
- 
++
          try:
              have_unicode = unicode
-@@ -527,6 +537,9 @@
-                 '/@@GENTOO_LIBDIR@@', '/usr/@@GENTOO_LIBDIR@@',
-                 ):
-                 add_dir_to_list(lib_dirs, d)
+         except NameError:
+@@ -389,6 +399,9 @@
+             '/lib', '/usr/lib',
+             ]
+         inc_dirs = self.compiler.include_dirs + ['/usr/include']
 +        # Ignore previous settings.
 +        lib_dirs = self.compiler.library_dirs
 +        inc_dirs = self.compiler.include_dirs
          exts = []
          missing = []
  
-@@ -778,11 +791,11 @@
+@@ -613,11 +626,11 @@
              elif curses_library:
                  readline_libs.append(curses_library)
              elif self.compiler.find_library_file(lib_dirs +
@@ -61,8 +61,8 @@
                                     extra_link_args=readline_extra_link_args,
                                     libraries=readline_libs) )
          else:
-@@ -805,20 +818,20 @@
-                                libraries=math_libs) )
+@@ -642,20 +655,20 @@
+                                depends = ['socketmodule.h']) )
          # Detect SSL support for the socket module (via _ssl)
          search_for_ssl_incs_in = [
 -                              '/usr/local/ssl/include',
@@ -87,32 +87,31 @@
                                       ] )
  
          if (ssl_incs is not None and
-@@ -968,6 +981,7 @@
+@@ -773,6 +786,7 @@
              db_inc_paths.append('/usr/local/include/db3%d' % x)
              db_inc_paths.append('/pkg/db-3.%d/include' % x)
              db_inc_paths.append('/opt/db-3.%d/include' % x)
 +        db_inc_paths = [sysroot + x for x in db_inc_paths]
  
-         if cross_compiling:
-             db_inc_paths = []
-@@ -1121,6 +1135,7 @@
+         # Add some common subdirectories for Sleepycat DB to the list,
+         # based on the standard include directories. This way DB3/4 gets
+@@ -921,5 +935,6 @@
+                              '/usr/local/include/sqlite',
+                              '/usr/local/include/sqlite3',
                             ]
-         if cross_compiling:
-             sqlite_inc_paths = []
 +        sqlite_inc_paths = [sysroot + x for x in sqlite_inc_paths]
          MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
          MIN_SQLITE_VERSION = ".".join([str(x)
-                                     for x in MIN_SQLITE_VERSION_NUMBER])
-@@ -1222,7 +1237,7 @@
+@@ -1021,7 +1036,7 @@
          # we do not build this one.  Otherwise this build will pick up
          # the more recent berkeleydb's db.h file first in the include path
          # when attempting to compile and it will fail.
 -        f = "/usr/include/db.h"
 +        f = sysroot + "/usr/include/db.h"
  
-         if host_platform == 'darwin':
+         if sys.platform == 'darwin':
              if is_macosx_sdk_path(f):
-@@ -1835,7 +1850,7 @@
+@@ -1546,7 +1561,7 @@
          # For 8.4a2, the X11 headers are not included. Rather than include a
          # complicated search, this is a hard-coded path. It could bail out
          # if X11 libs are not found...
@@ -121,9 +120,9 @@
          frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
  
          # All existing framework builds of Tcl/Tk don't support 64-bit
-@@ -1879,6 +1894,9 @@
-         if self.detect_tkinter_explicitly():
-             return
+@@ -1579,6 +1594,9 @@
+     def detect_tkinter(self, inc_dirs, lib_dirs):
+         # The _tkinter module.
  
 +        # We must respect the user specified sysroot!
 +        sysroot = os.getenv('SYSROOT', '')
@@ -131,28 +130,30 @@
          # Rather than complicate the code below, detecting and building
          # AquaTk is a separate method. Only one Tkinter will be built on
          # Darwin - either AquaTk, if it is found, or X11 based Tk.
-@@ -1934,16 +1952,16 @@
-         if host_platform == 'sunos5':
+@@ -1633,17 +1651,17 @@
+         if platform == 'sunos5':
              include_dirs.append('/usr/openwin/include')
              added_lib_dirs.append('/usr/openwin/lib')
 -        elif os.path.exists('/usr/X11R6/include'):
 -            include_dirs.append('/usr/X11R6/include')
--            added_lib_dirs.append('/usr/X11R6/@@GENTOO_LIBDIR@@')
+-            added_lib_dirs.append('/usr/X11R6/lib64')
+-            added_lib_dirs.append('/usr/X11R6/lib')
 -        elif os.path.exists('/usr/X11R5/include'):
 -            include_dirs.append('/usr/X11R5/include')
--            added_lib_dirs.append('/usr/X11R5/@@GENTOO_LIBDIR@@')
+-            added_lib_dirs.append('/usr/X11R5/lib')
 +        elif os.path.exists(sysroot + '/usr/X11R6/include'):
 +            include_dirs.append(sysroot + '/usr/X11R6/include')
-+            added_lib_dirs.append(sysroot + '/usr/X11R6/@@GENTOO_LIBDIR@@')
++            added_lib_dirs.append(sysroot + '/usr/X11R6/lib64')
++            added_lib_dirs.append(sysroot + '/usr/X11R6/lib')
 +        elif os.path.exists(sysroot + '/usr/X11R5/include'):
 +            include_dirs.append(sysroot + '/usr/X11R5/include')
-+            added_lib_dirs.append(sysroot + '/usr/X11R5/@@GENTOO_LIBDIR@@')
++            added_lib_dirs.append(sysroot + '/usr/X11R5/lib')
          else:
              # Assume default location for X11
 -            include_dirs.append('/usr/X11/include')
--            added_lib_dirs.append('/usr/X11/@@GENTOO_LIBDIR@@')
+-            added_lib_dirs.append('/usr/X11/lib')
 +            include_dirs.append(sysroot + '/usr/X11/include')
-+            added_lib_dirs.append(sysroot + '/usr/X11/@@GENTOO_LIBDIR@@')
++            added_lib_dirs.append(sysroot + '/usr/X11/lib')
  
          # If Cygwin, then verify that X is installed before proceeding
-         if host_platform == 'cygwin':
+         if platform == 'cygwin':
diff --git a/dev-lang/python/files/python-2.7.3-gcc-4_8.patch b/dev-lang/python/files/python-2.7.3-gcc-4_8.patch
new file mode 100644
index 0000000..4147b7e
--- /dev/null
+++ b/dev-lang/python/files/python-2.7.3-gcc-4_8.patch
@@ -0,0 +1,58 @@
+Fix gcc 4.8 build broken for python 2.7.
+The error was reported while building chromeos-chrome - "error:
+'PyArg_ParseTuple' is an unrecognized format function type".  The issue is that
+'-Wformat' is no longer included by default in gcc 4.8. The solution is to add
+'-Wformat' explictly to configure.  For GCC 4.7, since '-Wformat' is enabled by
+default, the modification has no impact to current gcc.  Below shows the
+difference between gcc 4.7 and gcc 4.8.
+   
+     void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
+     int
+     main ()
+     {
+ 
+       ;
+       return 0;
+     }
+ 
+     With gcc 4.7:
+     $ gcc -Werror /tmp/foo.c
+     /tmp/foo.c:1:1: error: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Werror=format]
+     cc1: all warnings being treated as errors
+     $ echo $?
+     1
+    
+     With gcc 4.8:
+     $ ~/coding/gcc-python/gcc-svn-trunk/install/bin/gcc -Werror /tmp/foo.c
+     $ echo $?
+     0
+    
+     but on adding -Wall:
+     $ ~/coding/gcc-python/gcc-svn-trunk/install/bin/gcc -Werror -Wall /tmp/foo.c
+     /tmp/foo.c:1:1: error: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Werror=format=]
+      void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
+      ^
+     cc1: all warnings being treated as errors
+     $ echo $?
+     1
+    
+     or indeed just -Wformat:
+    
+     $ ~/coding/gcc-python/gcc-svn-trunk/install/bin/gcc -Werror -Wformat /tmp/foo.c
+     /tmp/foo.c:1:1: error: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Werror=format=]
+      void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
+      ^
+     cc1: all warnings being treated as errors
+     $ echo $?
+     1
+--- configure.in.orig	2013-04-09 11:13:52.568435225 -0700
++++ configure.in	2013-04-09 11:14:06.998565440 -0700
+@@ -1192,7 +1192,7 @@ if test "$GCC" = "yes"
+ then
+   AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
+   save_CFLAGS=$CFLAGS
+-  CFLAGS="$CFLAGS -Werror"
++  CFLAGS="$CFLAGS -Werror -Wformat"
+   AC_COMPILE_IFELSE([
+     AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
+   ],[
diff --git a/dev-lang/python/files/python-2.7.5-nonfatal-compileall.patch b/dev-lang/python/files/python-2.7.5-nonfatal-compileall.patch
deleted file mode 100644
index a762dfb..0000000
--- a/dev-lang/python/files/python-2.7.5-nonfatal-compileall.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-diff --git a/Makefile.pre.in b/Makefile.pre.in
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -1000,12 +1000,12 @@
- 		$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
- 			$(DESTDIR)$(LIBDEST)/distutils/tests ; \
- 	fi
--	PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
-+	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
- 		$(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
- 		-d $(LIBDEST) -f \
- 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
- 		$(DESTDIR)$(LIBDEST)
--	PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-+	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- 		$(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
- 		-d $(LIBDEST) -f \
- 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
diff --git a/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch b/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch
deleted file mode 100644
index 38ce6f7..0000000
--- a/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-do not hardcode /usr/include paths
-
---- a/configure.ac
-+++ b/configure.ac
-@@ -4316,7 +4316,7 @@ fi
- 
- # first curses configure check
- ac_save_cppflags="$CPPFLAGS"
--CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
-+CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags ncursesw`"
- 
- AC_CHECK_HEADERS(curses.h ncurses.h)
- 
diff --git a/dev-lang/python/python-2.7.10.ebuild b/dev-lang/python/python-2.7.3-r9.ebuild
similarity index 68%
rename from dev-lang/python/python-2.7.10.ebuild
rename to dev-lang/python/python-2.7.3-r9.ebuild
index 8dcad60..85d5f75 100644
--- a/dev-lang/python/python-2.7.10.ebuild
+++ b/dev-lang/python/python-2.7.3-r9.ebuild
@@ -1,19 +1,26 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.10.ebuild,v 1.2 2015/06/29 17:26:27 floppym Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.3-r3.ebuild,v 1.5 2012/12/19 18:03:41 floppym Exp $
 
-EAPI="4"
+# ******************************* README ***************************************
+# WARNING! ANY CHANGE TO THIS FILE *MUST* BE ACCOMPANIED BY A CHANGE TO
+# chromeos-base/dev-install's ebuild, which depends on python indirectly.
+# Otherwise, incremental builds will break.  See crbug.com/489895.
+# ******************************************************************************
+
+EAPI="2"
+WANT_AUTOMAKE="none"
 WANT_LIBTOOL="none"
 
 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
 
 MY_P="Python-${PV}"
-PATCHSET_VERSION="2.7.10-0"
+PATCHSET_REVISION="1"
 
 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
 HOMEPAGE="http://www.python.org/"
-SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
-	http://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
+SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
+	mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
 
 LICENSE="PSF-2"
 SLOT="2.7"
@@ -31,10 +38,6 @@
 	virtual/libintl
 	!build? (
 		berkdb? ( || (
-			sys-libs/db:5.3
-			sys-libs/db:5.2
-			sys-libs/db:5.1
-			sys-libs/db:5.0
 			sys-libs/db:4.8
 			sys-libs/db:4.7
 			sys-libs/db:4.6
@@ -53,7 +56,6 @@
 		tk? (
 			>=dev-lang/tk-8.0
 			dev-tcltk/blt
-			dev-tcltk/tix
 		)
 		xml? ( >=dev-libs/expat-2.1 )
 	)
@@ -64,8 +66,7 @@
 	!sys-devel/gcc[libffi]"
 RDEPEND+=" !build? ( app-misc/mime-types )
 	doc? ( dev-python/python-docs:${SLOT} )"
-PDEPEND="app-admin/eselect-python
-	app-admin/python-updater"
+PDEPEND="app-admin/eselect-python"
 
 S="${WORKDIR}/${MY_P}"
 
@@ -86,25 +87,29 @@
 
 src_prepare() {
 	# Ensure that internal copies of expat, libffi and zlib are not used.
-	rm -r Modules/expat || die
-	rm -r Modules/_ctypes/libffi* || die
-	rm -r Modules/zlib || die
+	rm -fr Modules/expat
+	rm -fr Modules/_ctypes/libffi*
+	rm -fr Modules/zlib
 
-	if tc-is-cross-compiler; then
-		local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
+	local excluded_patches
+	if ! tc-is-cross-compiler; then
+		excluded_patches="*_all_crosscompile.patch"
 	fi
 
-	EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
+	EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
+		epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
 
 	#
 	# START: ChromiumOS specific changes
 	#
 	if tc-is-cross-compiler ; then
-		epatch "${FILESDIR}"/python-2.7.10-cross-h2py.patch
+		epatch "${FILESDIR}"/python-2.7.3-cross-setup-sysroot.patch
+		epatch "${FILESDIR}"/python-2.7.3-cross-h2py.patch
+		epatch "${FILESDIR}"/python-2.7.3-cross-install-compile.patch
+		epatch "${FILESDIR}"/python-2.7.3-gcc-4_8.patch
 		sed -i 's:^python$EXE:${HOSTPYTHON}:' Lib/*/regen || die
 	fi
-	epatch "${FILESDIR}"/python-2.7.10-cross-setup-sysroot.patch
-	epatch "${FILESDIR}"/python-2.7.10-cross-distutils.patch
+	epatch "${FILESDIR}"/python-2.7.3-cross-distutils.patch
 	epatch "${FILESDIR}"/python-2.7.3-unique-semaphore-name.patch
 	# Undo the @libdir@ change for portage's pym folder as it is always
 	# installed into /usr/lib/ and not the abi libdir.
@@ -118,10 +123,6 @@
 	# END: ChromiumOS specific changes
 	#
 
-	# Fix for cross-compiling.
-	epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
-	epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
-
 	sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
 		Lib/distutils/command/install.py \
 		Lib/distutils/sysconfig.py \
@@ -133,9 +134,8 @@
 		Modules/getpath.c \
 		setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
 
-	epatch_user
-
-	eautoreconf
+	eautoconf
+	eautoheader
 }
 
 src_configure() {
@@ -183,10 +183,25 @@
 		use hardened && replace-flags -O3 -O2
 	fi
 
+	# Run the configure scripts in parallel.
+	multijob_init
+
+	mkdir -p "${WORKDIR}"/{${CBUILD},${CHOST}}
+
 	if tc-is-cross-compiler; then
-		# Force some tests that try to poke fs paths.
-		export ac_cv_file__dev_ptc=no
-		export ac_cv_file__dev_ptmx=yes
+		(
+		multijob_child_init
+		cd "${WORKDIR}"/${CBUILD} >/dev/null
+		OPT="-O1" CFLAGS="" CPPFLAGS="" LDFLAGS="" CC="" \
+		"${S}"/configure \
+			--{build,host}=${CBUILD} \
+			|| die "cross-configure failed"
+		) &
+		multijob_post_fork
+
+		# The configure script assumes it's buggy when cross-compiling.
+		export ac_cv_buggy_getaddrinfo=no
+		export ac_cv_have_long_long_format=yes
 	fi
 
 	# Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
@@ -208,11 +223,8 @@
 		dbmliborder+="${dbmliborder:+:}bdb"
 	fi
 
-	BUILD_DIR="${WORKDIR}/${CHOST}"
-	mkdir -p "${BUILD_DIR}" || die
-	cd "${BUILD_DIR}" || die
-
-	ECONF_SOURCE="${S}" OPT="" \
+	cd "${WORKDIR}"/${CHOST}
+	ECONF_SOURCE=${S} OPT="" \
 	econf \
 		--with-fpectl \
 		--enable-shared \
@@ -225,29 +237,47 @@
 		--with-libc="" \
 		--enable-loadable-sqlite-extensions \
 		--with-system-expat \
-		--with-system-ffi \
-		--without-ensurepip
+		--with-system-ffi
 
-	if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
-		eerror "configure has detected that the sem_open function is broken."
-		eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
-		die "Broken sem_open function (bug 496328)"
+	if tc-is-cross-compiler; then
+		# Modify the Makefile.pre so we don't regen for the host/ one.
+		# We need to link the host python programs into $PWD and run
+		# them from here because the distutils sysconfig module will
+		# parse Makefile/etc... from argv[0], and we need it to pick
+		# up the target settings, not the host ones.
+		sed -i \
+			-e '1iHOSTPYTHONPATH = ./hostpythonpath:' \
+			-e '/^HOSTPYTHON/s:=.*:= ./hostpython:' \
+			-e '/^HOSTPGEN/s:=.*:= ./Parser/hostpgen:' \
+			Makefile{.pre,} || die "sed failed"
 	fi
+
+	multijob_finish
 }
 
 src_compile() {
-	# Avoid invoking pgen for cross-compiles.
-	touch Include/graminit.h Python/graminit.c
-
-	cd "${BUILD_DIR}" || die
-	emake
-
-	# Work around bug 329499. See also bug 413751 and 457194.
-	if has_version dev-libs/libffi[pax_kernel]; then
-		pax-mark E python
-	else
-		pax-mark m python
+	if tc-is-cross-compiler; then
+		cd "${WORKDIR}"/${CBUILD}
+		# Disable as many modules as possible -- but we need a few to install.
+		PYTHON_DISABLE_MODULES=$(
+			sed -n "/Extension('/{s:^.*Extension('::;s:'.*::;p}" "${S}"/setup.py | \
+				egrep -v '(unicodedata|time|cStringIO|_struct|binascii)'
+		) \
+		PTHON_DISABLE_SSL="1" \
+		SYSROOT= \
+		emake || die "cross-make failed"
+		[[ -e build/lib.linux-x86_64-${SLOT}/unicodedata.so ]] || die
+		# See comment in src_configure about these.
+		ln python ../${CHOST}/hostpython || die
+		ln Parser/pgen ../${CHOST}/Parser/hostpgen || die
+		ln -s ../${CBUILD}/build/lib.*/ ../${CHOST}/hostpythonpath || die
 	fi
+
+	cd "${WORKDIR}"/${CHOST}
+	default
+
+	# Work around bug 329499. See also bug 413751.
+	pax-mark m python
 }
 
 src_test() {
@@ -257,7 +287,7 @@
 		return
 	fi
 
-	cd "${BUILD_DIR}" || die
+	cd "${WORKDIR}"/${CHOST}
 
 	# Skip failing tests.
 	local skipped_tests="distutils gdb"
@@ -291,15 +321,17 @@
 }
 
 src_install() {
+	[[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
+
 	local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
 
-	cd "${BUILD_DIR}" || die
-	emake DESTDIR="${D}" altinstall
+	cd "${WORKDIR}"/${CHOST}
+	emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
 
 	sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
 
 	# Backwards compat with Gentoo divergence.
-	dosym python${SLOT}-config /usr/bin/python-config-${SLOT}
+	dosym python${SLOT}-config /usr/bin/python-config-${SLOT} || die
 
 	# Fix collisions between different slots of Python.
 	mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
@@ -310,28 +342,28 @@
 	if use build; then
 		rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
 	else
-		use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
-		use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
-		use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
 		use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
+		use berkdb || rm -fr "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*}
+		use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
+		use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk}
 	fi
 
-	use threads || rm -r "${libdir}/multiprocessing" || die
-	use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
+	use threads || rm -fr "${libdir}/multiprocessing"
+	use wininst || rm -f "${libdir})/distutils/command/"wininst-*.exe
 
-	dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
+	dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
 
 	if use examples; then
 		insinto /usr/share/doc/${PF}/examples
-		doins -r "${S}"/Tools
+		doins -r "${S}"/Tools || die "doins failed"
 	fi
 	insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
 	local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
 		emake --no-print-directory -s -f - 2>/dev/null)
 	newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
 
-	newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
-	newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
+	newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
+	newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
 	sed \
 		-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
 		-e "s:@PYDOC@:pydoc${SLOT}:" \
@@ -342,8 +374,9 @@
 
 	# if not using a cross-compiler, use the fresh binary
 	if ! tc-is-cross-compiler; then
-		local PYTHON=./python
-		local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
+		local PYTHON=./python \
+			LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
+		export LD_LIBRARY_PATH
 	fi
 
 	echo "EPYTHON='${EPYTHON}'" > epython.py
@@ -365,6 +398,8 @@
 }
 
 eselect_python_update() {
+	[[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/"
+
 	if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
 		eselect python update
 	fi