Skip to content

Commit

Permalink
Revert "Python: update to Python-2.7.8"
Browse files Browse the repository at this point in the history
This reverts commit 81c08d1.
  • Loading branch information
sraue committed Jan 11, 2015
1 parent 0c2e7bd commit 53656cb
Show file tree
Hide file tree
Showing 18 changed files with 379 additions and 230 deletions.
49 changes: 30 additions & 19 deletions packages/lang/Python/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
################################################################################

PKG_NAME="Python"
PKG_VERSION="2.7.8"
PKG_VERSION="2.7.3"
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 Python:host"
PKG_DEPENDS_TARGET="toolchain Python:host sqlite expat zlib bzip2 libressl libffi"
PKG_PRIORITY="optional"
PKG_SECTION="lang"
PKG_SHORTDESC="python: The Python programming language"
Expand All @@ -48,9 +48,6 @@ 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 @@ -75,49 +72,64 @@ make_host() {
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES"
}

makeinstall_host() {
make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \
PYTHON_MODULES_LIB="$HOST_LIBDIR" \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
install

cp Parser/pgen $ROOT/$TOOLCHAIN/bin
}

make_target() {
make -j1 CC="$TARGET_CC" \
PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python \
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" \
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
install

cp Parser/pgen $ROOT/$TOOLCHAIN/bin

# replace python-config to make sure python uses $SYSROOT_PREFIX
mkdir -p $ROOT/$TOOLCHAIN/bin
rm -rf $ROOT/$TOOLCHAIN/bin/python*-config

sed -e "s:%PREFIX%:$SYSROOT_PREFIX/usr:g" -e "s:%CFLAGS%:$TARGET_CFLAGS:g" \
$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
}

makeinstall_target() {
make -j1 CC="$TARGET_CC" \
DESTDIR=$SYSROOT_PREFIX \
PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python \
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 \
PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python \
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 @@ -138,7 +150,6 @@ post_makeinstall_target() {
rm -rf $INSTALL/usr/lib/python*/config/makesetup
rm -rf $INSTALL/usr/lib/python*/config/python.o

# TODO remove ?
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"
Expand Down
135 changes: 135 additions & 0 deletions packages/lang/Python/patches/Python-2.7.3-001_xcompile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
diff -Naur Python-2.7.3/configure Python-2.7.3.patch/configure
--- Python-2.7.3/configure 2012-04-10 01:07:36.000000000 +0200
+++ Python-2.7.3.patch/configure 2012-04-16 14:27:58.161470960 +0200
@@ -13697,7 +13697,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. */
@@ -13749,7 +13749,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.3/Makefile.pre.in Python-2.7.3.patch/Makefile.pre.in
--- Python-2.7.3/Makefile.pre.in 2012-04-10 01:07:33.000000000 +0200
+++ Python-2.7.3.patch/Makefile.pre.in 2012-04-16 14:30:27.753099115 +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 \
@@ -408,8 +411,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
@@ -543,7 +546,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)
@@ -938,26 +941,26 @@
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
- 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):
@@ -1062,7 +1065,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.3/setup.py Python-2.7.3.patch/setup.py
--- Python-2.7.3/setup.py 2012-04-10 01:07:36.000000000 +0200
+++ Python-2.7.3.patch/setup.py 2012-04-16 14:27:58.164471010 +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:
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
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):
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
- 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()
- 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()
Expand All @@ -29,7 +25,7 @@ index d6ef5be..7a0d8f2 100644

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

Expand All @@ -47,3 +43,17 @@ index d6ef5be..7a0d8f2 100644
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 = []

Original file line number Diff line number Diff line change
@@ -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,
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
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")
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" \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff -Naur Python-2.7.3/Makefile.pre.in Python-2.7.3.patch/Makefile.pre.in
--- Python-2.7.3/Makefile.pre.in 2012-04-16 14:49:16.353716188 +0200
+++ Python-2.7.3.patch/Makefile.pre.in 2012-04-16 14:50:03.740554039 +0200
@@ -941,24 +941,6 @@
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
- -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) \
- $(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) \
- $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- -PYTHONPATH=$(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) \
$(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"

Loading

0 comments on commit 53656cb

Please sign in to comment.