Python2: remove package

This commit is contained in:
MilhouseVH 2019-10-24 22:51:28 +01:00
parent 4ce4965f5a
commit 35e03eca56
16 changed files with 0 additions and 730 deletions

View File

@ -1,123 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="Python2"
# When changing PKG_VERSION remember to sync PKG_PYTHON_VERSION!
PKG_VERSION="2.7.16"
PKG_SHA256="f222ef602647eecb6853681156d32de4450a2c39f4de93bd5b20235f2e660ed7"
PKG_LICENSE="OSS"
PKG_SITE="http://www.python.org/"
PKG_URL="http://www.python.org/ftp/python/$PKG_VERSION/${PKG_NAME::-1}-$PKG_VERSION.tar.xz"
PKG_DEPENDS_HOST="zlib:host bzip2:host sqlite:host"
PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 openssl libffi Python2:host ncurses readline"
PKG_LONGDESC="Python2 is an interpreted object-oriented programming language."
PKG_TOOLCHAIN="autotools"
PKG_BUILD_FLAGS="-parallel +lto-parallel"
PKG_PY_DISABLED_MODULES="_tkinter nis gdbm bsddb ossaudiodev"
PKG_CONFIGURE_OPTS_HOST="--cache-file=config.cache \
--without-cxx-main \
--with-threads \
--enable-unicode=ucs4"
PKG_CONFIGURE_OPTS_TARGET="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 \
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 \
--disable-profiling \
--without-pydebug \
--without-doc-strings \
--without-tsc \
--with-pymalloc \
--without-fpectl \
--without-cxx-main \
--with-system-ffi \
--with-system-expat"
post_patch() {
# This is needed to make sure the Python build process doesn't try to
# regenerate those files with the pgen program. Otherwise, it builds
# pgen for the target, and tries to run it on the host.
touch $PKG_BUILD/Include/graminit.h
touch $PKG_BUILD/Python/graminit.c
}
make_host() {
make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \
PYTHON_MODULES_LIB="$HOST_LIBDIR" \
PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PKG_PY_DISABLED_MODULES"
# python distutils per default adds -L$LIBDIR when linking binary extensions
sed -e "s|^ 'LIBDIR':.*| 'LIBDIR': '/usr/lib',|g" -i $(cat pybuilddir.txt)/_sysconfigdata.py
}
makeinstall_host() {
make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \
PYTHON_MODULES_LIB="$HOST_LIBDIR" \
PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PKG_PY_DISABLED_MODULES" \
install
}
post_makeinstall_host() {
rm -fr $PKG_BUILD/.$HOST_NAME/build/temp.*
}
pre_configure_target() {
export PYTHON_FOR_BUILD=$TOOLCHAIN/bin/python
}
make_target() {
make CC="$CC" LDFLAGS="$TARGET_LDFLAGS -L." \
PYTHON_DISABLE_MODULES="$PKG_PY_DISABLED_MODULES" \
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
PYTHON_MODULES_LIB="$TARGET_LIBDIR"
}
makeinstall_target() {
make CC="$CC" DESTDIR=$SYSROOT_PREFIX \
PYTHON_DISABLE_MODULES="$PKG_PY_DISABLED_MODULES" \
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
install
make CC="$CC" DESTDIR=$INSTALL \
PYTHON_DISABLE_MODULES="$PKG_PY_DISABLED_MODULES" \
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
install
}
post_makeinstall_target() {
rm -fr $PKG_BUILD/.$TARGET_NAME/build/temp.*
for dir in bsddb idlelib lib-tk lib2to3 msilib pydoc_data test unittest; do
rm -rf $INSTALL/usr/lib/python*/$dir
done
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
rm -rf $INSTALL/usr/bin/smtpd.py
rm -rf $INSTALL/usr/bin/python*-config
cd $INSTALL/usr/lib/$PKG_PYTHON_VERSION
$TOOLCHAIN/bin/python -Wi -t -B $PKG_BUILD/Lib/compileall.py -d /usr/lib/$PKG_PYTHON_VERSION -f .
find $INSTALL/usr/lib/$PKG_PYTHON_VERSION -name "*.py" -exec rm -f {} \; &>/dev/null
# strip
chmod u+w $INSTALL/usr/lib/libpython*.so.*
debug_strip $INSTALL/usr
}

View File

@ -1,50 +0,0 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
index bcd83bf..5e54a0d 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -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
@@ -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:

View File

@ -1,49 +0,0 @@
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
- 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()
+ except KeyError:
+ modules_include_dirs = ['/usr/include']
+ try:
+ 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:
+ add_dir_to_list(self.compiler.library_dirs, dir)
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.
@@ -481,17 +487,6 @@ class PyBuildExt(build_ext):
for directory in reversed(options.dirs):
add_dir_to_list(dir_list, directory)
- 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,
- sysconfig.get_config_var("INCLUDEDIR"))
-
try:
have_unicode = unicode
except NameError:

View File

@ -1,16 +0,0 @@
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

View File

@ -1,24 +0,0 @@
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" \
- % (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):

View File

@ -1,29 +0,0 @@
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) \

View File

@ -1,12 +0,0 @@
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 :

View File

@ -1,54 +0,0 @@
Adjust library/header paths for cross-compilation
When cross-compiling third-party extensions, the get_python_inc() or
get_python_lib() can be called, to return the path to headers or
libraries. However, they use the sys.prefix of the host Python, which
returns incorrect paths when cross-compiling (paths pointing to host
headers and libraries).
In order to fix this, we introduce the _python_sysroot, _python_prefix
and _python_exec_prefix variables, that allow to override these
values, and get correct header/library paths when cross-compiling
third-party Python modules.
The _python_sysroot variable is also used to prefix the LIBDIR value
taken from the sysconfigdata module.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Index: b/Lib/distutils/sysconfig.py
===================================================================
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -19,8 +19,13 @@
from distutils.errors import DistutilsPlatformError
# These are needed in a couple of spots, so just compute them once.
-PREFIX = os.path.normpath(sys.prefix)
-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+if "_python_sysroot" in os.environ:
+ _sysroot=os.environ.get('_python_sysroot')
+ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix'))
+ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix'))
+else:
+ PREFIX = os.path.normpath(sys.prefix)
+ EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
# Path to the base directory of the project. On Windows the binary may
# live in project/PCBuild9. If we're dealing with an x64 Windows build,
Index: b/Lib/distutils/command/build_ext.py
===================================================================
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -237,7 +237,10 @@
if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
if not sysconfig.python_build:
# building third party extensions
- self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
+ libdir = sysconfig.get_config_var('LIBDIR')
+ if "_python_sysroot" in os.environ:
+ libdir = os.environ.get("_python_sysroot") + libdir
+ self.library_dirs.append(libdir)
else:
# building python standard extensions
self.library_dirs.append('.')

View File

@ -1,34 +0,0 @@
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()

View File

@ -1,21 +0,0 @@
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"
+ def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs):
+ """Remove standard library path from rpath"""
+ libraries, library_dirs, runtime_library_dirs = \
+ CCompiler._fix_lib_args(self, libraries, library_dirs,
+ runtime_library_dirs)
+ libdir = sysconfig.get_config_var('LIBDIR')
+ if runtime_library_dirs and (libdir in runtime_library_dirs):
+ runtime_library_dirs.remove(libdir)
+ return libraries, library_dirs, runtime_library_dirs
+
def preprocess(self, source,
output_file=None, macros=None, include_dirs=None,
extra_preargs=None, extra_postargs=None):

View File

@ -1,208 +0,0 @@
Add a backport of http://bugs.python.org/issue16235 so we can use
python-config for cross builds.
This basically replaces the python version of python-config with a pure-shell
version that's already preprocessed when installed and doesn't depend
on the sysconfig import that usually leads to bad data/results.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -885,6 +885,7 @@
# Other platforms follow
if test $enable_shared = "yes"; then
+ PY_ENABLE_SHARED=1
AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
case $ac_sys_system in
BeOS*)
@@ -945,6 +946,7 @@
esac
else # shared is disabled
+ PY_ENABLE_SHARED=0
case $ac_sys_system in
CYGWIN*)
BLDLIBRARY='$(LIBRARY)'
@@ -1921,6 +1923,9 @@
AC_SUBST(BLDSHARED)
AC_SUBST(CCSHARED)
AC_SUBST(LINKFORSHARED)
+AC_SUBST(PY_ENABLE_SHARED)
+LIBPL="${prefix}/lib/python${VERSION}/config"
+AC_SUBST(LIBPL)
# SO is the extension of shared libraries `(including the dot!)
# -- usually .so, .sl on HP-UX, .dll on Cygwin
AC_MSG_CHECKING(SO)
@@ -4588,7 +4593,7 @@
AC_SUBST(ENSUREPIP)
# generate output files
-AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
+AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh)
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
AC_OUTPUT
Index: b/Makefile.pre.in
===================================================================
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -166,7 +166,7 @@
SUBDIRSTOO= Include Lib Misc Demo
# Files and directories to be distributed
-CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
+CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Misc/python-config.sh
DISTFILES= README ChangeLog $(CONFIGFILES)
DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
DIST= $(DISTFILES) $(DISTDIRS)
@@ -410,7 +410,7 @@
# Default target
all: @DEF_MAKE_ALL_RULE@
-build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
+build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks python-config
# Compile a binary with gcc profile guided optimization.
profile-opt:
@@ -1101,10 +1101,12 @@
fi; \
cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
-python-config: $(srcdir)/Misc/python-config.in
+python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
- sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
+ sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py
+ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
+ sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' Misc/python-config.sh >python-config
# Install the include files
INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
@@ -1163,7 +1165,7 @@
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
- rm python-config
+ $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
@if [ -s Modules/python.exp -a \
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
echo; echo "Installing support files for building shared extension modules on AIX:"; \
@@ -1345,6 +1347,7 @@
config.cache config.log pyconfig.h Modules/config.c
-rm -rf build platform
-rm -rf $(PYTHONFRAMEWORKDIR)
+ -rm -f python-config.py python-config
# Make things extra clean, before making a distribution:
# remove all generated files, even Makefile[.pre]
Index: b/Misc/python-config.sh.in
===================================================================
--- /dev/null
+++ b/Misc/python-config.sh.in
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+exit_with_usage ()
+{
+ echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--configdir"
+ exit $1
+}
+
+if [ "$1" = "" ] ; then
+ exit_with_usage 1
+fi
+
+# Returns the actual prefix where this script was installed to.
+installed_prefix ()
+{
+ RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
+ if which readlink >/dev/null 2>&1 ; then
+ RESULT=$(readlink -f "$RESULT")
+ fi
+ echo $RESULT
+}
+
+prefix_build="@prefix@"
+prefix_real=$(installed_prefix "$0")
+
+# Use sed to fix paths from their built to locations to their installed to locations.
+prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
+exec_prefix_build="@exec_prefix@"
+exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#")
+includedir=$(echo "@includedir@")
+libdir=$(echo "@libdir@")
+CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
+VERSION="@VERSION@"
+LIBM="@LIBM@"
+LIBC="@LIBC@"
+SYSLIBS="$LIBM $LIBC"
+LIBS="@LIBS@ $SYSLIBS -lpython${VERSION}"
+BASECFLAGS="@BASECFLAGS@"
+LDLIBRARY="@LDLIBRARY@"
+LINKFORSHARED="@LINKFORSHARED@"
+OPT="@OPT@"
+PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
+LDVERSION="@LDVERSION@"
+LIBDEST=${prefix}/lib/python${VERSION}
+LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#")
+SO="@SO@"
+PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
+INCDIR="-I$includedir/python${VERSION}"
+PLATINCDIR="-I$includedir/python${VERSION}"
+
+# Scan for --help or unknown argument.
+for ARG in $*
+do
+ case $ARG in
+ --help)
+ exit_with_usage 0
+ ;;
+ --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir)
+ ;;
+ *)
+ exit_with_usage 1
+ ;;
+esac
+done
+
+for ARG in "$@"
+do
+ case "$ARG" in
+ --prefix)
+ echo "$prefix"
+ ;;
+ --exec-prefix)
+ echo "$exec_prefix"
+ ;;
+ --includes)
+ echo "$INCDIR $PLATINCDIR"
+ ;;
+ --cflags)
+ echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
+ ;;
+ --libs)
+ echo "$LIBS"
+ ;;
+ --ldflags)
+ LINKFORSHAREDUSED=
+ if [ -z "$PYTHONFRAMEWORK" ] ; then
+ LINKFORSHAREDUSED=$LINKFORSHARED
+ fi
+ LIBPLUSED=
+ if [ "$PY_ENABLE_SHARED" = "0" ] ; then
+ LIBPLUSED="-L$LIBPL"
+ fi
+ echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED"
+ ;;
+ --extension-suffix)
+ echo "$SO"
+ ;;
+ --configdir)
+ echo "$LIBPL"
+ ;;
+esac
+done

View File

@ -1,21 +0,0 @@
Abort on failed module build
When building a Python module fails, the setup.py script currently
doesn't exit with an error, and simply continues. This is not a really
nice behavior, so this patch changes setup.py to abort with an error,
so that the build issue is clearly noticeable.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Index: b/setup.py
===================================================================
--- a/setup.py
+++ b/setup.py
@@ -283,6 +283,7 @@
print "Failed to build these modules:"
print_three_column(failed)
print
+ sys.exit(1)
def build_extension(self, ext):

View File

@ -1,51 +0,0 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 918f210..eb9ee6b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -438,7 +438,7 @@ coverage:
# Build the interpreter
-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
+$(BUILDPYTHON): Modules/python.o $(LDLIBRARY)
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
Modules/python.o \
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
@@ -465,18 +465,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-# Build static library
-# avoid long command lines, same as LIBRARY_OBJS
-$(LIBRARY): $(LIBRARY_OBJS)
- -rm -f $@
- $(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 \
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
@@ -1090,18 +1078,6 @@ libainstall: all python-config
else true; \
fi; \
done
- @if test -d $(LIBRARY); then :; else \
- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
- if test "$(SO)" = .dll; then \
- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
- else \
- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
- fi; \
- else \
- echo Skip install of $(LIBRARY) - use make frameworkinstall; \
- fi; \
- fi
$(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

View File

@ -1,13 +0,0 @@
diff --git a/Python/compile.c b/Python/compile.c
index 1cf53f9..25665b5 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -32,7 +32,7 @@
#include "symtable.h"
#include "opcode.h"
-int Py_OptimizeFlag = 0;
+int Py_OptimizeFlag = 1;
#define DEFAULT_BLOCK_SIZE 16
#define DEFAULT_BLOCKS 8

View File

@ -1,12 +0,0 @@
diff --git a/setup.py b/setup.py
index 69b76e7..7a50cc3 100644
--- a/setup.py
+++ b/setup.py
@@ -2315,7 +2315,6 @@ def main():
# Scripts to install
scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
- 'Tools/scripts/2to3',
'Lib/smtpd.py']
)

View File

@ -1,13 +0,0 @@
diff -Naur Python-2.7.13.orig/Lib/platform.py Python-2.7.13/Lib/platform.py
--- Python-2.7.13.orig/Lib/platform.py 2017-01-08 11:57:36.615886244 +0100
+++ Python-2.7.13/Lib/platform.py 2017-01-08 12:12:44.567848271 +0100
@@ -1250,6 +1250,9 @@
system = 'Windows'
release = 'Vista'
+ if machine == 'aarch64' and architecture()[0] == '32bit':
+ machine = 'armv7l'
+
_uname_cache = system,node,release,version,machine,processor
return _uname_cache