patch from upstream

https://bugs.gentoo.org/350098

From ab0f816c6307f38d7248d0469379c981f94b816d Mon Sep 17 00:00:00 2001
From: ceros7 <ceros7@568bbfeb-2a22-0410-94d2-cc84cf5bfa90>
Date: Mon, 30 Aug 2010 16:46:50 +0000
Subject: [PATCH] Support external python2.7.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/python2.7@33342 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
---
 configure.in                                       |   10 ++++++-
 xbmc/lib/libPython/XBPyThread.cpp                  |    5 +++-
 xbmc/lib/libPython/XBPyThread.h                    |    4 ++-
 xbmc/lib/libPython/XBPython.cpp                    |   24 +++++++++++++++-----
 xbmc/lib/libPython/XBPythonDll.cpp                 |    4 ++-
 xbmc/lib/libPython/XBPythonDllFuncs.S              |    4 ++-
 xbmc/lib/libPython/linux/Makefile.in               |    5 +++-
 xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h    |    4 ++-
 xbmc/lib/libPython/xbmcmodule/PythonAddon.h        |    4 ++-
 xbmc/lib/libPython/xbmcmodule/PythonPlayer.h       |    4 ++-
 xbmc/lib/libPython/xbmcmodule/action.h             |    4 ++-
 xbmc/lib/libPython/xbmcmodule/control.h            |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlbutton.cpp    |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlgroup.cpp     |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlimage.cpp     |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controllabel.cpp     |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controllist.cpp      |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlprogress.cpp  |    4 ++-
 .../libPython/xbmcmodule/controlradiobutton.cpp    |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlslider.cpp    |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controlspin.cpp      |    4 ++-
 xbmc/lib/libPython/xbmcmodule/controltextbox.cpp   |    4 ++-
 xbmc/lib/libPython/xbmcmodule/dialog.cpp           |    4 ++-
 xbmc/lib/libPython/xbmcmodule/dialog.h             |    4 ++-
 xbmc/lib/libPython/xbmcmodule/infotagmusic.h       |    4 ++-
 xbmc/lib/libPython/xbmcmodule/infotagvideo.h       |    4 ++-
 xbmc/lib/libPython/xbmcmodule/keyboard.h           |    4 ++-
 xbmc/lib/libPython/xbmcmodule/listitem.cpp         |    4 ++-
 xbmc/lib/libPython/xbmcmodule/listitem.h           |    4 ++-
 xbmc/lib/libPython/xbmcmodule/player.h             |    4 ++-
 xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp       |    4 ++-
 xbmc/lib/libPython/xbmcmodule/pyplaylist.h         |    4 ++-
 xbmc/lib/libPython/xbmcmodule/pyutil.h             |    4 ++-
 xbmc/lib/libPython/xbmcmodule/window.h             |    4 ++-
 xbmc/lib/libPython/xbmcmodule/winxml.cpp           |    4 ++-
 xbmc/lib/libPython/xbmcmodule/winxml.h             |    4 ++-
 xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp     |    4 ++-
 xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp  |    4 ++-
 xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp    |    5 +++-
 xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp       |    4 ++-
 42 files changed, 149 insertions(+), 48 deletions(-)

diff --git a/configure.in b/configure.in
index 4c0b1b7..cd3429e 100644
--- a/configure.in
+++ b/configure.in
@@ -901,7 +901,11 @@ fi
 
 # External Python
 if test "$use_external_python" = "yes"; then
-  AC_CHECK_LIB([python2.6], [main],
+  AC_CHECK_LIB([python2.7], [main],
+    [AC_DEFINE([HAVE_LIBPYTHON2_7], [1],
+    [Define to 1 if you have the 'python2.7' library.])
+    USE_PYTHON2_7=1],
+  [AC_CHECK_LIB([python2.6], [main],
     [AC_DEFINE([HAVE_LIBPYTHON2_6], [1],
     [Define to 1 if you have the 'python2.6' library.])
     USE_PYTHON2_6=1],
@@ -913,9 +917,10 @@ if test "$use_external_python" = "yes"; then
     [AC_DEFINE([HAVE_LIBPYTHON2_4], [1],
     [Define to 1 if you have the 'python2.4' library.])
     USE_PYTHON2_4=1],
-  [AC_MSG_ERROR($missing_library)] )] )] )
+  [AC_MSG_ERROR($missing_library)] )] )] )] )
 
   AC_MSG_NOTICE($external_python_enabled)
+  test "$USE_PYTHON2_7" && AC_MSG_NOTICE([Using Python 2.7])
   test "$USE_PYTHON2_6" && AC_MSG_NOTICE([Using Python 2.6])
   test "$USE_PYTHON2_5" && AC_MSG_NOTICE([Using Python 2.5])
   test "$USE_PYTHON2_4" && AC_MSG_NOTICE([Using Python 2.4])
@@ -1471,6 +1476,7 @@ AC_SUBST(USE_INTERNAL_LIBDTS)
 AC_SUBST(USE_EXTERNAL_LIBMPEG2)
 AC_SUBST(USE_EXTERNAL_LIBWAVPACK)
 AC_SUBST(USE_EXTERNAL_PYTHON)
+AC_SUBST(USE_PYTHON2_7)
 AC_SUBST(USE_PYTHON2_6)
 AC_SUBST(USE_PYTHON2_5)
 AC_SUBST(USE_PYTHON2_4)
diff --git a/xbmc/lib/libPython/XBPyThread.cpp b/xbmc/lib/libPython/XBPyThread.cpp
index 3a6f34e..71b4b9a 100644
--- a/xbmc/lib/libPython/XBPyThread.cpp
+++ b/xbmc/lib/libPython/XBPyThread.cpp
@@ -24,7 +24,10 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+    #include <python2.7/osdefs.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
     #include <python2.6/osdefs.h>
   #elif (defined HAVE_LIBPYTHON2_5)
diff --git a/xbmc/lib/libPython/XBPyThread.h b/xbmc/lib/libPython/XBPyThread.h
index c3da337..eea7fea 100644
--- a/xbmc/lib/libPython/XBPyThread.h
+++ b/xbmc/lib/libPython/XBPyThread.h
@@ -26,7 +26,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/XBPython.cpp b/xbmc/lib/libPython/XBPython.cpp
index e52cdfb..defcf14 100644
--- a/xbmc/lib/libPython/XBPython.cpp
+++ b/xbmc/lib/libPython/XBPython.cpp
@@ -24,7 +24,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
@@ -61,7 +63,9 @@ XBPython g_pythonParser;
 #define PYTHON_DLL "special://xbmcbin/system/python/python24-x86-osx.so"
 #endif
 #elif defined(__x86_64__)
-#if (defined HAVE_LIBPYTHON2_6)
+#if (defined HAVE_LIBPYTHON2_7)
+#define PYTHON_DLL "special://xbmcbin/system/python/python27-x86_64-linux.so"
+#elif (defined HAVE_LIBPYTHON2_6)
 #define PYTHON_DLL "special://xbmcbin/system/python/python26-x86_64-linux.so"
 #elif (defined HAVE_LIBPYTHON2_5)
 #define PYTHON_DLL "special://xbmcbin/system/python/python25-x86_64-linux.so"
@@ -69,7 +73,9 @@ XBPython g_pythonParser;
 #define PYTHON_DLL "special://xbmcbin/system/python/python24-x86_64-linux.so"
 #endif
 #elif defined(_POWERPC)
-#if (defined HAVE_LIBPYTHON2_6)
+#if (defined HAVE_LIBPYTHON2_7)
+#define PYTHON_DLL "special://xbmcbin/system/python/python27-powerpc-linux.so"
+#elif (defined HAVE_LIBPYTHON2_6)
 #define PYTHON_DLL "special://xbmcbin/system/python/python26-powerpc-linux.so"
 #elif (defined HAVE_LIBPYTHON2_5)
 #define PYTHON_DLL "special://xbmcbin/system/python/python25-powerpc-linux.so"
@@ -77,7 +83,9 @@ XBPython g_pythonParser;
 #define PYTHON_DLL "special://xbmcbin/system/python/python24-powerpc-linux.so"
 #endif
 #elif defined(_POWERPC64)
-#if (defined HAVE_LIBPYTHON2_6)
+#if (defined HAVE_LIBPYTHON2_7)
+#define PYTHON_DLL "special://xbmcbin/system/python/python27-powerpc64-linux.so"
+#elif (defined HAVE_LIBPYTHON2_6)
 #define PYTHON_DLL "special://xbmcbin/system/python/python26-powerpc64-linux.so"
 #elif (defined HAVE_LIBPYTHON2_5)
 #define PYTHON_DLL "special://xbmcbin/system/python/python25-powerpc64-linux.so"
@@ -85,7 +93,9 @@ XBPython g_pythonParser;
 #define PYTHON_DLL "special://xbmcbin/system/python/python24-powerpc64-linux.so"
 #endif
 #elif defined(_ARMEL)
-#if (defined HAVE_LIBPYTHON2_6)
+#if (defined HAVE_LIBPYTHON2_7)
+#define PYTHON_DLL "special://xbmc/system/python/python27-arm.so"
+#elif (defined HAVE_LIBPYTHON2_6)
 #define PYTHON_DLL "special://xbmc/system/python/python26-arm.so"
 #elif (defined HAVE_LIBPYTHON2_5)
 #define PYTHON_DLL "special://xbmc/system/python/python25-arm.so"
@@ -93,7 +103,9 @@ XBPython g_pythonParser;
 #define PYTHON_DLL "special://xbmc/system/python/python24-arm.so"
 #endif
 #else /* !__x86_64__ && !__powerpc__ */
-#if (defined HAVE_LIBPYTHON2_6)
+#if (defined HAVE_LIBPYTHON2_7)
+#define PYTHON_DLL "special://xbmcbin/system/python/python27-i486-linux.so"
+#elif (defined HAVE_LIBPYTHON2_6)
 #define PYTHON_DLL "special://xbmcbin/system/python/python26-i486-linux.so"
 #elif (defined HAVE_LIBPYTHON2_5)
 #define PYTHON_DLL "special://xbmcbin/system/python/python25-i486-linux.so"
diff --git a/xbmc/lib/libPython/XBPythonDll.cpp b/xbmc/lib/libPython/XBPythonDll.cpp
index bc9d827..87ac7d7 100644
--- a/xbmc/lib/libPython/XBPythonDll.cpp
+++ b/xbmc/lib/libPython/XBPythonDll.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/pyconfig.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/pyconfig.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/pyconfig.h>
diff --git a/xbmc/lib/libPython/XBPythonDllFuncs.S b/xbmc/lib/libPython/XBPythonDllFuncs.S
index 6b7a6c3..f59b192 100644
--- a/xbmc/lib/libPython/XBPythonDllFuncs.S
+++ b/xbmc/lib/libPython/XBPythonDllFuncs.S
@@ -2,7 +2,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/pyconfig.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/pyconfig.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/pyconfig.h>
diff --git a/xbmc/lib/libPython/linux/Makefile.in b/xbmc/lib/libPython/linux/Makefile.in
index 7011434..0786937 100644
--- a/xbmc/lib/libPython/linux/Makefile.in
+++ b/xbmc/lib/libPython/linux/Makefile.in
@@ -5,7 +5,10 @@ LDFLAGS=@LDFLAGS@
 SHELL=/bin/bash
 SYSDIR=../../../../system/python
 
-ifeq (@USE_PYTHON2_6@,1)
+ifeq (@USE_PYTHON2_7@,1)
+    PYVERSION=python2.7
+    SO=python27-$(ARCH).so
+else ifeq (@USE_PYTHON2_6@,1)
     PYVERSION=python2.6
     SO=python26-$(ARCH).so
 else ifeq (@USE_PYTHON2_5@,1)
diff --git a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
index 620d9bd..06fa146 100644
--- a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
+++ b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
@@ -26,7 +26,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/PythonAddon.h b/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
index ec7ed28..41eb8ea 100644
--- a/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
+++ b/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
@@ -25,7 +25,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h b/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
index ecee993..24a1c87 100644
--- a/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
+++ b/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
@@ -25,7 +25,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/action.h b/xbmc/lib/libPython/xbmcmodule/action.h
index 0e20000..7f8b1bc 100644
--- a/xbmc/lib/libPython/xbmcmodule/action.h
+++ b/xbmc/lib/libPython/xbmcmodule/action.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/control.h b/xbmc/lib/libPython/xbmcmodule/control.h
index c76b37c..a9ec63d 100644
--- a/xbmc/lib/libPython/xbmcmodule/control.h
+++ b/xbmc/lib/libPython/xbmcmodule/control.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp b/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
index b24ccce..7455ca7 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp b/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
index 96e4743..86a7d8b 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
index 68442d8..c6eb052 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp b/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
index aadfc17..8275324 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlimage.cpp b/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
index 79835d6..f106e90 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controllabel.cpp b/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
index aca22e4..38a9c07 100644
--- a/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controllist.cpp b/xbmc/lib/libPython/xbmcmodule/controllist.cpp
index 0c67b5c..bb57776 100644
--- a/xbmc/lib/libPython/xbmcmodule/controllist.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controllist.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp b/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
index a21e462..b460a2a 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp b/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
index ec54efd..b966a17 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlslider.cpp b/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
index 21ea5e7..c5f65b3 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controlspin.cpp b/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
index 4e24e14..feead3c 100644
--- a/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp b/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
index b4c44d5..4a7c688 100644
--- a/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/dialog.cpp b/xbmc/lib/libPython/xbmcmodule/dialog.cpp
index caa8986..cffe485 100644
--- a/xbmc/lib/libPython/xbmcmodule/dialog.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/dialog.cpp
@@ -24,7 +24,9 @@
 #endif
 #include "dialog.h"
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/dialog.h b/xbmc/lib/libPython/xbmcmodule/dialog.h
index edcae41..a61c4b1 100644
--- a/xbmc/lib/libPython/xbmcmodule/dialog.h
+++ b/xbmc/lib/libPython/xbmcmodule/dialog.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/infotagmusic.h b/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
index d202e48..590b858 100644
--- a/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
+++ b/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/infotagvideo.h b/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
index f2bb300..e808573 100644
--- a/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
+++ b/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/keyboard.h b/xbmc/lib/libPython/xbmcmodule/keyboard.h
index e5c817f..0f069e3 100644
--- a/xbmc/lib/libPython/xbmcmodule/keyboard.h
+++ b/xbmc/lib/libPython/xbmcmodule/keyboard.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/listitem.cpp b/xbmc/lib/libPython/xbmcmodule/listitem.cpp
index 137436e..20105ef 100644
--- a/xbmc/lib/libPython/xbmcmodule/listitem.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/listitem.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/listitem.h b/xbmc/lib/libPython/xbmcmodule/listitem.h
index 7ebcd6c..3d4a6c8 100644
--- a/xbmc/lib/libPython/xbmcmodule/listitem.h
+++ b/xbmc/lib/libPython/xbmcmodule/listitem.h
@@ -25,7 +25,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/player.h b/xbmc/lib/libPython/xbmcmodule/player.h
index 48dc9c7..34a102d 100644
--- a/xbmc/lib/libPython/xbmcmodule/player.h
+++ b/xbmc/lib/libPython/xbmcmodule/player.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp b/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
index c7e7f62..6df8548 100644
--- a/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
@@ -26,7 +26,9 @@
 #include "Util.h"
 #include "pyplaylist.h"
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/pyplaylist.h b/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
index f2334bb..2410314 100644
--- a/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
+++ b/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
@@ -25,7 +25,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/pyutil.h b/xbmc/lib/libPython/xbmcmodule/pyutil.h
index 4acf6e5..1a156f8 100644
--- a/xbmc/lib/libPython/xbmcmodule/pyutil.h
+++ b/xbmc/lib/libPython/xbmcmodule/pyutil.h
@@ -25,7 +25,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/window.h b/xbmc/lib/libPython/xbmcmodule/window.h
index 6ce8e72..40304ff 100644
--- a/xbmc/lib/libPython/xbmcmodule/window.h
+++ b/xbmc/lib/libPython/xbmcmodule/window.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/winxml.cpp b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
index d3b703f..3e1b3c8 100644
--- a/xbmc/lib/libPython/xbmcmodule/winxml.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
@@ -24,7 +24,9 @@
 #endif
 #include "winxml.h"
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/winxml.h b/xbmc/lib/libPython/xbmcmodule/winxml.h
index 6e6489e..f3a8dd8 100644
--- a/xbmc/lib/libPython/xbmcmodule/winxml.h
+++ b/xbmc/lib/libPython/xbmcmodule/winxml.h
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
index b021501..92d9903 100644
--- a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
@@ -24,7 +24,9 @@
 #endif
 #include "winxml.h"
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
index b8bc0a3..c65aded 100644
--- a/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
index 87c0ead..9941769 100644
--- a/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
@@ -23,7 +23,10 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+    #include <python2.7/structmember.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
     #include <python2.6/structmember.h>
   #elif (defined HAVE_LIBPYTHON2_5)
diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
index 3bab5a9..1e2c480 100644
--- a/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
@@ -23,7 +23,9 @@
   #include "config.h"
 #endif
 #if (defined USE_EXTERNAL_PYTHON)
-  #if (defined HAVE_LIBPYTHON2_6)
+  #if (defined HAVE_LIBPYTHON2_7)
+    #include <python2.7/Python.h>
+  #elif (defined HAVE_LIBPYTHON2_6)
     #include <python2.6/Python.h>
   #elif (defined HAVE_LIBPYTHON2_5)
     #include <python2.5/Python.h>
-- 
1.7.3.1