mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
Python: update to Python-2.7.2
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
0850e1e5f8
commit
ab0c51f40b
@ -66,13 +66,14 @@ setup_toolchain target
|
||||
|
||||
strip_lto
|
||||
|
||||
#LDFLAGS="$LDFLAGS -lexpat -lffi" \
|
||||
#LDFLAGS="$LDFLAGS -lffi" \
|
||||
ac_cv_file_dev_ptc=no \
|
||||
ac_cv_file_dev_ptmx=yes \
|
||||
ac_cv_func_lchflags_works=no \
|
||||
ac_cv_func_chflags_works=no \
|
||||
ac_cv_func_printf_zd=yes \
|
||||
OPT="$CFLAGS -fno-strict-aliasing" \
|
||||
LDFLAGS="$LDFLAGS -lexpat -lffi" \
|
||||
../configure --host=$TARGET_NAME \
|
||||
--build=$HOST_NAME \
|
||||
--cache-file=config.cache \
|
||||
@ -91,6 +92,7 @@ LDFLAGS="$LDFLAGS -lexpat -lffi" \
|
||||
--without-wctype-functions \
|
||||
--without-cxx-main \
|
||||
--with-system-ffi \
|
||||
--with-system-expat \
|
||||
|
||||
make -j1 CC="$TARGET_CC" \
|
||||
HOSTPYTHON=../.objdir-host/hostpython \
|
||||
@ -121,6 +123,6 @@ make -j1 CC="$TARGET_CC" \
|
||||
rm -rf $ROOT/$TOOLCHAIN/bin/python*-config
|
||||
|
||||
sed -e "s:%PREFIX%:$SYSROOT_PREFIX/usr:g" -e "s:%CFLAGS%:$TARGET_CFLAGS:g" \
|
||||
$ROOT/$PKG_DIR/scripts/python-config > $ROOT/$TOOLCHAIN/bin/python2.6-config
|
||||
chmod +x $ROOT/$TOOLCHAIN/bin/python2.6-config
|
||||
ln -s python2.6-config $ROOT/$TOOLCHAIN/bin/python-config
|
||||
$ROOT/$PKG_DIR/scripts/python-config > $ROOT/$TOOLCHAIN/bin/python2.7-config
|
||||
chmod +x $ROOT/$TOOLCHAIN/bin/python2.7-config
|
||||
ln -s python2.7-config $ROOT/$TOOLCHAIN/bin/python-config
|
||||
|
@ -22,15 +22,19 @@
|
||||
|
||||
. config/options $1
|
||||
|
||||
PYTHON_VERSION=2.6
|
||||
PYTHON_VERSION=2.7
|
||||
PYTHON_LIB_DIR=$INSTALL/usr/lib/python$PYTHON_VERSION
|
||||
|
||||
mkdir -p $INSTALL/usr/bin
|
||||
cp $PKG_BUILD/.objdir-target/python $INSTALL/usr/bin/
|
||||
|
||||
mkdir -p $INSTALL/usr/lib
|
||||
cp -PR $PKG_BUILD/.objdir-target/libpython2.6.so.1.0 $INSTALL/usr/lib/
|
||||
ln -sf libpython2.6.so.1.0 $INSTALL/usr/lib/libpython2.6.so
|
||||
cp -PR $PKG_BUILD/.objdir-target/libpython2.7.so.1.0 $INSTALL/usr/lib/
|
||||
ln -sf libpython2.7.so.1.0 $INSTALL/usr/lib/libpython2.7.so
|
||||
|
||||
mkdir -p $PYTHON_LIB_DIR/config
|
||||
cp $PKG_BUILD/.objdir-target/Makefile $PYTHON_LIB_DIR/config
|
||||
cp $PKG_BUILD/.objdir-target/pyconfig.h $PYTHON_LIB_DIR/config
|
||||
|
||||
mkdir -p $PYTHON_LIB_DIR/lib-dynload
|
||||
cp $PKG_BUILD/.objdir-target/build/lib*/*.so $PYTHON_LIB_DIR/lib-dynload
|
||||
|
@ -19,12 +19,12 @@
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="Python"
|
||||
PKG_VERSION="2.6.6"
|
||||
PKG_VERSION="2.7.2"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="OSS"
|
||||
PKG_SITE="http://www.python.org/"
|
||||
PKG_URL="http://www.python.org/ftp/python/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2"
|
||||
PKG_URL="http://www.python.org/ftp/python/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz"
|
||||
PKG_DEPENDS="zlib openssl libffi file"
|
||||
PKG_BUILD_DEPENDS="toolchain expat-host sqlite expat zlib-host zlib openssl libffi"
|
||||
PKG_PRIORITY="optional"
|
||||
|
@ -1,294 +0,0 @@
|
||||
diff -u Python-2.6.6_orig/configure Python-2.6.6/configure
|
||||
--- Python-2.6.6_orig/configure 2010-05-24 22:27:03.000000000 -0400
|
||||
+++ Python-2.6.6/configure 2010-09-18 11:10:35.127976185 -0400
|
||||
@@ -12760,12 +12760,12 @@
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5
|
||||
$as_echo_n "checking for %zd printf() format support... " >&6; }
|
||||
-if test "$cross_compiling" = yes; then :
|
||||
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
-as_fn_error "cannot run test program while cross compiling
|
||||
-See \`config.log' for more details." "$LINENO" 5; }
|
||||
-else
|
||||
+#if test "$cross_compiling" = yes; then :
|
||||
+# { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
+#$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
+#as_fn_error "cannot run test program while cross compiling
|
||||
+#See \`config.log' for more details." "$LINENO" 5; }
|
||||
+#else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <stdio.h>
|
||||
@@ -12815,7 +12815,7 @@
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
-fi
|
||||
+#fi
|
||||
|
||||
|
||||
ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "
|
||||
diff -u Python-2.6.6_orig/configure.in Python-2.6.6/configure.in
|
||||
--- Python-2.6.6_orig/configure.in 2010-05-24 22:27:03.000000000 -0400
|
||||
+++ Python-2.6.6/configure.in 2010-09-18 11:34:37.583770305 -0400
|
||||
@@ -3860,48 +3860,48 @@
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
-AC_MSG_CHECKING(for %zd printf() format support)
|
||||
-AC_TRY_RUN([#include <stdio.h>
|
||||
-#include <stddef.h>
|
||||
-#include <string.h>
|
||||
-
|
||||
-#ifdef HAVE_SYS_TYPES_H
|
||||
-#include <sys/types.h>
|
||||
-#endif
|
||||
-
|
||||
-#ifdef HAVE_SSIZE_T
|
||||
-typedef ssize_t Py_ssize_t;
|
||||
-#elif SIZEOF_VOID_P == SIZEOF_LONG
|
||||
-typedef long Py_ssize_t;
|
||||
-#else
|
||||
-typedef int Py_ssize_t;
|
||||
-#endif
|
||||
-
|
||||
-int main()
|
||||
-{
|
||||
- char buffer[256];
|
||||
-
|
||||
- if(sprintf(buffer, "%zd", (size_t)123) < 0)
|
||||
- return 1;
|
||||
-
|
||||
- if (strcmp(buffer, "123"))
|
||||
- return 1;
|
||||
-
|
||||
- if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
|
||||
- return 1;
|
||||
-
|
||||
- if (strcmp(buffer, "-123"))
|
||||
- return 1;
|
||||
-
|
||||
- return 0;
|
||||
-}],
|
||||
-[AC_MSG_RESULT(yes)
|
||||
- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
|
||||
- AC_MSG_RESULT(no))
|
||||
+#AC_MSG_CHECKING(for %zd printf() format support)
|
||||
+#AC_TRY_RUN([#include <stdio.h>
|
||||
+##include <stddef.h>
|
||||
+##include <string.h>
|
||||
+#
|
||||
+##ifdef HAVE_SYS_TYPES_H
|
||||
+##include <sys/types.h>
|
||||
+##endif
|
||||
+#
|
||||
+##ifdef HAVE_SSIZE_T
|
||||
+#typedef ssize_t Py_ssize_t;
|
||||
+##elif SIZEOF_VOID_P == SIZEOF_LONG
|
||||
+#typedef long Py_ssize_t;
|
||||
+##else
|
||||
+#typedef int Py_ssize_t;
|
||||
+##endif
|
||||
+#
|
||||
+#int main()
|
||||
+#{
|
||||
+# char buffer[256];
|
||||
+#
|
||||
+# if(sprintf(buffer, "%zd", (size_t)123) < 0)
|
||||
+# return 1;
|
||||
+#
|
||||
+# if (strcmp(buffer, "123"))
|
||||
+# return 1;
|
||||
+#
|
||||
+# if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
|
||||
+# return 1;
|
||||
+#
|
||||
+# if (strcmp(buffer, "-123"))
|
||||
+# return 1;
|
||||
+#
|
||||
+# return 0;
|
||||
+#}],
|
||||
+#[AC_MSG_RESULT(yes)
|
||||
+# AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
|
||||
+# AC_MSG_RESULT(no))
|
||||
|
||||
AC_CHECK_TYPE(socklen_t,,
|
||||
AC_DEFINE(socklen_t,int,
|
||||
- Define to `int' if <sys/socket.h> does not define.),[
|
||||
+ Define to 'int' if <sys/socket.h> does not define.),[
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
diff -u Python-2.6.6_orig/Makefile.pre.in Python-2.6.6/Makefile.pre.in
|
||||
--- Python-2.6.6_orig/Makefile.pre.in 2010-08-01 18:05:31.000000000 -0400
|
||||
+++ Python-2.6.6/Makefile.pre.in 2010-09-18 11:21:40.171999625 -0400
|
||||
@@ -175,6 +175,7 @@
|
||||
|
||||
PYTHON= python$(EXE)
|
||||
BUILDPYTHON= python$(BUILDEXE)
|
||||
+HOSTPYTHON= ./$(BUILDPYTHON)
|
||||
|
||||
# The task to run while instrument when building the profile-opt target
|
||||
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
|
||||
@@ -205,6 +206,7 @@
|
||||
##########################################################################
|
||||
# Parser
|
||||
PGEN= Parser/pgen$(EXE)
|
||||
+HOSTPGEN= $(PGEN)
|
||||
|
||||
POBJS= \
|
||||
Parser/acceler.o \
|
||||
@@ -394,8 +396,8 @@
|
||||
# Build the shared modules
|
||||
sharedmods: $(BUILDPYTHON)
|
||||
@case $$MAKEFLAGS in \
|
||||
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
|
||||
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
|
||||
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
esac
|
||||
|
||||
# Build static library
|
||||
@@ -517,7 +519,7 @@
|
||||
|
||||
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
|
||||
-@$(INSTALL) -d Include
|
||||
- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
|
||||
$(PGEN): $(PGENOBJS)
|
||||
$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
|
||||
@@ -886,24 +888,24 @@
|
||||
done; \
|
||||
done
|
||||
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
||||
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
-d $(LIBDEST) -f \
|
||||
-x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
|
||||
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
-d $(LIBDEST) -f \
|
||||
-x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
|
||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
-d $(LIBDEST)/site-packages -f \
|
||||
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
|
||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
-d $(LIBDEST)/site-packages -f \
|
||||
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
|
||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
|
||||
+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
|
||||
|
||||
# Create the PLATDIR source directory, if one wasn't distributed..
|
||||
$(srcdir)/Lib/$(PLATDIR):
|
||||
@@ -1001,7 +1003,8 @@
|
||||
# Install the dynamically loadable modules
|
||||
# This goes into $(exec_prefix)
|
||||
sharedinstall:
|
||||
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
|
||||
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
|
||||
+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
|
||||
--prefix=$(prefix) \
|
||||
--install-scripts=$(BINDIR) \
|
||||
--install-platlib=$(DESTSHARED) \
|
||||
diff -u Python-2.6.6_orig/setup.py Python-2.6.6/setup.py
|
||||
--- Python-2.6.6_orig/setup.py 2010-07-17 08:31:09.000000000 -0400
|
||||
+++ Python-2.6.6/setup.py 2010-09-18 11:27:51.803983388 -0400
|
||||
@@ -313,33 +313,39 @@
|
||||
self.announce('WARNING: skipping import check for Cygwin-based "%s"'
|
||||
% ext.name)
|
||||
return
|
||||
+ if os.environ.get('CROSS_COMPILE_TARGET') == 'yes':
|
||||
+ return
|
||||
ext_filename = os.path.join(
|
||||
self.build_lib,
|
||||
self.get_ext_filename(self.get_ext_fullname(ext.name)))
|
||||
try:
|
||||
imp.load_dynamic(ext.name, ext_filename)
|
||||
except ImportError, why:
|
||||
- self.failed.append(ext.name)
|
||||
- self.announce('*** WARNING: renaming "%s" since importing it'
|
||||
- ' failed: %s' % (ext.name, why), level=3)
|
||||
- assert not self.inplace
|
||||
- basename, tail = os.path.splitext(ext_filename)
|
||||
- newname = basename + "_failed" + tail
|
||||
- if os.path.exists(newname):
|
||||
- os.remove(newname)
|
||||
- os.rename(ext_filename, newname)
|
||||
-
|
||||
- # XXX -- This relies on a Vile HACK in
|
||||
- # distutils.command.build_ext.build_extension(). The
|
||||
- # _built_objects attribute is stored there strictly for
|
||||
- # use here.
|
||||
- # If there is a failure, _built_objects may not be there,
|
||||
- # so catch the AttributeError and move on.
|
||||
- try:
|
||||
- for filename in self._built_objects:
|
||||
- os.remove(filename)
|
||||
- except AttributeError:
|
||||
- self.announce('unable to remove files (ignored)')
|
||||
+ if os.environ.get('CROSS_COMPILE_TARGET') != "yes":
|
||||
+ self.announce('*** WARNING: renaming "%s" since importing it'
|
||||
+ ' failed: %s' % (ext.name, why), level=3)
|
||||
+ assert not self.inplace
|
||||
+ basename, tail = os.path.splitext(ext_filename)
|
||||
+ newname = basename + "_failed" + tail
|
||||
+ if os.path.exists(newname):
|
||||
+ os.remove(newname)
|
||||
+ os.rename(ext_filename, newname)
|
||||
+
|
||||
+ # XXX -- This relies on a Vile HACK in
|
||||
+ # distutils.command.build_ext.build_extension(). The
|
||||
+ # _built_objects attribute is stored there strictly for
|
||||
+ # use here.
|
||||
+ # If there is a failure, _built_objects may not be there,
|
||||
+ # so catch the AttributeError and move on.
|
||||
+ try:
|
||||
+ for filename in self._built_objects:
|
||||
+ os.remove(filename)
|
||||
+ except AttributeError:
|
||||
+ self.announce('unable to remove files (ignored)')
|
||||
+ else:
|
||||
+ self.announce('WARNING: "%s" failed importing, but we leave it '
|
||||
+ 'because we are cross-compiling' %
|
||||
+ ext.name)
|
||||
except:
|
||||
exc_type, why, tb = sys.exc_info()
|
||||
self.announce('*** WARNING: importing extension "%s" '
|
||||
@@ -742,7 +748,7 @@
|
||||
|
||||
if (ssl_incs is not None and
|
||||
ssl_libs is not None and
|
||||
- openssl_ver >= 0x00907000):
|
||||
+ openssl_ver >= 0x00907000 and False):
|
||||
# The _hashlib module wraps optimized implementations
|
||||
# of hash functions from the OpenSSL library.
|
||||
exts.append( Extension('_hashlib', ['_hashopenssl.c'],
|
||||
@@ -762,7 +768,7 @@
|
||||
depends = ['md5.h']) )
|
||||
missing.append('_hashlib')
|
||||
|
||||
- if (openssl_ver < 0x00908000):
|
||||
+ if (True or openssl_ver < 0x00908000):
|
||||
# OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
|
||||
exts.append( Extension('_sha256', ['sha256module.c']) )
|
||||
exts.append( Extension('_sha512', ['sha512module.c']) )
|
||||
@@ -1823,7 +1829,7 @@
|
||||
ffi_configfile):
|
||||
from distutils.dir_util import mkpath
|
||||
mkpath(ffi_builddir)
|
||||
- config_args = []
|
||||
+ config_args = sysconfig.get_config_var("CONFIG_ARGS").split(" ")
|
||||
|
||||
# Pass empty CFLAGS because we'll just append the resulting
|
||||
# CFLAGS to Python's; -g or -O2 is to be avoided.
|
@ -1,21 +0,0 @@
|
||||
diff -Naur Python-2.6.6/setup.py Python-2.6.6.patch/setup.py
|
||||
--- Python-2.6.6/setup.py 2011-05-27 13:46:39.977454633 +0200
|
||||
+++ Python-2.6.6.patch/setup.py 2011-05-27 13:47:28.200047208 +0200
|
||||
@@ -758,7 +758,7 @@
|
||||
|
||||
if (ssl_incs is not None and
|
||||
ssl_libs is not None and
|
||||
- openssl_ver >= 0x00907000 and False):
|
||||
+ openssl_ver >= 0x00907000):
|
||||
# The _hashlib module wraps optimized implementations
|
||||
# of hash functions from the OpenSSL library.
|
||||
exts.append( Extension('_hashlib', ['_hashopenssl.c'],
|
||||
@@ -778,7 +778,7 @@
|
||||
depends = ['md5.h']) )
|
||||
missing.append('_hashlib')
|
||||
|
||||
- if (True or openssl_ver < 0x00908000):
|
||||
+ if (openssl_ver < 0x00908000):
|
||||
# OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
|
||||
exts.append( Extension('_sha256', ['sha256module.c']) )
|
||||
exts.append( Extension('_sha512', ['sha512module.c']) )
|
@ -1,96 +0,0 @@
|
||||
|
||||
# HG changeset patch
|
||||
# User Gregory P. Smith <greg@mad-scientist.com>
|
||||
# Date 1292338973 0
|
||||
# Node ID 072ee3f743c21f3770ccf13ad48e10a18048063f
|
||||
# Parent 8ccf58b0a5da776006d7fc98d9e6975c82265a78
|
||||
Merged revisions 87233 via svnmerge from
|
||||
svn+ssh://pythondev@svn.python.org/python/branches/py3k
|
||||
|
||||
........
|
||||
r87233 | gregory.p.smith | 2010-12-14 06:38:00 -0800 (Tue, 14 Dec 2010) | 4 lines
|
||||
|
||||
Issue #1731717: Fixed the problem where subprocess.wait() could cause an
|
||||
OSError exception when The OS had been told to ignore SIGCLD in our process
|
||||
or otherwise not wait for exiting child processes.
|
||||
........
|
||||
|
||||
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
|
||||
--- a/Lib/subprocess.py
|
||||
+++ b/Lib/subprocess.py
|
||||
@@ -1194,7 +1194,11 @@ class Popen(object):
|
||||
os.close(errpipe_read)
|
||||
|
||||
if data != "":
|
||||
- _eintr_retry_call(os.waitpid, self.pid, 0)
|
||||
+ try:
|
||||
+ _eintr_retry_call(os.waitpid, self.pid, 0)
|
||||
+ except OSError as e:
|
||||
+ if e.errno != errno.ECHILD:
|
||||
+ raise
|
||||
child_exception = pickle.loads(data)
|
||||
for fd in (p2cwrite, c2pread, errread):
|
||||
if fd is not None:
|
||||
@@ -1240,7 +1244,15 @@ class Popen(object):
|
||||
"""Wait for child process to terminate. Returns returncode
|
||||
attribute."""
|
||||
if self.returncode is None:
|
||||
- pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
|
||||
+ try:
|
||||
+ pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
|
||||
+ except OSError as e:
|
||||
+ if e.errno != errno.ECHILD:
|
||||
+ raise
|
||||
+ # This happens if SIGCLD is set to be ignored or waiting
|
||||
+ # for child processes has otherwise been disabled for our
|
||||
+ # process. This child is dead, we can't get the status.
|
||||
+ sts = 0
|
||||
self._handle_exitstatus(sts)
|
||||
return self.returncode
|
||||
|
||||
diff --git a/Lib/test/subprocessdata/sigchild_ignore.py b/Lib/test/subprocessdata/sigchild_ignore.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/Lib/test/subprocessdata/sigchild_ignore.py
|
||||
@@ -0,0 +1,6 @@
|
||||
+import signal, subprocess, sys
|
||||
+# On Linux this causes os.waitpid to fail with OSError as the OS has already
|
||||
+# reaped our child process. The wait() passing the OSError on to the caller
|
||||
+# and causing us to exit with an error is what we are testing against.
|
||||
+signal.signal(signal.SIGCLD, signal.SIG_IGN)
|
||||
+subprocess.Popen([sys.executable, '-c', 'print("albatross")']).wait()
|
||||
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
|
||||
--- a/Lib/test/test_subprocess.py
|
||||
+++ b/Lib/test/test_subprocess.py
|
||||
@@ -778,6 +778,16 @@ class POSIXProcessTestCase(BaseTestCase)
|
||||
self.assertStderrEqual(stderr, '')
|
||||
self.assertEqual(p.wait(), -signal.SIGTERM)
|
||||
|
||||
+ def test_wait_when_sigchild_ignored(self):
|
||||
+ # NOTE: sigchild_ignore.py may not be an effective test on all OSes.
|
||||
+ sigchild_ignore = test_support.findfile("sigchild_ignore.py",
|
||||
+ subdir="subprocessdata")
|
||||
+ p = subprocess.Popen([sys.executable, sigchild_ignore],
|
||||
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
+ stdout, stderr = p.communicate()
|
||||
+ self.assertEqual(0, p.returncode, "sigchild_ignore.py exited"
|
||||
+ " non-zero with this error:\n%s" % stderr)
|
||||
+
|
||||
|
||||
@unittest.skipUnless(mswindows, "Windows specific tests")
|
||||
class Win32ProcessTestCase(BaseTestCase):
|
||||
diff --git a/Misc/NEWS b/Misc/NEWS
|
||||
--- a/Misc/NEWS
|
||||
+++ b/Misc/NEWS
|
||||
@@ -34,6 +34,10 @@ Library
|
||||
|
||||
- Issue #10464: netrc now correctly handles lines with embedded '#' characters.
|
||||
|
||||
+- Issue #1731717: Fixed the problem where subprocess.wait() could cause an
|
||||
+ OSError exception when The OS had been told to ignore SIGCLD in our process
|
||||
+ or otherwise not wait for exiting child processes.
|
||||
+
|
||||
Extension Modules
|
||||
-----------------
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
diff -Naur Python-2.6.6/Modules/_ctypes/_ctypes.c Python-2.6.6.patch/Modules/_ctypes/_ctypes.c
|
||||
--- Python-2.6.6/Modules/_ctypes/_ctypes.c 2010-05-09 17:15:40.000000000 +0200
|
||||
+++ Python-2.6.6.patch/Modules/_ctypes/_ctypes.c 2011-07-15 22:18:27.367156921 +0200
|
||||
@@ -5521,36 +5521,42 @@
|
||||
Struct_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Struct_Type) < 0)
|
||||
return;
|
||||
+ Py_INCREF(&Struct_Type);
|
||||
PyModule_AddObject(m, "Structure", (PyObject *)&Struct_Type);
|
||||
|
||||
Py_TYPE(&Union_Type) = &UnionType_Type;
|
||||
Union_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Union_Type) < 0)
|
||||
return;
|
||||
+ Py_INCREF(&Union_Type);
|
||||
PyModule_AddObject(m, "Union", (PyObject *)&Union_Type);
|
||||
|
||||
Py_TYPE(&Pointer_Type) = &PointerType_Type;
|
||||
Pointer_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Pointer_Type) < 0)
|
||||
return;
|
||||
+ Py_INCREF(&Pointer_Type);
|
||||
PyModule_AddObject(m, "_Pointer", (PyObject *)&Pointer_Type);
|
||||
|
||||
Py_TYPE(&Array_Type) = &ArrayType_Type;
|
||||
Array_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Array_Type) < 0)
|
||||
return;
|
||||
+ Py_INCREF(&Array_Type);
|
||||
PyModule_AddObject(m, "Array", (PyObject *)&Array_Type);
|
||||
|
||||
Py_TYPE(&Simple_Type) = &SimpleType_Type;
|
||||
Simple_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&Simple_Type) < 0)
|
||||
return;
|
||||
+ Py_INCREF(&Simple_Type);
|
||||
PyModule_AddObject(m, "_SimpleCData", (PyObject *)&Simple_Type);
|
||||
|
||||
Py_TYPE(&CFuncPtr_Type) = &CFuncPtrType_Type;
|
||||
CFuncPtr_Type.tp_base = &CData_Type;
|
||||
if (PyType_Ready(&CFuncPtr_Type) < 0)
|
||||
return;
|
||||
+ Py_INCREF(&CFuncPtr_Type);
|
||||
PyModule_AddObject(m, "CFuncPtr", (PyObject *)&CFuncPtr_Type);
|
||||
|
||||
/*************************************************
|
135
packages/lang/Python/patches/Python-2.7.2-001_xcompile.patch
Normal file
135
packages/lang/Python/patches/Python-2.7.2-001_xcompile.patch
Normal file
@ -0,0 +1,135 @@
|
||||
diff -Naur Python-2.7.2/configure Python-2.7.2.patch/configure
|
||||
--- Python-2.7.2/configure 2011-06-11 17:46:28.000000000 +0200
|
||||
+++ Python-2.7.2.patch/configure 2011-10-25 13:10:19.311789641 +0200
|
||||
@@ -13673,7 +13673,7 @@
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
- ac_cv_have_long_long_format=no
|
||||
+ ac_cv_have_long_long_format="cross -- assuming yes"
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
@@ -13725,7 +13725,7 @@
|
||||
$as_echo "$ac_cv_have_long_long_format" >&6; }
|
||||
fi
|
||||
|
||||
-if test "$ac_cv_have_long_long_format" = yes
|
||||
+if test "$ac_cv_have_long_long_format" != no
|
||||
then
|
||||
|
||||
$as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h
|
||||
diff -Naur Python-2.7.2/Makefile.pre.in Python-2.7.2.patch/Makefile.pre.in
|
||||
--- Python-2.7.2/Makefile.pre.in 2011-06-11 17:46:26.000000000 +0200
|
||||
+++ Python-2.7.2.patch/Makefile.pre.in 2011-10-25 13:11:38.879809670 +0200
|
||||
@@ -182,6 +182,7 @@
|
||||
|
||||
PYTHON= python$(EXE)
|
||||
BUILDPYTHON= python$(BUILDEXE)
|
||||
+HOSTPYTHON= ./$(BUILDPYTHON)
|
||||
|
||||
# The task to run while instrument when building the profile-opt target
|
||||
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
|
||||
@@ -215,6 +216,8 @@
|
||||
# Parser
|
||||
PGEN= Parser/pgen$(EXE)
|
||||
|
||||
+HOSTPGEN= $(PGEN)
|
||||
+
|
||||
POBJS= \
|
||||
Parser/acceler.o \
|
||||
Parser/grammar1.o \
|
||||
@@ -407,8 +410,8 @@
|
||||
# Build the shared modules
|
||||
sharedmods: $(BUILDPYTHON)
|
||||
@case $$MAKEFLAGS in \
|
||||
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
|
||||
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
|
||||
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
esac
|
||||
|
||||
# Build static library
|
||||
@@ -542,7 +545,7 @@
|
||||
$(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
|
||||
Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
|
||||
-@$(INSTALL) -d Include
|
||||
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
-touch Parser/pgen.stamp
|
||||
|
||||
$(PGEN): $(PGENOBJS)
|
||||
@@ -925,26 +928,26 @@
|
||||
done; \
|
||||
done
|
||||
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
||||
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ -PYTHONPATH=$(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) \
|
||||
- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ -PYTHONPATH=$(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) \
|
||||
- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
-d $(LIBDEST)/site-packages -f \
|
||||
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
|
||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||
-d $(LIBDEST)/site-packages -f \
|
||||
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
|
||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||
- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
|
||||
+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
|
||||
|
||||
# Create the PLATDIR source directory, if one wasn't distributed..
|
||||
$(srcdir)/Lib/$(PLATDIR):
|
||||
@@ -1049,7 +1052,9 @@
|
||||
# Install the dynamically loadable modules
|
||||
# This goes into $(exec_prefix)
|
||||
sharedinstall: sharedmods
|
||||
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
|
||||
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
||||
+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
|
||||
+ --skip-build \
|
||||
--prefix=$(prefix) \
|
||||
--install-scripts=$(BINDIR) \
|
||||
--install-platlib=$(DESTSHARED) \
|
||||
diff -Naur Python-2.7.2/setup.py Python-2.7.2.patch/setup.py
|
||||
--- Python-2.7.2/setup.py 2011-06-11 17:46:28.000000000 +0200
|
||||
+++ Python-2.7.2.patch/setup.py 2011-10-25 13:10:19.300789501 +0200
|
||||
@@ -23,6 +23,10 @@
|
||||
# This global variable is used to hold the list of modules to be disabled.
|
||||
disabled_module_list = []
|
||||
|
||||
+# _ctypes fails to cross-compile due to the libffi configure script.
|
||||
+#if os.environ.has_key('PYTHONXCPREFIX'):
|
||||
+# disabled_module_list.append('_ctypes')
|
||||
+
|
||||
def add_dir_to_list(dirlist, dir):
|
||||
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
|
||||
1) 'dir' is not already in 'dirlist'
|
||||
@@ -278,6 +282,14 @@
|
||||
(ext.name, sys.exc_info()[1]))
|
||||
self.failed.append(ext.name)
|
||||
return
|
||||
+
|
||||
+ # Inport check will not work when cross-compiling.
|
||||
+ if os.environ.has_key('PYTHONXCPREFIX'):
|
||||
+ self.announce(
|
||||
+ 'WARNING: skipping inport check for cross-compiled: "%s"' %
|
||||
+ ext.name)
|
||||
+ return
|
||||
+
|
||||
# Workaround for Mac OS X: The Carbon-based modules cannot be
|
||||
# reliably imported into a command-line Python
|
||||
if 'Carbon' in ext.extra_link_args:
|
@ -1,13 +1,14 @@
|
||||
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
|
||||
diff -Naur Python-2.7.2/setup.py Python-2.7.2.patch/setup.py
|
||||
--- Python-2.7.2/setup.py 2011-10-25 14:07:59.520264628 +0200
|
||||
+++ Python-2.7.2.patch/setup.py 2011-10-25 14:16:32.218793079 +0200
|
||||
@@ -380,10 +380,19 @@
|
||||
os.unlink(tmpfile)
|
||||
|
||||
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')
|
||||
- self.add_multiarch_paths()
|
||||
+ try:
|
||||
+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
|
||||
+ except KeyError:
|
||||
@ -16,6 +17,7 @@ diff -Naur Python-2.6.6/setup.py Python-2.6.6.patch/setup.py
|
||||
+ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
|
||||
+ except KeyError:
|
||||
+ modules_lib_dirs = ['/usr/lib']
|
||||
+ self.add_multiarch_paths()
|
||||
+ for dir in modules_include_dirs:
|
||||
+ add_dir_to_list(self.compiler.include_dirs, dir)
|
||||
+ for dir in modules_lib_dirs:
|
||||
@ -23,11 +25,16 @@ diff -Naur Python-2.6.6/setup.py Python-2.6.6.patch/setup.py
|
||||
|
||||
# Add paths specified in the environment variables LDFLAGS and
|
||||
# CPPFLAGS for header and library files.
|
||||
@@ -399,12 +408,6 @@
|
||||
@@ -419,17 +428,6 @@
|
||||
for directory in reversed(options.dirs):
|
||||
add_dir_to_list(dir_list, directory)
|
||||
|
||||
- if os.path.normpath(sys.prefix) != '/usr':
|
||||
- if os.path.normpath(sys.prefix) != '/usr' \
|
||||
- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
|
||||
- # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
|
||||
- # (PYTHONFRAMEWORK is set) to avoid # linking problems when
|
||||
- # building a framework with different architectures than
|
||||
- # the one that is currently installed (issue #7473)
|
||||
- add_dir_to_list(self.compiler.library_dirs,
|
||||
- sysconfig.get_config_var("LIBDIR"))
|
||||
- add_dir_to_list(self.compiler.include_dirs,
|
||||
@ -36,7 +43,7 @@ diff -Naur Python-2.6.6/setup.py Python-2.6.6.patch/setup.py
|
||||
try:
|
||||
have_unicode = unicode
|
||||
except NameError:
|
||||
@@ -413,11 +416,8 @@
|
||||
@@ -438,11 +436,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.
|
@ -0,0 +1,24 @@
|
||||
diff -Naur Python-2.7.2/setup.py Python-2.7.2.patch/setup.py
|
||||
--- Python-2.7.2/setup.py 2011-10-26 01:53:16.014387508 +0200
|
||||
+++ Python-2.7.2.patch/setup.py 2011-10-26 02:20:08.236706196 +0200
|
||||
@@ -1877,12 +1877,18 @@
|
||||
ffi_configfile):
|
||||
from distutils.dir_util import mkpath
|
||||
mkpath(ffi_builddir)
|
||||
- config_args = []
|
||||
+
|
||||
+ #NOTE: best solution is to add to configure script
|
||||
+ # as config subdirectory and to exclude darwin
|
||||
+ # (see configure_ctypes_darwin).
|
||||
+ #FIXME: lets for now pass all top configure arguments
|
||||
+ #and do not modify configure script.
|
||||
+ config_args = sysconfig.get_config_var("CONFIG_ARGS")
|
||||
|
||||
# Pass empty CFLAGS because we'll just append the resulting
|
||||
# CFLAGS to Python's; -g or -O2 is to be avoided.
|
||||
cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
|
||||
- % (ffi_builddir, ffi_srcdir, " ".join(config_args))
|
||||
+ % (ffi_builddir, ffi_srcdir, config_args)
|
||||
|
||||
res = os.system(cmd)
|
||||
if res or not os.path.exists(ffi_configfile):
|
@ -0,0 +1,37 @@
|
||||
diff -Naur Python-2.7.2/Makefile.pre.in Python-2.7.2.patch/Makefile.pre.in
|
||||
--- Python-2.7.2/Makefile.pre.in 2011-10-26 01:53:09.752305358 +0200
|
||||
+++ Python-2.7.2.patch/Makefile.pre.in 2011-10-26 01:57:20.158587315 +0200
|
||||
@@ -410,8 +410,8 @@
|
||||
# Build the shared modules
|
||||
sharedmods: $(BUILDPYTHON)
|
||||
@case $$MAKEFLAGS in \
|
||||
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
|
||||
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' CONFIG_ARGS="$(CONFIG_ARGS)" $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
|
||||
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' CONFIG_ARGS="$(CONFIG_ARGS)" $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
esac
|
||||
|
||||
# Build static library
|
||||
@@ -1053,7 +1053,7 @@
|
||||
# This goes into $(exec_prefix)
|
||||
sharedinstall: sharedmods
|
||||
CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
||||
- $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
|
||||
+ $(RUNSHARED) CONFIG_ARGS="$(CONFIG_ARGS)" $(HOSTPYTHON) -E $(srcdir)/setup.py install \
|
||||
--skip-build \
|
||||
--prefix=$(prefix) \
|
||||
--install-scripts=$(BINDIR) \
|
||||
diff -Naur Python-2.7.2/setup.py Python-2.7.2.patch/setup.py
|
||||
--- Python-2.7.2/setup.py 2011-10-26 01:53:16.014387508 +0200
|
||||
+++ Python-2.7.2.patch/setup.py 2011-10-26 01:53:46.158782904 +0200
|
||||
@@ -20,6 +20,9 @@
|
||||
# Were we compiled --with-pydebug or with #define Py_DEBUG?
|
||||
COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
|
||||
|
||||
+sysconfig.get_config_vars()
|
||||
+sysconfig._CONFIG_VARS.update(os.environ)
|
||||
+
|
||||
# This global variable is used to hold the list of modules to be disabled.
|
||||
try:
|
||||
disabled_module_list = os.environ["PYTHON_DISABLE_MODULES"].split()
|
||||
diff -Naur Python-2.7.2/setup.py.orig Python-2.7.2.patch/setup.py.orig
|
@ -0,0 +1,76 @@
|
||||
Change the location of pyconfig.h
|
||||
|
||||
The Python interpreter has a really strange behaviour: at *runtime*,
|
||||
it reads a Makefile and a header file named pyconfig.h to get some
|
||||
information about the configuration.
|
||||
|
||||
The Makefile is located in usr/lib/python2.7/config, which is fine
|
||||
since this location is kept on the target.
|
||||
|
||||
However, by default, the pyconfig.h is installed in
|
||||
usr/include/python2.7, but we completely remove the usr/include
|
||||
directory for the target. Since making an exception just for
|
||||
pyconfig.h is annoying, this patch also installs pyconfig.h to
|
||||
usr/lib/python2.7/config, and modifies the sysconfig module so that it
|
||||
looks in this location instead of usr/include.
|
||||
|
||||
The pyconfig.h is still kept in usr/include/python2.7, because it is
|
||||
needed in the $(STAGING_DIR) when building third-party Python
|
||||
extensions that contain C code.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
|
||||
---
|
||||
Lib/distutils/sysconfig.py | 3 ++-
|
||||
Lib/sysconfig.py | 2 +-
|
||||
Makefile.pre.in | 3 ++-
|
||||
3 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: Python-2.7.1/Lib/distutils/sysconfig.py
|
||||
===================================================================
|
||||
--- Python-2.7.1.orig/Lib/distutils/sysconfig.py
|
||||
+++ Python-2.7.1/Lib/distutils/sysconfig.py
|
||||
@@ -193,7 +193,8 @@
|
||||
else:
|
||||
inc_dir = project_base
|
||||
else:
|
||||
- inc_dir = get_python_inc(plat_specific=1)
|
||||
+ lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
|
||||
+ inc_dir = os.path.join(lib_dir, "config")
|
||||
if get_python_version() < '2.2':
|
||||
config_h = 'config.h'
|
||||
else:
|
||||
Index: Python-2.7.1/Lib/sysconfig.py
|
||||
===================================================================
|
||||
--- Python-2.7.1.orig/Lib/sysconfig.py
|
||||
+++ Python-2.7.1/Lib/sysconfig.py
|
||||
@@ -371,7 +371,7 @@
|
||||
else:
|
||||
inc_dir = _PROJECT_BASE
|
||||
else:
|
||||
- inc_dir = get_path('platinclude')
|
||||
+ inc_dir = os.path.join(get_path('stdlib'), "config")
|
||||
return os.path.join(inc_dir, 'pyconfig.h')
|
||||
|
||||
def get_scheme_names():
|
||||
Index: Python-2.7.1/Makefile.pre.in
|
||||
===================================================================
|
||||
--- Python-2.7.1.orig/Makefile.pre.in
|
||||
+++ Python-2.7.1/Makefile.pre.in
|
||||
@@ -967,7 +967,6 @@
|
||||
echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
|
||||
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
|
||||
done
|
||||
- $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
|
||||
|
||||
# Install the library and miscellaneous stuff needed for extending/embedding
|
||||
# This goes into $(exec_prefix)
|
||||
@@ -1001,6 +1000,8 @@
|
||||
$(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
|
||||
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
|
||||
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
|
||||
+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(LIBPL)/pyconfig.h
|
||||
+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
|
||||
$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
|
||||
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
|
||||
$(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
|
@ -1,7 +1,7 @@
|
||||
diff -Naur Python-2.6.6/Makefile.pre.in Python-2.6.6.patch/Makefile.pre.in
|
||||
--- Python-2.6.6/Makefile.pre.in 2010-10-19 22:20:12.198769633 +0200
|
||||
+++ Python-2.6.6.patch/Makefile.pre.in 2010-10-19 22:22:07.534168230 +0200
|
||||
@@ -384,7 +384,7 @@
|
||||
diff -Naur Python-2.7.2/Makefile.pre.in Python-2.7.2.patch/Makefile.pre.in
|
||||
--- Python-2.7.2/Makefile.pre.in 2011-10-25 16:20:40.178698198 +0200
|
||||
+++ Python-2.7.2.patch/Makefile.pre.in 2011-10-25 16:22:33.429160448 +0200
|
||||
@@ -398,7 +398,7 @@
|
||||
|
||||
|
||||
# Build the interpreter
|
||||
@ -10,26 +10,26 @@ diff -Naur Python-2.6.6/Makefile.pre.in Python-2.6.6.patch/Makefile.pre.in
|
||||
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
|
||||
Modules/python.o \
|
||||
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
|
||||
@@ -400,18 +400,6 @@
|
||||
*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
@@ -414,18 +414,6 @@
|
||||
*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
|
||||
esac
|
||||
|
||||
-# Build static library
|
||||
-# avoid long command lines, same as LIBRARY_OBJS
|
||||
-$(LIBRARY): $(LIBRARY_OBJS)
|
||||
- -rm -f $@
|
||||
- $(AR) cr $@ Modules/getbuildinfo.o
|
||||
- $(AR) cr $@ $(PARSER_OBJS)
|
||||
- $(AR) cr $@ $(OBJECT_OBJS)
|
||||
- $(AR) cr $@ $(PYTHON_OBJS)
|
||||
- $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
|
||||
- $(AR) cr $@ $(MODOBJS)
|
||||
- $(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 \
|
||||
$(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
@@ -947,18 +935,6 @@
|
||||
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
@@ -997,18 +985,6 @@
|
||||
else true; \
|
||||
fi; \
|
||||
done
|
||||
@ -48,3 +48,4 @@ diff -Naur Python-2.6.6/Makefile.pre.in Python-2.6.6.patch/Makefile.pre.in
|
||||
$(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
|
||||
diff -Naur Python-2.7.2/Makefile.pre.in.orig Python-2.7.2.patch/Makefile.pre.in.orig
|
@ -24,10 +24,10 @@
|
||||
case $1 in
|
||||
--prefix) echo "/usr" ;;
|
||||
--exec-prefix) echo "/usr" ;;
|
||||
--includes) echo "-I%PREFIX%/include/python2.6" ;;
|
||||
--libs) echo "-lpthread -ldl -lutil -lm -lpython2.6" ;;
|
||||
--cflags) echo "-I%PREFIX%/include/python2.6 -DNDEBUG %CFLAGS%" ;;
|
||||
--ldflags) echo "-lpthread -ldl -lutil -lm -lpython2.6" ;;
|
||||
--includes) echo "-I%PREFIX%/include/python2.7" ;;
|
||||
--libs) echo "-lpthread -ldl -lutil -lm -lpython2.7" ;;
|
||||
--cflags) echo "-I%PREFIX%/include/python2.7 -DNDEBUG %CFLAGS%" ;;
|
||||
--ldflags) echo "-lpthread -ldl -lutil -lm -lpython2.7" ;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
@ -139,7 +139,7 @@ fi
|
||||
# this fixes problems with faac implementation of ffmpeg
|
||||
LDFLAGS=`echo $LDFLAGS | sed -e "s|-Wl,--as-needed||"`
|
||||
|
||||
export PYTHON_VERSION="2.6"
|
||||
export PYTHON_VERSION="2.7"
|
||||
export PYTHON_CPPFLAGS="-I$SYSROOT_PREFIX/usr/include/python$PYTHON_VERSION"
|
||||
export PYTHON_LDFLAGS="-L$SYSROOT_PREFIX/usr/lib/python$PYTHON_VERSION -lpython$PYTHON_VERSION"
|
||||
export PYTHON_SITE_PKG="$SYSROOT_PREFIX/usr/lib/python$PYTHON_VERSION/site-packages"
|
||||
|
Loading…
x
Reference in New Issue
Block a user