Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] update to 2.7.10 #4284

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 21 additions & 33 deletions packages/lang/Python/package.mk
Expand Up @@ -17,14 +17,14 @@
################################################################################

PKG_NAME="Python"
PKG_VERSION="2.7.3"
PKG_VERSION="2.7.10"
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.xz"
PKG_DEPENDS_HOST="zlib:host"
PKG_DEPENDS_TARGET="toolchain Python:host sqlite expat zlib bzip2 libressl libffi"
PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 libressl libffi Python:host"
PKG_PRIORITY="optional"
PKG_SECTION="lang"
PKG_SHORTDESC="python: The Python programming language"
Expand All @@ -48,6 +48,9 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_file_dev_ptc=no \
ac_cv_buggy_getaddrinfo=no \
ac_cv_header_bluetooth_bluetooth_h=no \
ac_cv_header_bluetooth_h=no \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no \
ac_cv_have_long_long_format=yes \
--with-threads \
--enable-unicode=ucs4 \
--enable-ipv6 \
Expand All @@ -72,19 +75,6 @@ make_host() {
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES"
}

make_target() {
make -j1 CC="$TARGET_CC" \
HOSTPYTHON=$ROOT/$TOOLCHAIN/bin/python \
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
BLDSHARED="$CC -shared" \
RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH" \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
CROSS_COMPILE="$TARGET_NAME" \
CROSS_COMPILE_TARGET="yes" \
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
PYTHON_MODULES_LIB="$TARGET_LIBDIR"
}

makeinstall_host() {
make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \
PYTHON_MODULES_LIB="$HOST_LIBDIR" \
Expand All @@ -103,33 +93,37 @@ makeinstall_host() {
ln -s python2.7-config $ROOT/$TOOLCHAIN/bin/python-config
}

pre_configure_target() {
export PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python
export BLDSHARED="$CC -shared"
export RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH"
}

make_target() {
make -j1 CC="$TARGET_CC" \
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
PYTHON_MODULES_LIB="$TARGET_LIBDIR"
}

makeinstall_target() {
make -j1 CC="$TARGET_CC" \
DESTDIR=$SYSROOT_PREFIX \
HOSTPYTHON=$ROOT/$TOOLCHAIN/bin/python \
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
BLDSHARED="$CC -shared" \
RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH" \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
CROSS_COMPILE="$TARGET_NAME" \
CROSS_COMPILE_TARGET="yes" \
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
install

# python distutils per default adds -L$LIBDIR when linking binary extensions
# python distutils per default adds -L$LIBDIR when linking binary extensions
sed -e "s|^LIBDIR=.*|LIBDIR= $SYSROOT_PREFIX/usr/lib|" \
-i $SYSROOT_PREFIX/usr/lib/python*/config/Makefile

make -j1 CC="$TARGET_CC" \
DESTDIR=$INSTALL \
HOSTPYTHON=$ROOT/$TOOLCHAIN/bin/python \
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
BLDSHARED="$CC -shared" \
RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH" \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
CROSS_COMPILE="$TARGET_NAME" \
CROSS_COMPILE_TARGET="yes" \
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
install
Expand All @@ -144,20 +138,14 @@ post_makeinstall_target() {
python -Wi -t -B ../Lib/compileall.py $INSTALL/usr/lib/python*/ -f
rm -rf `find $INSTALL/usr/lib/python*/ -name "*.py"`

rm -rf $INSTALL/usr/lib/python*/config/Setup*
rm -rf $INSTALL/usr/lib/python*/config/config.*
rm -rf $INSTALL/usr/lib/python*/config/install-sh
rm -rf $INSTALL/usr/lib/python*/config/makesetup
rm -rf $INSTALL/usr/lib/python*/config/python.o

if [ ! -f $INSTALL/usr/lib/python*/lib-dynload/_socket.so ]; then
echo "sometimes Python dont build '_socket.so' for some reasons and continues without failing,"
echo "let it fail here, to be sure '_socket.so' will be installed. A rebuild of Python fixes"
echo "the issue in most cases"
exit 1
fi

# k0p
rm -rf $INSTALL/usr/lib/python*/config
rm -rf $INSTALL/usr/bin/2to3
rm -rf $INSTALL/usr/bin/idle
rm -rf $INSTALL/usr/bin/pydoc
Expand Down
75 changes: 75 additions & 0 deletions packages/lang/Python/patches/Python-2.7.10-001_xcompile.patch
@@ -0,0 +1,75 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
index bcd83bf..5e54a0d 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -191,6 +191,7 @@ UNICODE_OBJS= @UNICODE_OBJS@

PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
+HOSTPYTHON= ./$(BUILDPYTHON)

PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
@@ -231,6 +232,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
##########################################################################
# Parser
PGEN= Parser/pgen$(EXE)
+HOSTPGEN= $(PGEN)

PSRCS= \
Parser/acceler.c \
@@ -461,6 +463,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt
esac; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build

# Build static library
@@ -598,7 +601,7 @@ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule
$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
@$(MKDIR_P) Include
$(MAKE) $(PGEN)
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
$(MAKE) $(GRAMMAR_H)
touch $(GRAMMAR_C)
@@ -1142,7 +1145,9 @@ libainstall: all python-config
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
+ --skip-build \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
diff --git a/setup.py b/setup.py
index a46bf35..528e9df 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@
from distutils.command.install_lib import install_lib
from distutils.spawn import find_executable

-cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
+cross_compiling = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('PYTHONXCPREFIX' in os.environ)

def get_platform():
# cross build
@@ -292,6 +292,14 @@ class PyBuildExt(build_ext):
(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,17 @@
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 @@
diff --git a/setup.py b/setup.py
index d6ef5be..7a0d8f2 100644
--- a/setup.py
+++ b/setup.py
@@ -439,13 +439,19 @@ class PyBuildExt(build_ext):
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')
- if not cross_compiling:
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
- if cross_compiling:
- self.add_gcc_paths()
- self.add_multiarch_paths()
+ try:
+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
Expand All @@ -25,7 +29,7 @@ diff -Naur Python-2.7.2/setup.py Python-2.7.2.patch/setup.py

# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -419,17 +428,6 @@
@@ -481,17 +487,6 @@ class PyBuildExt(build_ext):
for directory in reversed(options.dirs):
add_dir_to_list(dir_list, directory)

Expand All @@ -43,17 +47,3 @@ diff -Naur Python-2.7.2/setup.py Python-2.7.2.patch/setup.py
try:
have_unicode = unicode
except NameError:
@@ -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.
- 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 = []

@@ -0,0 +1,16 @@
diff --git a/setup.py b/setup.py
index a46bf35..d6ef5be 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,10 @@ host_platform = get_platform()
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))

# 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 = []

def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -1,19 +1,19 @@
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 = []
diff --git a/setup.py b/setup.py
index 07af0b6..6426b22 100644
--- a/setup.py
+++ b/setup.py
@@ -2030,10 +2030,18 @@ class PyBuildExt(build_ext):
if not self.verbose:
config_args.append("-q")
+
+ #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" \
Expand Down
@@ -0,0 +1,29 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 918f210..c82366c 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1011,24 +1011,6 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
- 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) \
- $(PYTHON_FOR_BUILD) -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) \
- $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
@@ -0,0 +1,12 @@
diff -Naur Python-2.7.10.orig/configure Python-2.7.10/configure
--- Python-2.7.10.orig/configure 2015-08-18 12:24:03.016649265 -0700
+++ Python-2.7.10/configure 2015-08-18 12:23:41.716695873 -0700
@@ -14215,7 +14215,7 @@

# first curses configure check
ac_save_cppflags="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+CPPFLAGS="$CPPFLAGS -I${prefix}/usr/include/ncursesw"

for ac_header in curses.h ncurses.h
do :
@@ -0,0 +1,34 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
index bf3aed7..7ff5c79 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -464,6 +464,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \
+ CONFIG_ARGS="$(CONFIG_ARGS)" \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build

libpython$(VERSION).so: $(LIBRARY_OBJS)
@@ -1104,6 +1105,7 @@ libainstall: all python-config
# This goes into $(exec_prefix)
sharedinstall: sharedmods
CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ CONFIG_ARGS="$(CONFIG_ARGS)" \
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
--skip-build \
--prefix=$(prefix) \
diff --git a/setup.py b/setup.py
index 6426b22..d2776dd 100644
--- a/setup.py
+++ b/setup.py
@@ -32,6 +32,9 @@ host_platform = get_platform()
# Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))

+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()
@@ -1,7 +1,8 @@
diff -up Python-2.6.4/Lib/distutils/unixccompiler.py.distutils-rpath Python-2.6.4/Lib/distutils/unixccompiler.py
--- Python-2.6.4/Lib/distutils/unixccompiler.py.distutils-rpath 2009-09-09 04:34:06.000000000 -0400
+++ Python-2.6.4/Lib/distutils/unixccompiler.py 2010-03-15 21:33:25.000000000 -0400
@@ -142,6 +142,16 @@ class UnixCCompiler(CCompiler):
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index 2aa1cb1..529e2d4 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -83,6 +83,16 @@ class UnixCCompiler(CCompiler):
if sys.platform == "cygwin":
exe_extension = ".exe"

Expand Down