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/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)
-