Python: readd SSL support, add patch to detect paths in sysroot

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2010-11-03 00:30:20 +01:00
parent 93016ddc71
commit 8599e9e69b
3 changed files with 95 additions and 1 deletions

View File

@ -75,7 +75,9 @@ make -j1 CC="$TARGET_CC" \
BLDSHARED="$CC -shared" \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
CROSS_COMPILE="$TARGET_NAME" \
CROSS_COMPILE_TARGET="yes"
CROSS_COMPILE_TARGET="yes" \
PYTHON_MODULES_INCLUDE=$SYSROOT_PREFIX/usr/include \
PYTHON_MODULES_LIB="$SYSROOT_PREFIX/lib $SYSROOT_PREFIX/usr/lib" \
make -j1 CC="$TARGET_CC" \
DESTDIR=$SYSROOT_PREFIX \
@ -85,6 +87,8 @@ make -j1 CC="$TARGET_CC" \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
CROSS_COMPILE="$TARGET_NAME" \
CROSS_COMPILE_TARGET="yes" \
PYTHON_MODULES_INCLUDE=$SYSROOT_PREFIX/usr/include \
PYTHON_MODULES_LIB="$SYSROOT_PREFIX/lib $SYSROOT_PREFIX/usr/lib" \
install
cp -R ../Lib ./

View File

@ -0,0 +1,52 @@
diff -Naur Python-2.6.6/setup.py Python-2.6.6.patch/setup.py
--- Python-2.6.6/setup.py 2010-11-03 00:08:13.955365257 +0100
+++ Python-2.6.6.patch/setup.py 2010-11-03 00:11:49.838882245 +0100
@@ -361,9 +361,18 @@
return sys.platform
def detect_modules(self):
- # Ensure that /usr/local is always used
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ try:
+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
+ except KeyError:
+ modules_include_dirs = ['/usr/include']
+ try:
+ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
+ except KeyError:
+ modules_lib_dirs = ['/usr/lib']
+ for dir in modules_include_dirs:
+ add_dir_to_list(self.compiler.include_dirs, dir)
+ for dir in modules_lib_dirs:
+ add_dir_to_list(self.compiler.library_dirs, dir)
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -399,12 +408,6 @@
for directory in reversed(options.dirs):
add_dir_to_list(dir_list, directory)
- if os.path.normpath(sys.prefix) != '/usr':
- add_dir_to_list(self.compiler.library_dirs,
- sysconfig.get_config_var("LIBDIR"))
- add_dir_to_list(self.compiler.include_dirs,
- sysconfig.get_config_var("INCLUDEDIR"))
-
try:
have_unicode = unicode
except NameError:
@@ -413,11 +416,8 @@
# lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
- lib_dirs = self.compiler.library_dirs + [
- '/lib64', '/usr/lib64',
- '/lib', '/usr/lib',
- ]
- inc_dirs = self.compiler.include_dirs + ['/usr/include']
+ lib_dirs = self.compiler.library_dirs
+ inc_dirs = self.compiler.include_dirs
exts = []
missing = []

View File

@ -0,0 +1,38 @@
diff -Naur Python-2.6.6/setup.py Python-2.6.6.patch/setup.py
--- Python-2.6.6/setup.py 2010-11-03 00:17:10.403608974 +0100
+++ Python-2.6.6.patch/setup.py 2010-11-03 00:23:31.624025348 +0100
@@ -18,7 +18,14 @@
from distutils.spawn import find_executable
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+try:
+ disabled_module_list = os.environ["PYTHON_DISABLE_MODULES"].split()
+except KeyError:
+ disabled_module_list = []
+try:
+ disable_ssl = os.environ["PYTHON_DISABLE_SSL"]
+except KeyError:
+ disable_ssl = 0
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -361,6 +368,8 @@
return sys.platform
def detect_modules(self):
+ global disable_ssl
+
try:
modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
except KeyError:
@@ -714,7 +723,8 @@
] )
if (ssl_incs is not None and
- ssl_libs is not None):
+ ssl_libs is not None and
+ not disable_ssl):
exts.append( Extension('_ssl', ['_ssl.c'],
include_dirs = ssl_incs,
library_dirs = ssl_libs,