python: remove Python 2 and all supporting classes

Python 2 ceased being maintained on the 1st January 2020.  We've already
removed all users of it from oe-core so the final step is to move the
recipe and supporting classes to meta-python2.

The following are removed in this commit:
- python and python-native 2.7.17
- python-setuptools
- The classes pythonnative, pythondir, distutils, setuptools

(From OE-Core rev: 390f3edabfb1f68ed9766245291c5f44ea00cc38)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2020-01-17 14:16:32 +00:00
committed by Richard Purdie
parent 2b5cf2a067
commit 2ed5d927ca
45 changed files with 0 additions and 4027 deletions

View File

@@ -1,40 +0,0 @@
From 6cbb7529cf7ff0da3ca649fb3486facd9620d625 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Thu, 25 Oct 2018 07:32:14 +0000
Subject: [PATCH] python-native: fix one do_populate_sysroot warning
Fix below warning:
WARNING: Skipping RPATH /usr/lib64 as is a standard search path for
work/x86_64-linux/python-native/2.7.15-r1.1/recipe-sysroot-native/
usr/lib/python2.7/lib-dynload/_bsddb.so
setup.py will check db.h under include_dirs, for native build,
/usr/lib64 will be insert to postion 0 of include_dirs, so
it's priority is higher then our sysroot, cause db.h sysroot
is ignored, and rpath set to /usr/lib64. and this cause warning
when do_populate_sysroot. use append to fix it.
Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index a2c8127..22f9e23 100644
--- a/setup.py
+++ b/setup.py
@@ -47,7 +47,7 @@ def add_dir_to_list(dirlist, dir):
else:
dir_exists = os.path.isdir(dir)
if dir_exists:
- dirlist.insert(0, dir)
+ dirlist.append(dir)
MACOS_SDK_ROOT = None
--
2.17.1

View File

@@ -1,18 +0,0 @@
Upstream-Status: Pending
# Some versions of SWIG do not use the extension parameter.
# Make it optional.
# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
Index: Python-2.6.1/Lib/distutils/command/build_ext.py
===================================================================
--- Python-2.6.1.orig/Lib/distutils/command/build_ext.py
+++ Python-2.6.1/Lib/distutils/command/build_ext.py
@@ -566,7 +566,7 @@ class build_ext (Command):
target_lang=language)
- def swig_sources (self, sources, extension):
+ def swig_sources (self, sources, extension=None):
"""Walk the list of source files in 'sources', looking for SWIG
interface (.i) files. Run SWIG on all that are found, and

View File

@@ -1,20 +0,0 @@
Upstream-Status: Pending
# Don't modify the she-bang line for a cross-build.
# Otherwise it points to our hostpython (which we do not want)
#
# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
Index: Python-2.6.1/Lib/distutils/command/build_scripts.py
===================================================================
--- Python-2.6.1.orig/Lib/distutils/command/build_scripts.py
+++ Python-2.6.1/Lib/distutils/command/build_scripts.py
@@ -87,7 +87,7 @@ class build_scripts (Command):
continue
match = first_line_re.match(first_line)
- if match:
+ if False: #match:
adjust = 1
post_interp = match.group(1) or ''

View File

@@ -1,235 +0,0 @@
Rebased for Python 2.7.9
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
2011/09/29
The python recipe building was failing because python-native
could not handle sys.lib var. sys.lib var is defined in the
multilib patch hence added this multilib.patch for python-native
recipe.
Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Index: Python-2.7.14/Include/pythonrun.h
===================================================================
--- Python-2.7.14.orig/Include/pythonrun.h
+++ Python-2.7.14/Include/pythonrun.h
@@ -108,6 +108,7 @@ PyAPI_FUNC(char *) Py_GetPath(void);
/* In their own files */
PyAPI_FUNC(const char *) Py_GetVersion(void);
PyAPI_FUNC(const char *) Py_GetPlatform(void);
+PyAPI_FUNC(const char *) Py_GetLib(void);
PyAPI_FUNC(const char *) Py_GetCopyright(void);
PyAPI_FUNC(const char *) Py_GetCompiler(void);
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
Index: Python-2.7.14/Lib/distutils/command/install.py
===================================================================
--- Python-2.7.14.orig/Lib/distutils/command/install.py
+++ Python-2.7.14/Lib/distutils/command/install.py
@@ -22,6 +22,8 @@ from site import USER_BASE
from site import USER_SITE
+libname = sys.lib
+
if sys.version < "2.2":
WINDOWS_SCHEME = {
'purelib': '$base',
@@ -42,7 +44,7 @@ else:
INSTALL_SCHEMES = {
'unix_prefix': {
'purelib': '$base/lib/python$py_version_short/site-packages',
- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
'headers': '$base/include/python$py_version_short/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
Index: Python-2.7.14/Lib/pydoc.py
===================================================================
--- Python-2.7.14.orig/Lib/pydoc.py
+++ Python-2.7.14/Lib/pydoc.py
@@ -375,7 +375,7 @@ class Doc:
docmodule = docclass = docroutine = docother = docproperty = docdata = fail
def getdocloc(self, object,
- basedir=os.path.join(sys.exec_prefix, "lib",
+ basedir=os.path.join(sys.exec_prefix, "sys.lib",
"python"+sys.version[0:3])):
"""Return the location of module docs or None"""
Index: Python-2.7.14/Lib/site.py
===================================================================
--- Python-2.7.14.orig/Lib/site.py
+++ Python-2.7.14/Lib/site.py
@@ -288,13 +288,19 @@ def getsitepackages():
if sys.platform in ('os2emx', 'riscos'):
sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
- sitepackages.append(os.path.join(prefix, "lib",
+ sitepackages.append(os.path.join(prefix, sys.lib,
"python" + sys.version[:3],
"site-packages"))
- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
+ if sys.lib != "lib":
+ sitepackages.append(os.path.join(prefix, "lib",
+ "python" + sys.version[:3],
+ "site-packages"))
+ sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
+ if sys.lib != "lib":
+ sitepackages.append(os.path.join(prefix, "lib", "site-python"))
else:
sitepackages.append(prefix)
- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
return sitepackages
def addsitepackages(known_paths):
Index: Python-2.7.14/Lib/test/test_dl.py
===================================================================
--- Python-2.7.14.orig/Lib/test/test_dl.py
+++ Python-2.7.14/Lib/test/test_dl.py
@@ -4,10 +4,11 @@
import unittest
from test.test_support import verbose, import_module
dl = import_module('dl', deprecated=True)
+import sys
sharedlibs = [
- ('/usr/lib/libc.so', 'getpid'),
- ('/lib/libc.so.6', 'getpid'),
+ ('/usr/'+sys.lib+'/libc.so', 'getpid'),
+ ('/'+sys.lib+'/libc.so.6', 'getpid'),
('/usr/bin/cygwin1.dll', 'getpid'),
('/usr/lib/libc.dylib', 'getpid'),
]
Index: Python-2.7.14/Lib/trace.py
===================================================================
--- Python-2.7.14.orig/Lib/trace.py
+++ Python-2.7.14/Lib/trace.py
@@ -754,10 +754,10 @@ def main(argv=None):
# should I also call expanduser? (after all, could use $HOME)
s = s.replace("$prefix",
- os.path.join(sys.prefix, "lib",
+ os.path.join(sys.prefix, sys.lib,
"python" + sys.version[:3]))
s = s.replace("$exec_prefix",
- os.path.join(sys.exec_prefix, "lib",
+ os.path.join(sys.exec_prefix, sys.lib,
"python" + sys.version[:3]))
s = os.path.normpath(s)
ignore_dirs.append(s)
Index: Python-2.7.14/Makefile.pre.in
===================================================================
--- Python-2.7.14.orig/Makefile.pre.in
+++ Python-2.7.14/Makefile.pre.in
@@ -91,6 +91,7 @@ PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAG
# Machine-dependent subdirectories
MACHDEP= @MACHDEP@
+LIB= @LIB@
# Multiarch directory (may be empty)
MULTIARCH= @MULTIARCH@
@@ -110,7 +111,7 @@ LIBDIR= @libdir@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
-SCRIPTDIR= $(prefix)/lib
+SCRIPTDIR= $(prefix)/@LIB@
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
@@ -644,6 +645,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
-DEXEC_PREFIX='"$(exec_prefix)"' \
-DVERSION='"$(VERSION)"' \
-DVPATH='"$(VPATH)"' \
+ -DLIB='"$(LIB)"' \
-o $@ $(srcdir)/Modules/getpath.c
Modules/python.o: $(srcdir)/Modules/python.c
@@ -692,7 +694,7 @@ regen-ast:
Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
Python/getplatform.o: $(srcdir)/Python/getplatform.c
- $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
+ $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
Python/importdl.o: $(srcdir)/Python/importdl.c
$(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Index: Python-2.7.14/Modules/getpath.c
===================================================================
--- Python-2.7.14.orig/Modules/getpath.c
+++ Python-2.7.14/Modules/getpath.c
@@ -100,6 +100,13 @@
#error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined"
#endif
+#define LIB_PYTHON LIB "/python" VERSION
+
+#ifndef PYTHONPATH
+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
+ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
+#endif
+
#ifndef LANDMARK
#define LANDMARK "os.py"
#endif
@@ -108,7 +115,7 @@ static char prefix[MAXPATHLEN+1];
static char exec_prefix[MAXPATHLEN+1];
static char progpath[MAXPATHLEN+1];
static char *module_search_path = NULL;
-static char lib_python[] = "lib/python" VERSION;
+static char lib_python[] = LIB_PYTHON;
static void
reduce(char *dir)
Index: Python-2.7.14/Python/getplatform.c
===================================================================
--- Python-2.7.14.orig/Python/getplatform.c
+++ Python-2.7.14/Python/getplatform.c
@@ -10,3 +10,13 @@ Py_GetPlatform(void)
{
return PLATFORM;
}
+
+#ifndef LIB
+#define LIB "lib"
+#endif
+
+const char *
+Py_GetLib(void)
+{
+ return LIB;
+}
Index: Python-2.7.14/Python/sysmodule.c
===================================================================
--- Python-2.7.14.orig/Python/sysmodule.c
+++ Python-2.7.14/Python/sysmodule.c
@@ -1437,6 +1437,8 @@ _PySys_Init(void)
PyString_FromString(Py_GetCopyright()));
SET_SYS_FROM_STRING("platform",
PyString_FromString(Py_GetPlatform()));
+ SET_SYS_FROM_STRING("lib",
+ PyString_FromString(Py_GetLib()));
SET_SYS_FROM_STRING("executable",
PyString_FromString(Py_GetProgramFullPath()));
SET_SYS_FROM_STRING("prefix",
Index: Python-2.7.14/configure.ac
===================================================================
--- Python-2.7.14.orig/configure.ac
+++ Python-2.7.14/configure.ac
@@ -758,6 +758,11 @@ SunOS*)
;;
esac
+AC_SUBST(LIB)
+AC_MSG_CHECKING(LIB)
+LIB=`basename ${libdir}`
+AC_MSG_RESULT($LIB)
+
AC_SUBST(LIBRARY)
AC_MSG_CHECKING(LIBRARY)

View File

@@ -1,54 +0,0 @@
Upstream-Status: Inappropriate [embedded specific]
2014/12/15
Rebased for python-2.7.9
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Index: Python-2.7.9/setup.py
===================================================================
--- Python-2.7.9.orig/setup.py
+++ Python-2.7.9/setup.py
@@ -439,9 +439,9 @@ class PyBuildExt(build_ext):
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 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()
@@ -480,15 +480,15 @@ 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'):
+ #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,
+ add_dir_to_list(self.compiler.library_dirs,
sysconfig.get_config_var("LIBDIR"))
- add_dir_to_list(self.compiler.include_dirs,
+ add_dir_to_list(self.compiler.include_dirs,
sysconfig.get_config_var("INCLUDEDIR"))
try:
@@ -761,8 +761,7 @@ class PyBuildExt(build_ext):
pass # Issue 7384: Already linked against curses or tinfo.
elif curses_library:
readline_libs.append(curses_library)
- elif self.compiler.find_library_file(lib_dirs +
- ['/usr/lib/termcap'],
+ elif self.compiler.find_library_file(lib_dirs,
'termcap'):
readline_libs.append('termcap')
exts.append( Extension('readline', ['readline.c'],

View File

@@ -1,86 +0,0 @@
On older versions of Python, sysconfig read the data from both the Makefile and
the Python.h file generated at build time, created dictionaries with their variables
and used those when using get_config_var(), now it uses _sysconfigdata.build_time_vars[]
which contains information from the HOST, erroneous in our case, this patch reverts this
behavior and uses Python.h and Makefile to get information.
Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Index: Python-2.7.9/Lib/distutils/sysconfig.py
===================================================================
--- Python-2.7.9.orig/Lib/distutils/sysconfig.py
+++ Python-2.7.9/Lib/distutils/sysconfig.py
@@ -401,12 +401,66 @@ _config_vars = None
def _init_posix():
"""Initialize the module as appropriate for POSIX systems."""
- # _sysconfigdata is generated at build time, see the sysconfig module
- from _sysconfigdata import build_time_vars
- global _config_vars
- _config_vars = {}
- _config_vars.update(build_time_vars)
+ g = {}
+ # load the installed Makefile:
+ try:
+ filename = get_makefile_filename()
+ parse_makefile(filename, g)
+ except IOError, msg:
+ my_msg = "invalid Python installation: unable to open %s" % filename
+ if hasattr(msg, "strerror"):
+ my_msg = my_msg + " (%s)" % msg.strerror
+
+ raise DistutilsPlatformError(my_msg)
+
+ # load the installed pyconfig.h:
+ try:
+ filename = get_config_h_filename()
+ parse_config_h(file(filename), g)
+ except IOError, msg:
+ my_msg = "invalid Python installation: unable to open %s" % filename
+ if hasattr(msg, "strerror"):
+ my_msg = my_msg + " (%s)" % msg.strerror
+
+ raise DistutilsPlatformError(my_msg)
+
+ # On AIX, there are wrong paths to the linker scripts in the Makefile
+ # -- these paths are relative to the Python source, but when installed
+ # the scripts are in another directory.
+ if python_build:
+ g['LDSHARED'] = g['BLDSHARED']
+ elif get_python_version() < '2.1':
+ # The following two branches are for 1.5.2 compatibility.
+ if sys.platform == 'aix4': # what about AIX 3.x ?
+ # Linker script is in the config directory, not in Modules as the
+ # Makefile says.
+ python_lib = get_python_lib(standard_lib=1)
+ ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
+ python_exp = os.path.join(python_lib, 'config', 'python.exp')
+
+ g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
+
+ elif sys.platform == 'beos':
+ # Linker script is in the config directory. In the Makefile it is
+ # relative to the srcdir, which after installation no longer makes
+ # sense.
+ python_lib = get_python_lib(standard_lib=1)
+ linkerscript_path = string.split(g['LDSHARED'])[0]
+ linkerscript_name = os.path.basename(linkerscript_path)
+ linkerscript = os.path.join(python_lib, 'config',
+ linkerscript_name)
+
+ # XXX this isn't the right place to do this: adding the Python
+ # library to the link, if needed, should be in the "build_ext"
+ # command. (It's also needed for non-MS compilers on Windows, and
+ # it's taken care of for them by the 'build_ext.get_libraries()'
+ # method.)
+ g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
+ (linkerscript, PREFIX, get_python_version()))
+
+ global _config_vars
+ _config_vars = g
def _init_nt():
"""Initialize the module as appropriate for NT"""

View File

@@ -1,20 +0,0 @@
Upstream-Status: Pending
The CC variable,sometimes like:"x86_64-poky-linux-gcc -m64 --sysroot=/${TMPDIR}/sysroots/qemux86-64", contains option information.
This will lead to wrong compiler name "qemux86-64" rather than "x86_64-poky-linux-gcc" when python finding the compiler name.
Signed-off-by: Mei Lei <lei.mei@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Index: Python-2.7.2/Lib/distutils/unixccompiler.py
===================================================================
--- Python-2.7.2.orig/Lib/distutils/unixccompiler.py 2011-11-24 13:51:10.539998722 -0800
+++ Python-2.7.2/Lib/distutils/unixccompiler.py 2011-11-24 15:54:36.872137766 -0800
@@ -282,7 +282,7 @@
# this time, there's no way to determine this information from
# the configuration data stored in the Python installation, so
# we use this hack.
- compiler = os.path.basename(sysconfig.get_config_var("CC"))
+ compiler = sysconfig.get_config_var("CC")
if sys.platform[:6] == "darwin":
# MacOSX's linker doesn't understand the -R flag at all
return "-L" + dir

View File

@@ -1,90 +0,0 @@
require python.inc
EXTRANATIVEPATH += "bzip2-native"
DEPENDS = "openssl-native bzip2-replacement-native zlib-native readline-native sqlite3-native expat-native gdbm-native db-native"
SRC_URI += "\
file://05-enable-ctypes-cross-build.patch \
file://10-distutils-fix-swig-parameter.patch \
file://11-distutils-never-modify-shebang-line.patch \
file://0001-distutils-set-the-prefix-to-be-inside-staging-direct.patch \
file://unixccompiler.patch \
file://nohostlibs.patch \
file://multilib.patch \
file://add-md5module-support.patch \
file://0001-python-Resolve-intermediate-staging-issues.patch \
file://parallel-makeinst-create-bindir.patch \
file://revert_use_of_sysconfigdata.patch \
file://0001-python-native-fix-one-do_populate_sysroot-warning.patch \
"
S = "${WORKDIR}/Python-${PV}"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:"
inherit native
EXTRA_OECONF_append = " --bindir=${bindir}/${PN} --with-system-expat=${STAGING_DIR_HOST}"
EXTRA_OEMAKE = '\
LIBC="" \
STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE} \
STAGING_INCDIR=${STAGING_INCDIR_NATIVE} \
'
do_configure_append() {
autoreconf --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi
}
# Cross-compiling Python needs a native pgen, build it here for use later.
do_compile_append() {
oe_runmake Parser/pgen
}
do_install() {
oe_runmake 'DESTDIR=${D}' install
install -d ${D}${bindir}/${PN}
install -m 0755 Parser/pgen ${D}${bindir}/${PN}
# Make sure we use /usr/bin/env python
for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
sed -i -e '1s|^#!.*|#!/usr/bin/env python|' $PYTHSCRIPT
done
# Add a symlink to the native Python so that scripts can just invoke
# "nativepython" and get the right one without needing absolute paths
# (these often end up too long for the #! parser in the kernel as the
# buffer is 128 bytes long).
ln -s python-native/python ${D}${bindir}/nativepython
# We don't want modules in ~/.local being used in preference to those
# installed in the native sysroot, so disable user site support.
sed -i -e 's,^\(ENABLE_USER_SITE = \).*,\1False,' ${D}${libdir}/python${PYTHON_MAJMIN}/site.py
}
python(){
# Read JSON manifest
import json
pythondir = d.getVar('THISDIR')
with open(pythondir+'/python/python2-manifest.json') as manifest_file:
manifest_str = manifest_file.read()
json_start = manifest_str.find('# EOC') + 6
manifest_file.seek(json_start)
manifest_str = manifest_file.read()
python_manifest = json.loads(manifest_str)
rprovides = d.getVar('RPROVIDES').split()
# Hardcoded since it cant be python-native-foo, should be python-foo-native
pn = 'python'
# ${PN}-misc-native is not in the manifest
rprovides.append(pn + '-misc-native')
for key in python_manifest:
pypackage = pn + '-' + key + '-native'
if pypackage not in rprovides:
rprovides.append(pypackage)
d.setVar('RPROVIDES', ' '.join(rprovides))
}

View File

@@ -1,9 +0,0 @@
require python-setuptools.inc
PROVIDES = "python-distribute"
inherit setuptools
RREPLACES_${PN} = "python-distribute"
RPROVIDES_${PN} = "python-distribute"
RCONFLICTS_${PN} = "python-distribute"

View File

@@ -1,51 +0,0 @@
From 4cdf2e9df13c6327fcc94d53e4953005543aef3d Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 6 Apr 2016 17:43:02 +0300
Subject: [PATCH 01/10] distutils: set the prefix to be inside staging
directory
The proper prefix is inside our staging area.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Michael 'Mickey' Lauer <mickey@vanille-media.de>
Signed-off-by: Phil Blundell <philb@gnu.org>
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
Lib/distutils/sysconfig.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index de7da1d..f3aacf7 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -75,7 +75,7 @@ def get_python_inc(plat_specific=0, prefix=None):
sys.exec_prefix -- i.e., ignore 'plat_specific'.
"""
if prefix is None:
- prefix = plat_specific and EXEC_PREFIX or PREFIX
+ prefix = os.environ['STAGING_INCDIR'].rstrip('include')
if os.name == "posix":
if python_build:
@@ -115,12 +115,16 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
If 'prefix' is supplied, use it instead of sys.prefix or
sys.exec_prefix -- i.e., ignore 'plat_specific'.
"""
+ lib_basename = os.environ['STAGING_LIBDIR'].split('/')[-1]
if prefix is None:
- prefix = plat_specific and EXEC_PREFIX or PREFIX
+ if plat_specific:
+ prefix = os.environ['STAGING_LIBDIR'].rstrip(lib_basename)
+ else:
+ prefix = PREFIX
if os.name == "posix":
libpython = os.path.join(prefix,
- "lib", "python" + get_python_version())
+ lib_basename, "python" + get_python_version())
if standard_lib:
return libpython
else:
--
2.8.0.rc3

View File

@@ -1,59 +0,0 @@
From 77bcb3238b2853d511714544e0f84a37be6c79bf Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Wed, 14 Nov 2012 14:31:24 +0000
Subject: [PATCH] python: Resolve intermediate staging issues
When cross compiling python, we used to need to install the Makefile, pyconfig.h
and the python library to their final location before being able to compile the
rest of python. This change allows us to point python at its own source when
building, avoiding a variety of sysroot staging issues and simplifying the main
python recipe.
Upstream-Status: Inappropriate
RP 2012/11/13
---
Lib/distutils/sysconfig.py | 3 +++
Lib/sysconfig.py | 5 ++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 2f4b8ca..15bceb5 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -31,6 +31,9 @@ else:
# sys.executable can be empty if argv[0] has been changed and Python is
# unable to retrieve the real program name
project_base = os.getcwd()
+_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None)
+if _PYTHONBUILDDIR:
+ project_base = _PYTHONBUILDDIR
if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
# PC/VS7.1
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 9c8350d..bddbe2e 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -93,6 +93,7 @@ _PREFIX = os.path.normpath(sys.prefix)
_EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
_CONFIG_VARS = None
_USER_BASE = None
+_PYTHONBUILDDIR = os.environ.get("PYTHONBUILDDIR", None)
def _safe_realpath(path):
try:
@@ -100,7 +101,9 @@ def _safe_realpath(path):
except OSError:
return path
-if sys.executable:
+if _PYTHONBUILDDIR:
+ _PROJECT_BASE = _PYTHONBUILDDIR
+elif sys.executable:
_PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))
else:
# sys.executable can be empty if argv[0] has been changed and Python is
--
2.17.1

View File

@@ -1,114 +0,0 @@
From 3f49be81e31c164654aeb10b65ebade982ca2ed8 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Mon, 22 Oct 2018 15:24:48 +0800
Subject: [PATCH] python2: use cc_basename to replace CC for checking compiler
When working path contains "clang"/"gcc"/"icc", it might be part of $CC
because of the "--sysroot" parameter. That could cause judgement error
about clang/gcc/icc compilers. e.g.
When "icc" is containded in working path, below errors are reported when
compiling python:
x86_64-wrs-linux-gcc: error: strict: No such file or directory
x86_64-wrs-linux-gcc: error: unrecognized command line option '-fp-model'
Here use cc_basename to replace CC for checking compiler to avoid such
kind of issue.
Upstream-Status: Pending
Signed-off-by: Li Zhou <li.zhou@windriver.com>
Patch orignally from Li Zhou, I just rework it to new version
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
configure.ac | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index db1c940..dfcd89a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -684,7 +684,7 @@ AC_MSG_RESULT($with_cxx_main)
preset_cxx="$CXX"
if test -z "$CXX"
then
- case "$CC" in
+ case "$cc_basename" in
gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
esac
@@ -757,14 +757,14 @@ rmdir CaseSensitiveTestDir
case $MACHDEP in
bsdos*)
- case $CC in
+ case $cc_basename in
gcc) CC="$CC -D_HAVE_BSDI";;
esac;;
esac
case $ac_sys_system in
hp*|HP*)
- case $CC in
+ case $cc_basename in
cc|*/cc) CC="$CC -Ae";;
esac;;
SunOS*)
@@ -1084,7 +1084,7 @@ then
fi
# Clang also needs -fwrapv
- case $CC in
+ case $cc_basename in
*clang*) WRAP="-fwrapv"
;;
esac
@@ -1304,7 +1304,7 @@ yes)
esac
# ICC needs -fp-model strict or floats behave badly
-case "$CC" in
+case "$cc_basename" in
*icc*)
BASECFLAGS="$BASECFLAGS -fp-model strict"
;;
@@ -1443,7 +1443,7 @@ else
fi],
[AC_MSG_RESULT(no)])
if test "$Py_LTO" = 'true' ; then
- case $CC in
+ case $cc_basename in
*clang*)
# Any changes made here should be reflected in the GCC+Darwin case below
LTOFLAGS="-flto"
@@ -1508,7 +1508,7 @@ then
fi
fi
LLVM_PROF_ERR=no
-case $CC in
+case $cc_basename in
*clang*)
# Any changes made here should be reflected in the GCC+Darwin case below
PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
@@ -2322,7 +2322,7 @@ then
then CCSHARED="-fPIC"
else CCSHARED="-Kpic -belf"
fi;;
- IRIX*/6*) case $CC in
+ IRIX*/6*) case $cc_basename in
*gcc*) CCSHARED="-shared";;
*) CCSHARED="";;
esac;;
@@ -2366,7 +2366,7 @@ then
then
LINKFORSHARED="-Wl,--export-dynamic"
fi;;
- SunOS/5*) case $CC in
+ SunOS/5*) case $cc_basename in
*gcc*)
if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
then
--
2.7.4

View File

@@ -1,49 +0,0 @@
We need to ensure our host tools get run during build, not the freshly
built cross-tools (this will not work), so we introduce HOSTPYTHON and HOSTPGEN.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Michael 'Mickey' Lauer <mickey@vanille-media.de>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Rebased for python-2.7.9
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Rebased for python-2.7.14
Signed-off-by: Derek Straka <derek@asterius.io>
Index: Python-2.7.13/Makefile.pre.in
===================================================================
--- Python-2.7.13.orig/Makefile.pre.in
+++ Python-2.7.13/Makefile.pre.in
@@ -512,7 +513,7 @@ $(BUILDPYTHON): Modules/python.o $(LIBRA
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
platform: $(BUILDPYTHON) pybuilddir.txt
- $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
# Create build directory and generate the sysconfig build-time data there.
# pybuilddir.txt contains the name of the build dir and is used for
Index: Python-2.7.13/setup.py
===================================================================
--- Python-2.7.13.orig/setup.py
+++ Python-2.7.13/setup.py
@@ -350,6 +350,7 @@ class PyBuildExt(build_ext):
self.failed.append(ext.name)
self.announce('*** WARNING: renaming "%s" since importing it'
' failed: %s' % (ext.name, why), level=3)
+ return
assert not self.inplace
basename, tail = os.path.splitext(ext_filename)
newname = basename + "_failed" + tail
@@ -574,6 +575,9 @@ class PyBuildExt(build_ext):
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
+ lib_dirs = [ os.getenv("STAGING_LIBDIR"), os.getenv("STAGING_BASELIBDIR") ]
+ inc_dirs = [ os.getenv("STAGING_INCDIR") ]
+
#
# The following modules are all pretty straightforward, and compile
# on pretty much any POSIXish platform.

View File

@@ -1,46 +0,0 @@
Upstream-Status: Inappropriate [embedded specific]
We need to supply STAGING_INCDIR here, otherwise the Tk headers
will not be found.
Signed-off-by: Michael 'Mickey' Lauer <mickey@vanille.de>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Rebased for python-2.7.9
diff --git a/setup.py b/setup.py
index 8fe1fb8..67eda74 100644
--- a/setup.py
+++ b/setup.py
@@ -1892,7 +1892,7 @@ class PyBuildExt(build_ext):
dotversion = dotversion[:-1] + '.' + dotversion[-1]
tcl_include_sub = []
tk_include_sub = []
- for dir in inc_dirs:
+ for dir in [os.getenv("STAGING_INCDIR")]:
tcl_include_sub += [dir + os.sep + "tcl" + dotversion]
tk_include_sub += [dir + os.sep + "tk" + dotversion]
tk_include_sub += tcl_include_sub
@@ -1911,22 +1911,6 @@ class PyBuildExt(build_ext):
if dir not in include_dirs:
include_dirs.append(dir)
- # Check for various platform-specific directories
- if host_platform == 'sunos5':
- include_dirs.append('/usr/openwin/include')
- added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
- # Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
-
# If Cygwin, then verify that X is installed before proceeding
if host_platform == 'cygwin':
x11_inc = find_file('X11/Xlib.h', [], include_dirs)

View File

@@ -1,27 +0,0 @@
Rebased for python 2.7.9
Upstream-Status: Inappropriate [embedded specific]
# CTypes need to know the actual host we are building on.
# Signed-Off: Michael Dietrich <mdt@emdete.de>
Index: Python-2.7.9/setup.py
===================================================================
--- Python-2.7.9.orig/setup.py
+++ Python-2.7.9/setup.py
@@ -2028,12 +2028,12 @@ class PyBuildExt(build_ext):
# 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))
+ cmd = "(cd %s && autoconf -W cross) && (cd %s && env CFLAGS='' '%s/configure' %s)" \
+ % (ffi_srcdir, ffi_builddir, ffi_srcdir, " ".join(config_args))
res = os.system(cmd)
if res or not os.path.exists(ffi_configfile):
- print "Failed to configure _ctypes module"
+ print "Failed to configure _ctypes module (res=%d) or missing conffile=%s" % ( res, ffi_configfile )
return False
fficonfig = {}

View File

@@ -1,35 +0,0 @@
Upstream-Status: Pending
The poison directories patch has detected library path issue while
compiling the python in cross environment, as seen bellow.
warning: library search path "/usr/lib/termcap" is unsafe for cross-compilation
This Patch fixes this issue in the python build environment.
11 Oct 2010
Nitin A Kamble <nitin.a.kamble@intel.com>
2011/09/29
Rebased for python 2.7.2
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
diff --git a/setup.py b/setup.py
index 67eda74..59c537e 100644
--- a/setup.py
+++ b/setup.py
@@ -761,12 +761,10 @@ class PyBuildExt(build_ext):
pass # Issue 7384: Already linked against curses or tinfo.
elif curses_library:
readline_libs.append(curses_library)
- elif self.compiler.find_library_file(lib_dirs +
- ['/usr/lib/termcap'],
+ elif self.compiler.find_library_file(lib_dirs,
'termcap'):
readline_libs.append('termcap')
exts.append( Extension('readline', ['readline.c'],
- library_dirs=['/usr/lib/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
else:

View File

@@ -1,28 +0,0 @@
configure.ac: add CROSSPYTHONPATH into PYTHONPATH for PYTHON_FOR_BUILD
When building x86->x86 the system will try to execute .so and related items
from the default PYTHONPATH. This will fail if the target CPU contains
instructions that the host CPU does not have, add CROSSPYTHONPATH
into PYTHONPATH so we can prepend the list to find correct libs.
Upstream-Status: Inappropriate [OE-Core integration specific]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: Python-2.7.14/configure.ac
===================================================================
--- Python-2.7.14.orig/configure.ac
+++ Python-2.7.14/configure.ac
@@ -36,7 +36,7 @@ if test "$cross_compiling" = yes; then
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
fi
AC_MSG_RESULT($interp)
- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(CROSSPYTHONPATH):$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
fi
elif test "$cross_compiling" = maybe; then
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])

View File

@@ -1,18 +0,0 @@
Upstream-Status: Inappropriate [configuration]
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Index: Python-2.7.2/Modules/Setup.dist
===================================================================
--- Python-2.7.2.orig/Modules/Setup.dist 2011-06-11 08:46:26.000000000 -0700
+++ Python-2.7.2/Modules/Setup.dist 2011-12-27 15:51:41.244623219 -0800
@@ -248,7 +248,7 @@
# Message-Digest Algorithm, described in RFC 1321. The necessary files
# md5.c and md5.h are included here.
-#_md5 md5module.c md5.c
+_md5 md5module.c md5.c
# The _sha module implements the SHA checksum algorithms.

View File

@@ -1,29 +0,0 @@
_tkinter module needs tk module along with tcl. tk is not yet integrated
in yocto so we skip the check for this module.
Avoid a warning by not adding this module to missing variable.
Upstream-Status: Inappropriate [distribution]
Also simply disable the tk module since its not in DEPENDS.
Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Index: Python-2.7.13/setup.py
===================================================================
--- Python-2.7.13.orig/setup.py
+++ Python-2.7.13/setup.py
@@ -1783,10 +1783,12 @@ class PyBuildExt(build_ext):
self.extensions.extend(exts)
# Call the method for detecting whether _tkinter can be compiled
- self.detect_tkinter(inc_dirs, lib_dirs)
+ # self.detect_tkinter(inc_dirs, lib_dirs)
- if '_tkinter' not in [e.name for e in self.extensions]:
- missing.append('_tkinter')
+ # tkinter module will not be avalaible as yocto
+ # doesn't have tk integrated (yet)
+ #if '_tkinter' not in [e.name for e in self.extensions]:
+ # missing.append('_tkinter')
## # Uncomment these lines if you want to play with xxmodule.c
## ext = Extension('xx', ['xxmodule.c'])

View File

@@ -1,23 +0,0 @@
sunaudiodev module is sunos specific so we avoid a warning by not
adding this module to missing variable.
Upstream-Status: Inappropriate [distribution]
Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Index: Python-2.7.13/setup.py
===================================================================
--- Python-2.7.13.orig/setup.py
+++ Python-2.7.13/setup.py
@@ -1671,8 +1671,9 @@ class PyBuildExt(build_ext):
if host_platform == 'sunos5':
# SunOS specific modules
exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
- else:
- missing.append('sunaudiodev')
+ # If platform is not sunos warning is useless
+ #else:
+ # missing.append('sunaudiodev')
if host_platform == 'darwin':
# _scproxy

View File

@@ -1,23 +0,0 @@
Lib/cgi.py: Update the script as mentioned in the comment
Upstream-Status: Inappropriate [distribution]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
--- Python-2.6.6/Lib/cgi.py.orig 2010-08-01 22:14:27.000000000 -0500
+++ Python-2.6.6/Lib/cgi.py 2011-09-21 15:28:40.478208631 -0500
@@ -1,13 +1,4 @@
-#! /usr/local/bin/python
-
-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
-# intentionally NOT "/usr/bin/env python". On many systems
-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
-# scripts, and /usr/local/bin is the default directory where Python is
-# installed, so /usr/bin/env would be unable to find python. Granted,
-# binary installations by Linux vendors often install Python in
-# /usr/bin. So let those vendors patch cgi.py to match their choice
-# of installation.
+#! /usr/bin/env python
"""Support module for CGI (Common Gateway Interface) scripts.

View File

@@ -1,57 +0,0 @@
Author: Andrei Gherzan <andrei@gherzan.ro>
Date: Sun Mar 25 02:02:27 2012 +0200
This patch was added for 64bit host machines. In the compile process python
is checking if platform is a 64bit platform using sys.maxint which is the host's
value. The patch fixes this issue so that python would check if TARGET machine
is 64bit not the HOST machine. In this way will have "dl" and "imageop" modules
built if HOST machine is 64bit but the target machine is 32bit.
Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Upstream-Status: Pending
Index: Python-2.7.11/setup.py
===================================================================
--- Python-2.7.11.orig/setup.py
+++ Python-2.7.11/setup.py
@@ -35,6 +35,21 @@ COMPILED_WITH_PYDEBUG = ('--with-pydebug
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = []
+def target_is_64bit_platform ():
+ """
+ In case of cross-compile, some modules are not build as setup checks if HOST
+ is 64bit and not TARGET.
+ As python was built for TARGET we can check this in pyconfig.h in this way:
+ Sizeof LONG on a 32 bit platform is 4 bytes
+ Sizeof LONG on a 64 bit platform is 8 bytes
+ """
+ pyconf = open("pyconfig.h").read()
+ aux = re.search(r"#s*define\s+SIZEOF_LONG\s+8\s*", pyconf)
+ if aux is not None:
+ return True
+ else:
+ return False
+
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'
@@ -716,7 +731,7 @@ class PyBuildExt(build_ext):
exts.append( Extension('audioop', ['audioop.c']) )
# Disabled on 64-bit platforms
- if sys.maxsize != 9223372036854775807L:
+ if not target_is_64bit_platform():
# Operations on images
exts.append( Extension('imageop', ['imageop.c']) )
else:
@@ -1545,7 +1560,7 @@ class PyBuildExt(build_ext):
missing.append('_codecs_%s' % loc)
# Dynamic loading module
- if sys.maxint == 0x7fffffff:
+ if not target_is_64bit_platform():
# This requires sizeof(int) == sizeof(long) == sizeof(char*)
dl_inc = find_file('dlfcn.h', [], inc_dirs)
if (dl_inc is not None) and (host_platform not in ['atheos']):

View File

@@ -1,298 +0,0 @@
# This script is used as a bitbake task to create a new python manifest
# $ bitbake python -c create_manifest
#
# Our goal is to keep python-core as small as posible and add other python
# packages only when the user needs them, hence why we split upstream python
# into several packages.
#
# In a very simplistic way what this does is:
# Launch python and see specifically what is required for it to run at a minimum
#
# Go through the python-manifest file and launch a separate task for every single
# one of the files on each package, this task will check what was required for that
# specific module to run, these modules will be called dependencies.
# The output of such task will be a list of the modules or dependencies that were
# found for that file.
#
# Such output will be parsed by this script, we will look for each dependency on the
# manifest and if we find that another package already includes it, then we will add
# that package as an RDEPENDS to the package we are currently checking; in case we dont
# find the current dependency on any other package we will add it to the current package
# as part of FILES.
#
#
# This way we will create a new manifest from the data structure that was built during
# this process, on this new manifest each package will contain specifically only
# what it needs to run.
#
# There are some caveats which we try to deal with, such as repeated files on different
# packages, packages that include folders, wildcards, and special packages.
# Its also important to note that this method only works for python files, and shared
# libraries. Static libraries, header files and binaries need to be dealt with manually.
#
# Author: Alejandro Enedino Hernandez Samaniego "aehs29" <aehs29 at gmail dot com>
import sys
import subprocess
import json
import os
import collections
# Hack to get native python search path (for folders), not fond of it but it works for now
pivot='recipe-sysroot-native'
for p in sys.path:
if pivot in p:
nativelibfolder=p[:p.find(pivot)+len(pivot)]
# Empty dict to hold the whole manifest
new_manifest = collections.OrderedDict()
# Check for repeated files, folders and wildcards
allfiles=[]
repeated=[]
wildcards=[]
hasfolders=[]
allfolders=[]
def isFolder(value):
if os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib')) or os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib64')) or os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib32')):
return True
else:
return False
def prepend_comments(comments, json_manifest):
with open(json_manifest, 'r+') as manifest:
json_contents = manifest.read()
manifest.seek(0, 0)
manifest.write(comments + json_contents)
# Read existing JSON manifest
with open('python2-manifest.json') as manifest:
# The JSON format doesn't allow comments so we hack the call to keep the comments using a marker
manifest_str = manifest.read()
json_start = manifest_str.find('# EOC') + 6 # EOC + \n
manifest.seek(0)
comments = manifest.read(json_start)
manifest_str = manifest.read()
old_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
# First pass to get core-package functionality, because we base everything on the fact that core is actually working
# Not exactly the same so it should not be a function
print ("Getting dependencies for core package:")
# Special call to check for core package
output = subprocess.check_output([sys.executable, 'get_module_deps2.py', 'python-core-package'])
for item in output.split():
# We append it so it doesnt hurt what we currently have:
if item not in old_manifest['core']['files']:
# We use the same data structure since its the one which will be used to check
# dependencies for other packages
old_manifest['core']['files'].append(item)
for value in old_manifest['core']['files']:
# Ignore folders, since we don't import those, difficult to handle multilib
if isFolder(value):
# Pass it directly
if value not in old_manifest['core']['files']:
old_manifest['core']['files'].append(value)
# Ignore binaries, since we don't import those, assume it was added correctly (manually)
if '${bindir}' in value:
# Pass it directly
if value not in old_manifest['core']['files']:
old_manifest['core']['files'].append(value)
continue
# Ignore empty values
if value == '':
continue
if '${includedir}' in value:
if value not in old_manifest['core']['files']:
old_manifest['core']['files'].append(value)
continue
# Get module name , shouldnt be affected by libdir/bindir
value = os.path.splitext(os.path.basename(os.path.normpath(value)))[0]
# Launch separate task for each module for deterministic behavior
# Each module will only import what is necessary for it to work in specific
print ('Getting dependencies for module: %s' % value)
output = subprocess.check_output([sys.executable, 'get_module_deps2.py', '%s' % value])
for item in output.split():
# We append it so it doesnt hurt what we currently have:
if item not in old_manifest['core']['files']:
old_manifest['core']['files'].append(item)
# We check which packages include folders
for key in old_manifest:
for value in old_manifest[key]['files']:
# Ignore folders, since we don't import those, difficult to handle multilib
if isFolder(value):
print ('%s is a folder' % value)
if key not in hasfolders:
hasfolders.append(key)
if value not in allfolders:
allfolders.append(value)
for key in old_manifest:
# Use an empty dict as data structure to hold data for each package and fill it up
new_manifest[key] = collections.OrderedDict()
new_manifest[key]['summary'] = old_manifest[key]['summary']
new_manifest[key]['rdepends']=[]
new_manifest[key]['files'] = []
# All packages should depend on core
if key != 'core':
new_manifest[key]['rdepends'].append('core')
# Handle special cases, we assume that when they were manually added
# to the manifest we knew what we were doing.
print ('Handling package %s' % key)
special_packages=['misc', 'modules', 'tests', 'dev']
if key in special_packages or 'staticdev' in key:
print('Passing %s package directly' % key)
new_manifest[key]=old_manifest[key]
continue
for value in old_manifest[key]['files']:
# We already handled core on the first pass
if key == 'core':
new_manifest[key]['files'].append(value)
continue
# Ignore folders, since we don't import those, difficult to handle multilib
if isFolder(value):
# Pass folders directly
new_manifest[key]['files'].append(value)
# Ignore binaries, since we don't import those
if '${bindir}' in value:
# Pass it directly to the new manifest data structure
if value not in new_manifest[key]['files']:
new_manifest[key]['files'].append(value)
continue
# Ignore empty values
if value == '':
continue
if '${includedir}' in value:
if value not in new_manifest[key]['files']:
new_manifest[key]['files'].append(value)
continue
# Get module name , shouldnt be affected by libdir/bindir
value = os.path.splitext(os.path.basename(os.path.normpath(value)))[0]
# Launch separate task for each module for deterministic behavior
# Each module will only import what is necessary for it to work in specific
print ('Getting dependencies for module: %s' % value)
output = subprocess.check_output([sys.executable, 'get_module_deps2.py', '%s' % value])
# We can print dependencies for debugging purposes
#print (output)
# Output will have all dependencies
for item in output.split():
# Warning: This first part is ugly
# One of the dependencies that was found, could be inside of one of the folders included by another package
# We need to check if this happens so we can add the package containing the folder as an RDEPENDS
# e.g. Folder encodings contained in codecs
# This would be solved if no packages included any folders
# This can be done in two ways:
# 1 - We assume that if we take out the filename from the path we would get
# the folder string, then we would check if folder string is in the list of folders
# This would not work if a package contains a folder which contains another folder
# e.g. path/folder1/folder2/filename folder_string= path/folder1/folder2
# folder_string would not match any value contained in the list of folders
#
# 2 - We do it the other way around, checking if the folder is contained in the path
# e.g. path/folder1/folder2/filename folder_string= path/folder1/folder2
# is folder_string inside path/folder1/folder2/filename?,
# Yes, it works, but we waste a couple of milliseconds.
inFolders=False
for folder in allfolders:
# The module could have a directory named after it, e.g. xml, if we take out the filename from the path
# we'll end up with ${libdir}, and we want ${libdir}/xml
if isFolder(item):
check_path = item
else:
check_path = os.path.dirname(item)
if folder in check_path :
inFolders = True # Did we find a folder?
folderFound = False # Second flag to break inner for
# Loop only through packages which contain folders
for keyfolder in hasfolders:
if (folderFound == False):
#print("Checking folder %s on package %s" % (item,keyfolder))
for file_folder in old_manifest[keyfolder]['files']:
if file_folder==folder:
print ('%s found in %s' % (folder, keyfolder))
folderFound = True
if keyfolder not in new_manifest[key]['rdepends'] and keyfolder != key:
new_manifest[key]['rdepends'].append(keyfolder)
else:
break
# A folder was found so we're done with this item, we can go on
if inFolders:
continue
# We might already have it on the dictionary since it could depend on a (previously checked) module
if item not in new_manifest[key]['files']:
# Handle core as a special package, we already did it so we pass it to NEW data structure directly
if key=='core':
print('Adding %s to %s FILES' % (item, key))
if item.endswith('*'):
wildcards.append(item)
new_manifest[key]['files'].append(item)
# Check for repeated files
if item not in allfiles:
allfiles.append(item)
else:
repeated.append(item)
else:
# Check if this dependency is already contained on another package, so we add it
# as an RDEPENDS, or if its not, it means it should be contained on the current
# package, so we should add it to FILES
for newkey in old_manifest:
# Debug
#print("Checking %s " % item + " in %s" % newkey)
if item in old_manifest[newkey]['files']:
# Since were nesting, we need to check its not the same key
if(newkey!=key):
if newkey not in new_manifest[key]['rdepends']:
# Add it to the new manifest data struct
# Debug
print('Adding %s to %s RDEPENDS, because it contains %s' % (newkey, key, item))
new_manifest[key]['rdepends'].append(newkey)
break
else:
# Debug
print('Adding %s to %s FILES' % (item, key))
# Since it wasnt found on another package, its not an RDEP, so add it to FILES for this package
new_manifest[key]['files'].append(item)
if item.endswith('*'):
wildcards.append(item)
if item not in allfiles:
allfiles.append(item)
else:
repeated.append(item)
print ('The following files are repeated (contained in more than one package), please check which package should get it:')
print (repeated)
print('The following files contain wildcards, please check they are necessary')
print(wildcards)
print('The following files contain folders, please check they are necessary')
print(hasfolders)
# Sort it just so it looks nice
for key in new_manifest:
new_manifest[key]['files'].sort()
new_manifest[key]['rdepends'].sort()
# Create the manifest from the data structure that was built
with open('python2-manifest.json.new','w') as outfile:
json.dump(new_manifest,outfile, indent=4)
prepend_comments(comments,'python2-manifest.json.new')

View File

@@ -1,77 +0,0 @@
Upstream-Status: Inappropriate [Embedded specific]
This patch fixes issuing with different libdir like lib64.
This patch makes the native python binary modules findable
in the install process of the host python.
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: 2012/03/14
Updated for python 2.7.3
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: 2012/05/01
Rebased for python-2.7.9
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Index: Python-2.7.9/Lib/sysconfig.py
===================================================================
--- Python-2.7.9.orig/Lib/sysconfig.py
+++ Python-2.7.9/Lib/sysconfig.py
@@ -9,7 +9,7 @@ _INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
+ 'purelib': '{base}/'+sys.lib+'/python{py_version_short}/site-packages',
'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
'include': '{base}/include/python{py_version_short}',
'platinclude': '{platbase}/include/python{py_version_short}',
@@ -67,7 +67,7 @@ _INSTALL_SCHEMES = {
'posix_user': {
'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
- 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
+ 'purelib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
'include': '{userbase}/include/python{py_version_short}',
'scripts': '{userbase}/bin',
Index: Python-2.7.9/Makefile.pre.in
===================================================================
--- Python-2.7.9.orig/Makefile.pre.in
+++ Python-2.7.9/Makefile.pre.in
@@ -1037,27 +1037,27 @@ libinstall: build_all $(srcdir)/Lib/$(PL
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(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) \
+ PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(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) \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(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) \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(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) \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
# Create the PLATDIR source directory, if one wasn't distributed..

View File

@@ -1,216 +0,0 @@
Python uses AC_RUN_IFELSE to determine the byte order for floats and doubles,
and falls back onto "I don't know" if it can't run code. This results in
crippled floating point numbers in Python, and the regression tests fail.
Instead of running code, take a macro from autoconf-archive which compiles C
with a special double in which has an ASCII representation, and then greps the
binary to identify the format.
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@intel.com>
From 253f47b28120c42cfe53a4e2f5ed0ab0ed469deb Mon Sep 17 00:00:00 2001
From: Ross Burton <ross@burtonini.com>
Date: Wed, 19 Sep 2018 07:25:48 +0100
Subject: [PATCH] closes bpo-34585: Don't do runtime test to get float byte
order. (GH-9085)
Currently configure.ac uses AC_RUN_IFELSE to determine the byte order of doubles, but this silently fails under cross compilation and Python doesn't do floats properly.
Instead, steal a macro from autoconf-archive which compiles code using magic doubles (which encode to ASCII) and grep for the representation in the binary.
RFC because this doesn't yet handle the weird ancient ARMv4 OABI 'mixed-endian' encoding properly. This encoding is ancient and I don't believe the union of "Python 3.8 users" and "OABI users" has anything in. Should the support for this just be dropped too? Alternatively, someone will need to find an OABI toolchain to verify the encoding of the magic double.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
.../Build/2018-09-18-16-28-31.bpo-34585.CGMu0h.rst | 3 +
configure.ac | 76 ++++----------------
m4/ax_c_float_words_bigendian.m4 | 83 ++++++++++++++++++++++
3 files changed, 99 insertions(+), 63 deletions(-)
create mode 100644 Misc/NEWS.d/next/Build/2018-09-18-16-28-31.bpo-34585.CGMu0h.rst
create mode 100644 m4/ax_c_float_words_bigendian.m4
diff --git a/configure.ac b/configure.ac
index 913d5469d0..7672735396 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3835,74 +3835,24 @@ fi],
# * Check for various properties of floating point *
# **************************************************
-AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
-AC_CACHE_VAL(ac_cv_little_endian_double, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
- return 0;
- else
- return 1;
-}
-]])],
-[ac_cv_little_endian_double=yes],
-[ac_cv_little_endian_double=no],
-[ac_cv_little_endian_double=no])])
-AC_MSG_RESULT($ac_cv_little_endian_double)
-if test "$ac_cv_little_endian_double" = yes
-then
- AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
- [Define if C doubles are 64-bit IEEE 754 binary format, stored
- with the least significant byte first])
-fi
-
-AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
-AC_CACHE_VAL(ac_cv_big_endian_double, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
- return 0;
- else
- return 1;
-}
-]])],
-[ac_cv_big_endian_double=yes],
-[ac_cv_big_endian_double=no],
-[ac_cv_big_endian_double=no])])
-AC_MSG_RESULT($ac_cv_big_endian_double)
-if test "$ac_cv_big_endian_double" = yes
+AX_C_FLOAT_WORDS_BIGENDIAN
+if test "$ax_cv_c_float_words_bigendian" = "yes"
then
AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
[Define if C doubles are 64-bit IEEE 754 binary format, stored
with the most significant byte first])
-fi
-
-# Some ARM platforms use a mixed-endian representation for doubles.
-# While Python doesn't currently have full support for these platforms
-# (see e.g., issue 1762561), we can at least make sure that float <-> string
-# conversions work.
-AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
-AC_CACHE_VAL(ac_cv_mixed_endian_double, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
- return 0;
- else
- return 1;
-}
-]])],
-[ac_cv_mixed_endian_double=yes],
-[ac_cv_mixed_endian_double=no],
-[ac_cv_mixed_endian_double=no])])
-AC_MSG_RESULT($ac_cv_mixed_endian_double)
-if test "$ac_cv_mixed_endian_double" = yes
+elif test "$ax_cv_c_float_words_bigendian" = "no"
then
+ AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
+ [Define if C doubles are 64-bit IEEE 754 binary format, stored
+ with the least significant byte first])
+else
+ # Some ARM platforms use a mixed-endian representation for doubles.
+ # While Python doesn't currently have full support for these platforms
+ # (see e.g., issue 1762561), we can at least make sure that float <-> string
+ # conversions work.
+ # FLOAT_WORDS_BIGENDIAN doesnt actually detect this case, but if it's not big
+ # or little, then it must be this?
AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
[Define if C doubles are 64-bit IEEE 754 binary format, stored
in ARM mixed-endian order (byte order 45670123)])
diff --git a/m4/ax_c_float_words_bigendian.m4 b/m4/ax_c_float_words_bigendian.m4
new file mode 100644
index 0000000000..216b90d803
--- /dev/null
+++ b/m4/ax_c_float_words_bigendian.m4
@@ -0,0 +1,83 @@
+# ===============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html
+# ===============================================================================
+#
+# SYNOPSIS
+#
+# AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
+#
+# DESCRIPTION
+#
+# Checks the ordering of words within a multi-word float. This check is
+# necessary because on some systems (e.g. certain ARM systems), the float
+# word ordering can be different from the byte ordering. In a multi-word
+# float context, "big-endian" implies that the word containing the sign
+# bit is found in the memory location with the lowest address. This
+# implementation was inspired by the AC_C_BIGENDIAN macro in autoconf.
+#
+# The endianness is detected by first compiling C code that contains a
+# special double float value, then grepping the resulting object file for
+# certain strings of ASCII values. The double is specially crafted to have
+# a binary representation that corresponds with a simple string. In this
+# implementation, the string "noonsees" was selected because the
+# individual word values ("noon" and "sees") are palindromes, thus making
+# this test byte-order agnostic. If grep finds the string "noonsees" in
+# the object file, the target platform stores float words in big-endian
+# order. If grep finds "seesnoon", float words are in little-endian order.
+# If neither value is found, the user is instructed to specify the
+# ordering.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Daniel Amelang <dan@amelang.net>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 11
+
+AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
+ [AC_CACHE_CHECK(whether float word ordering is bigendian,
+ ax_cv_c_float_words_bigendian, [
+
+ax_cv_c_float_words_bigendian=unknown
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+
+double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
+
+]])], [
+
+if grep noonsees conftest.$ac_objext >/dev/null ; then
+ ax_cv_c_float_words_bigendian=yes
+fi
+if grep seesnoon conftest.$ac_objext >/dev/null ; then
+ if test "$ax_cv_c_float_words_bigendian" = unknown; then
+ ax_cv_c_float_words_bigendian=no
+ else
+ ax_cv_c_float_words_bigendian=unknown
+ fi
+fi
+
+])])
+
+case $ax_cv_c_float_words_bigendian in
+ yes)
+ m4_default([$1],
+ [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
+ [Define to 1 if your system stores words within floats
+ with the most significant word first])]) ;;
+ no)
+ $2 ;;
+ *)
+ m4_default([$3],
+ [AC_MSG_ERROR([
+
+Unknown float word ordering. You need to manually preset
+ax_cv_c_float_words_bigendian=no (or yes) according to your system.
+
+ ])]) ;;
+esac
+
+])# AX_C_FLOAT_WORDS_BIGENDIAN
--
2.11.0

View File

@@ -1,112 +0,0 @@
# This script is launched on separate task for each python module
# It checks for dependencies for that specific module and prints
# them out, the output of this execution will have all dependencies
# for a specific module, which will be parsed an dealt on create_manifest.py
#
# Author: Alejandro Enedino Hernandez Samaniego "aehs29" <aehs29@gmail.com>
# We can get a log per module, for all the dependencies that were found, but its messy.
debug=False
import sys
# We can get a list of the modules which are currently required to run python
# so we run python-core and get its modules, we then import what we need
# and check what modules are currently running, if we substract them from the
# modules we had initially, we get the dependencies for the module we imported.
# We use importlib to achieve this, so we also need to know what modules importlib needs
import importlib
core_deps=set(sys.modules)
def fix_path(dep_path):
import os
# We DONT want the path on our HOST system
pivot='recipe-sysroot-native'
dep_path=dep_path[dep_path.find(pivot)+len(pivot):]
if '/usr/bin' in dep_path:
dep_path = dep_path.replace('/usr/bin''${bindir}')
# Handle multilib, is there a better way?
if '/usr/lib32' in dep_path:
dep_path = dep_path.replace('/usr/lib32','${libdir}')
if '/usr/lib64' in dep_path:
dep_path = dep_path.replace('/usr/lib64','${libdir}')
if '/usr/lib' in dep_path:
dep_path = dep_path.replace('/usr/lib','${libdir}')
if '/usr/include' in dep_path:
dep_path = dep_path.replace('/usr/include','${includedir}')
if '__init__.' in dep_path:
dep_path = os.path.split(dep_path)[0]
# If a *.pyc file was imported, we replace it with *.py (since we deal with PYCs on create_manifest)
if '.pyc' in dep_path:
dep_path = dep_path.replace('.pyc','.py')
return dep_path
# Module to import was passed as an argument
current_module = str(sys.argv[1]).rstrip()
if(debug==True):
log = open('log_%s' % current_module,'w')
log.write('Module %s generated the following dependencies:\n' % current_module)
try:
importlib.import_module('%s' % current_module)
except ImportError as e:
if (debug==True):
log.write('Module was not found')
pass
# Get current module dependencies, dif will contain a list of specific deps for this module
module_deps=set(sys.modules)
# We handle the core package (1st pass on create_manifest.py) as a special case
if current_module == 'python-core-package':
dif = core_deps
else:
dif = module_deps-core_deps
# Check where each dependency came from
for item in dif:
dep_path=''
try:
if (debug==True):
log.write('Calling: sys.modules[' + '%s' % item + '].__file__\n')
dep_path = sys.modules['%s' % item].__file__
except AttributeError as e:
# Deals with thread (builtin module) not having __file__ attribute
if debug==True:
log.write(item + ' ')
log.write(str(e))
log.write('\n')
pass
except NameError as e:
# Deals with NameError: name 'dep_path' is not defined
# because module is not found (wasn't compiled?), e.g. bddsm
if (debug==True):
log.write(item+' ')
log.write(str(e))
pass
# Site-customize is a special case since we (OpenEmbedded) put it there manually
if 'sitecustomize' in dep_path:
dep_path = '${libdir}/python2.7/sitecustomize.py'
# Prints out result, which is what will be used by create_manifest
print (dep_path)
continue
dep_path = fix_path(dep_path)
if (debug==True):
log.write(dep_path+'\n')
# Prints out result, which is what will be used by create_manifest
print (dep_path)
if debug==True:
log.close()

View File

@@ -1,28 +0,0 @@
when building python for qemux86-64 on ubuntu 11.10/64bit
it gropes into host includes and then mixes them with cross
includes and as a result some modules fail to compile and link
one of the modules is python-elementtree which is then not
found during image creation
Proble is that setup.py tries to add native includes that newer
ubuntu has introduced for multiarch support. But that should
only happen for native builds and not cross building python
so we add a check here.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
diff --git a/setup.py b/setup.py
index ba2d242..bf859be 100644
--- a/setup.py
+++ b/setup.py
@@ -393,6 +393,8 @@ class PyBuildExt(build_ext):
if not find_executable('dpkg-architecture'):
return
+ if os.environ.get('CROSS_COMPILE') is not None:
+ return
opt = ''
if cross_compiling:
opt = '-t' + sysconfig.get_config_var('HOST_GNU_TYPE')

View File

@@ -1,298 +0,0 @@
Rebased for python-2.7.9
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Upstream-Status: Pending
Index: Python-2.7.14/configure.ac
===================================================================
--- Python-2.7.14.orig/configure.ac
+++ Python-2.7.14/configure.ac
@@ -758,6 +758,10 @@ SunOS*)
;;
esac
+AC_SUBST(LIB)
+AC_MSG_CHECKING(LIB)
+LIB="SEDMELIBLEAF"
+AC_MSG_RESULT($LIB)
AC_SUBST(LIBRARY)
AC_MSG_CHECKING(LIBRARY)
Index: Python-2.7.14/Include/pythonrun.h
===================================================================
--- Python-2.7.14.orig/Include/pythonrun.h
+++ Python-2.7.14/Include/pythonrun.h
@@ -108,6 +108,7 @@ PyAPI_FUNC(char *) Py_GetPath(void);
/* In their own files */
PyAPI_FUNC(const char *) Py_GetVersion(void);
PyAPI_FUNC(const char *) Py_GetPlatform(void);
+PyAPI_FUNC(const char *) Py_GetLib(void);
PyAPI_FUNC(const char *) Py_GetCopyright(void);
PyAPI_FUNC(const char *) Py_GetCompiler(void);
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
Index: Python-2.7.14/Lib/distutils/command/install.py
===================================================================
--- Python-2.7.14.orig/Lib/distutils/command/install.py
+++ Python-2.7.14/Lib/distutils/command/install.py
@@ -22,6 +22,8 @@ from site import USER_BASE
from site import USER_SITE
+libname = sys.lib
+
if sys.version < "2.2":
WINDOWS_SCHEME = {
'purelib': '$base',
@@ -41,8 +43,8 @@ else:
INSTALL_SCHEMES = {
'unix_prefix': {
- 'purelib': '$base/lib/python$py_version_short/site-packages',
- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
+ 'purelib': '$platbase/'+libname+'/python$py_version_short/site-packages',
+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
'headers': '$base/include/python$py_version_short/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
Index: Python-2.7.14/Lib/distutils/sysconfig.py
===================================================================
--- Python-2.7.14.orig/Lib/distutils/sysconfig.py
+++ Python-2.7.14/Lib/distutils/sysconfig.py
@@ -119,8 +119,11 @@ def get_python_lib(plat_specific=0, stan
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
- libpython = os.path.join(prefix,
- "lib", "python" + get_python_version())
+ if plat_specific or standard_lib:
+ lib = sys.lib
+ else:
+ lib = "lib"
+ libpython = os.path.join(prefix, lib, "python" + get_python_version())
if standard_lib:
return libpython
else:
Index: Python-2.7.14/Lib/pydoc.py
===================================================================
--- Python-2.7.14.orig/Lib/pydoc.py
+++ Python-2.7.14/Lib/pydoc.py
@@ -375,7 +375,7 @@ class Doc:
docmodule = docclass = docroutine = docother = docproperty = docdata = fail
def getdocloc(self, object,
- basedir=os.path.join(sys.exec_prefix, "lib",
+ basedir=os.path.join(sys.exec_prefix, "sys.lib",
"python"+sys.version[0:3])):
"""Return the location of module docs or None"""
Index: Python-2.7.14/Lib/site.py
===================================================================
--- Python-2.7.14.orig/Lib/site.py
+++ Python-2.7.14/Lib/site.py
@@ -288,13 +288,18 @@ def getsitepackages():
if sys.platform in ('os2emx', 'riscos'):
sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
- sitepackages.append(os.path.join(prefix, "lib",
+ sitepackages.append(os.path.join(prefix, sys.lib,
"python" + sys.version[:3],
"site-packages"))
- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
+ sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
+ if sys.lib != "lib":
+ sitepackages.append(os.path.join(prefix, "lib",
+ "python" + sys.version[:3],
+ "site-packages"))
+ sitepackages.append(os.path.join(prefix, "lib", "site-python"))
else:
sitepackages.append(prefix)
- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
return sitepackages
def addsitepackages(known_paths):
Index: Python-2.7.14/Lib/sysconfig.py
===================================================================
--- Python-2.7.14.orig/Lib/sysconfig.py
+++ Python-2.7.14/Lib/sysconfig.py
@@ -7,10 +7,10 @@ from os.path import pardir, realpath
_INSTALL_SCHEMES = {
'posix_prefix': {
- 'stdlib': '{base}/lib/python{py_version_short}',
- 'platstdlib': '{platbase}/lib/python{py_version_short}',
+ 'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
+ 'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
'purelib': '{base}/lib/python{py_version_short}/site-packages',
- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
'include': '{base}/include/python{py_version_short}',
'platinclude': '{platbase}/include/python{py_version_short}',
'scripts': '{base}/bin',
@@ -65,10 +65,10 @@ _INSTALL_SCHEMES = {
'data' : '{userbase}',
},
'posix_user': {
- 'stdlib': '{userbase}/lib/python{py_version_short}',
- 'platstdlib': '{userbase}/lib/python{py_version_short}',
+ 'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
+ 'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
'include': '{userbase}/include/python{py_version_short}',
'scripts': '{userbase}/bin',
'data' : '{userbase}',
Index: Python-2.7.14/Lib/test/test_dl.py
===================================================================
--- Python-2.7.14.orig/Lib/test/test_dl.py
+++ Python-2.7.14/Lib/test/test_dl.py
@@ -4,10 +4,11 @@
import unittest
from test.test_support import verbose, import_module
dl = import_module('dl', deprecated=True)
+import sys
sharedlibs = [
- ('/usr/lib/libc.so', 'getpid'),
- ('/lib/libc.so.6', 'getpid'),
+ ('/usr/'+sys.lib+'/libc.so', 'getpid'),
+ ('/'+sys.lib+'/libc.so.6', 'getpid'),
('/usr/bin/cygwin1.dll', 'getpid'),
('/usr/lib/libc.dylib', 'getpid'),
]
Index: Python-2.7.14/Lib/test/test_site.py
===================================================================
--- Python-2.7.14.orig/Lib/test/test_site.py
+++ Python-2.7.14/Lib/test/test_site.py
@@ -252,12 +252,16 @@ class HelperFunctionsTests(unittest.Test
self.assertEqual(dirs[0], wanted)
elif os.sep == '/':
# OS X, Linux, FreeBSD, etc
- self.assertEqual(len(dirs), 2)
wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
'site-packages')
- self.assertEqual(dirs[0], wanted)
+ self.assertTrue(wanted in dirs)
wanted = os.path.join('xoxo', 'lib', 'site-python')
- self.assertEqual(dirs[1], wanted)
+ self.assertTrue(wanted in dirs)
+ wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
+ 'site-packages')
+ self.assertTrue(wanted in dirs)
+ wanted = os.path.join('xoxo', sys.lib, 'site-python')
+ self.assertTrue(wanted in dirs)
else:
# other platforms
self.assertEqual(len(dirs), 2)
Index: Python-2.7.14/Lib/trace.py
===================================================================
--- Python-2.7.14.orig/Lib/trace.py
+++ Python-2.7.14/Lib/trace.py
@@ -754,10 +754,10 @@ def main(argv=None):
# should I also call expanduser? (after all, could use $HOME)
s = s.replace("$prefix",
- os.path.join(sys.prefix, "lib",
+ os.path.join(sys.prefix, sys.lib,
"python" + sys.version[:3]))
s = s.replace("$exec_prefix",
- os.path.join(sys.exec_prefix, "lib",
+ os.path.join(sys.exec_prefix, sys.lib,
"python" + sys.version[:3]))
s = os.path.normpath(s)
ignore_dirs.append(s)
Index: Python-2.7.14/Makefile.pre.in
===================================================================
--- Python-2.7.14.orig/Makefile.pre.in
+++ Python-2.7.14/Makefile.pre.in
@@ -91,6 +91,7 @@ PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAG
# Machine-dependent subdirectories
MACHDEP= @MACHDEP@
+LIB= @LIB@
# Multiarch directory (may be empty)
MULTIARCH= @MULTIARCH@
@@ -110,7 +111,7 @@ LIBDIR= @libdir@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
-SCRIPTDIR= $(prefix)/lib
+SCRIPTDIR= $(prefix)/@LIB@
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
@@ -645,6 +646,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
-DEXEC_PREFIX='"$(exec_prefix)"' \
-DVERSION='"$(VERSION)"' \
-DVPATH='"$(VPATH)"' \
+ -DLIB='"$(LIB)"' \
-o $@ $(srcdir)/Modules/getpath.c
Modules/python.o: $(srcdir)/Modules/python.c
@@ -693,7 +695,7 @@ regen-ast:
Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
Python/getplatform.o: $(srcdir)/Python/getplatform.c
- $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
+ $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
Python/importdl.o: $(srcdir)/Python/importdl.c
$(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
Index: Python-2.7.14/Modules/getpath.c
===================================================================
--- Python-2.7.14.orig/Modules/getpath.c
+++ Python-2.7.14/Modules/getpath.c
@@ -100,6 +100,13 @@
#error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined"
#endif
+#define LIB_PYTHON LIB "/python" VERSION
+
+#ifndef PYTHONPATH
+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
+ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
+#endif
+
#ifndef LANDMARK
#define LANDMARK "os.py"
#endif
@@ -108,7 +115,7 @@ static char prefix[MAXPATHLEN+1];
static char exec_prefix[MAXPATHLEN+1];
static char progpath[MAXPATHLEN+1];
static char *module_search_path = NULL;
-static char lib_python[] = "lib/python" VERSION;
+static char lib_python[] = LIB_PYTHON;
static void
reduce(char *dir)
Index: Python-2.7.14/Python/getplatform.c
===================================================================
--- Python-2.7.14.orig/Python/getplatform.c
+++ Python-2.7.14/Python/getplatform.c
@@ -10,3 +10,13 @@ Py_GetPlatform(void)
{
return PLATFORM;
}
+
+#ifndef LIB
+#define LIB "lib"
+#endif
+
+const char *
+Py_GetLib(void)
+{
+ return LIB;
+}
Index: Python-2.7.14/Python/sysmodule.c
===================================================================
--- Python-2.7.14.orig/Python/sysmodule.c
+++ Python-2.7.14/Python/sysmodule.c
@@ -1437,6 +1437,8 @@ _PySys_Init(void)
PyString_FromString(Py_GetCopyright()));
SET_SYS_FROM_STRING("platform",
PyString_FromString(Py_GetPlatform()));
+ SET_SYS_FROM_STRING("lib",
+ PyString_FromString(Py_GetLib()));
SET_SYS_FROM_STRING("executable",
PyString_FromString(Py_GetProgramFullPath()));
SET_SYS_FROM_STRING("prefix",

View File

@@ -1,19 +0,0 @@
When using make -j with the 'install' target, it's possible for altbininstall
(which normally creates BINDIR) and libainstall (which doesn't, though it
installs python-config there) to race, resulting in a failure due to
attempting to install python-config into a nonexistent BINDIR. Ensure it also
exists in the libainstall target.
Upstream-Status: Pending
--- Python-2.7.3.orig/Makefile.pre.in
+++ Python-2.7.3/Makefile.pre.in
@@ -1187,7 +1187,7 @@
LIBPC= $(LIBDIR)/pkgconfig
libainstall: @DEF_MAKE_RULE@ python-config
- @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
+ @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC) $(BINDIR); \
do \
if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \

View File

@@ -1,82 +0,0 @@
From 71447f04979b267f8866573b67a4340b2719d799 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Fri, 4 Aug 2017 14:10:43 +0800
Subject: [PATCH] setup.py: pass missing libraries to Extension for multiprocessing module
In the following commit:
...
commit e711cafab13efc9c1fe6c5cd75826401445eb585
Author: Benjamin Peterson <benjamin@python.org>
Date: Wed Jun 11 16:44:04 2008 +0000
Merged revisions 64104,64117 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
...
(see diff in setup.py)
It assigned libraries for multiprocessing module according
the host_platform, but not pass it to Extension.
In glibc, the following commit caused two definition of
sem_getvalue are different.
https://sourceware.org/git/?p=glibc.git;a=commit;h=042e1521c794a945edc43b5bfa7e69ad70420524
(see diff in nptl/sem_getvalue.c for detail)
`__new_sem_getvalue' is the latest sem_getvalue@@GLIBC_2.1
and `__old_sem_getvalue' is to compat the old version
sem_getvalue@GLIBC_2.0.
To build python for embedded Linux systems:
http://www.yoctoproject.org/docs/2.3.1/yocto-project-qs/yocto-project-qs.html
If not explicitly link to library pthread (-lpthread), it will
load glibc's sem_getvalue randomly at runtime.
Such as build python on linux x86_64 host and run the python
on linux x86_32 target. If not link library pthread, it caused
multiprocessing bounded semaphore could not work correctly.
...
>>> import multiprocessing
>>> pool_sema = multiprocessing.BoundedSemaphore(value=1)
>>> pool_sema.acquire()
True
>>> pool_sema.release()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: semaphore or lock released too many times
...
And the semaphore issue also caused multiprocessing.Queue().put() hung.
Upstream-Status: Submitted [https://github.com/python/cpython/pull/2999]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
setup.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 54054c2..9646bfc 100644
--- a/setup.py
+++ b/setup.py
@@ -1586,8 +1586,10 @@ class PyBuildExt(build_ext):
elif host_platform.startswith('netbsd'):
macros = dict()
libraries = []
-
- else: # Linux and other unices
+ elif host_platform.startswith(('linux')):
+ macros = dict()
+ libraries = ['pthread']
+ else: # Other unices
macros = dict()
libraries = ['rt']
@@ -1610,6 +1612,7 @@ class PyBuildExt(build_ext):
if sysconfig.get_config_var('WITH_THREAD'):
exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
define_macros=macros.items(),
+ libraries=libraries,
include_dirs=["Modules/_multiprocessing"]))
else:
missing.append('_multiprocessing')
--
2.7.4

View File

@@ -1,28 +0,0 @@
Upstream-Status: Inappropriate [embedded specific]
Remove the RPATH to avoid QA issue warning.
RP: Added secondary unnecessary rpath to the list 2012/8/7
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Index: Python-2.7.3/setup.py
===================================================================
--- Python-2.7.3.orig/setup.py 2012-08-07 10:41:58.560132529 +0000
+++ Python-2.7.3/setup.py 2012-08-07 11:09:47.852094515 +0000
@@ -1042,7 +1042,6 @@
exts.append(Extension('_bsddb', ['_bsddb.c'],
depends = ['bsddb.h'],
library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
include_dirs=db_incs,
libraries=dblibs))
else:
@@ -1252,7 +1251,6 @@
print "building dbm using bdb"
dbmext = Extension('dbm', ['dbmmodule.c'],
library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
include_dirs=db_incs,
define_macros=[
('HAVE_BERKDB_H', None),

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +0,0 @@
#!/bin/sh
python -mtest -W | sed -u -e '/\.\.\. ok/ s/^/PASS: /g' -e '/\.\.\. [ERROR|FAIL]/ s/^/FAIL: /g' -e '/\.\.\. skipped/ s/^/SKIP: /g' -e 's/ \.\.\. ok//g' -e 's/ \.\.\. ERROR//g' -e 's/ \.\.\. FAIL//g' -e 's/ \.\.\. skipped//g'

View File

@@ -1,35 +0,0 @@
python should search for db.h in inc_dirs and not in a hardcoded path.
If db.h is found but HASHVERSION is not 2 we avoid a warning by not
adding this module to missing variable.
Upstream-Status: Inappropriate [distribution]
Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
diff --git a/setup.py b/setup.py
index b887808..ae51607 100644
--- a/setup.py
+++ b/setup.py
@@ -1237,6 +1237,8 @@ class PyBuildExt(build_ext):
# the more recent berkeleydb's db.h file first in the include path
# when attempting to compile and it will fail.
f = "/usr/include/db.h"
+ if len(inc_dirs) != 0:
+ f = os.path.join(inc_dirs[0], "db.h")
if host_platform == 'darwin':
if is_macosx_sdk_path(f):
@@ -1257,8 +1259,10 @@ class PyBuildExt(build_ext):
libraries=libraries))
else:
exts.append(Extension('bsddb185', ['bsddbmodule.c']))
- else:
- missing.append('bsddb185')
+ # If a newer version is detected don't report an useless
+ # warning
+ #else:
+ # missing.append('bsddb185')
else:
missing.append('bsddb185')

View File

@@ -1,27 +0,0 @@
This patch skips over the 'import check' setup.py does when building
extensions. This generally won't work when cross-compiling.
Upstream-Status: Inappropriate [embedded-specific]
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Index: Python-2.7.2/setup.py
===================================================================
--- Python-2.7.2.orig/setup.py 2011-11-04 16:46:34.553796410 -0500
+++ Python-2.7.2/setup.py 2011-11-04 16:59:49.692802313 -0500
@@ -287,6 +287,15 @@
(ext.name, sys.exc_info()[1]))
self.failed.append(ext.name)
return
+
+ # If we're cross-compiling, we want to skip the import check
+ # i.e. we shouldn't be dynamically loading target shared libs
+ if os.environ.get('CROSS_COMPILE') is not None:
+ self.announce(
+ 'WARNING: skipping import 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,57 +0,0 @@
This patch removes various ways native system options can pass into the python
compilation and somehow break C modules.
Upstream-Status: Inappropriate [OE Specific]
RP 2012/04/23
Index: Python-2.7.2/setup.py
===================================================================
--- Python-2.7.2.orig/setup.py 2012-04-23 20:03:47.295582553 +0000
+++ Python-2.7.2/setup.py 2012-04-23 20:03:15.000000000 +0000
@@ -231,7 +231,13 @@
# compilers
if compiler is not None:
(ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
- args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
+ # Need to filter out -isysroot from the flags. Ideally should
+ # figure out target flags here.
+ flags = []
+ for f in cflags.split():
+ if not f.startswith("-isystem"):
+ flags.append(f)
+ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + ' '.join(flags)
self.compiler.set_executables(**args)
build_ext.build_extensions(self)
@@ -393,7 +399,6 @@
# into configure and stored in the Makefile (issue found on OS X 10.3).
for env_var, arg_name, dir_list in (
('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
- ('LDFLAGS', '-L', self.compiler.library_dirs),
('CPPFLAGS', '-I', self.compiler.include_dirs)):
env_val = sysconfig.get_config_var(env_var)
if env_val:
@@ -419,16 +424,16 @@
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'):
+# 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"))
+# 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

View File

@@ -1,37 +0,0 @@
# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
# GPLv2 or later
# Version: 20081123
# Features:
# * set proper default encoding
# * enable readline completion in the interactive interpreter
# * load command line history on startup
# * save command line history on exit
import os
def __exithandler():
try:
readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
except IOError:
pass
def __registerExitHandler():
import atexit
atexit.register( __exithandler )
def __enableReadlineSupport():
readline.set_history_length( 1000 )
readline.parse_and_bind( "tab: complete" )
try:
readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
except IOError:
pass
import sys
try:
import rlcompleter, readline
except ImportError:
pass
else:
__registerExitHandler()
__enableReadlineSupport()

View File

@@ -1,34 +0,0 @@
The compiled .pyc files contain time stamp corresponding to the compile time.
This prevents binary reproducibility. This patch allows to achieve binary
reproducibility by overriding the build time stamp by the value
exported via SOURCE_DATE_EPOCH.
Patch by Bernhard M. Wiedemann
Upstream-Status: Backport
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Fri Feb 24 17:08:25 UTC 2017 - bwiedemann@suse.com
- Add reproducible.patch to allow reproducible builds of various
python packages like python-amqp
Upstream: https://github.com/python/cpython/pull/296
@@ -0,0 +1,15 @@
Index: Python-2.7.13/Lib/py_compile.py
===================================================================
--- Python-2.7.13.orig/Lib/py_compile.py
+++ Python-2.7.13/Lib/py_compile.py
@@ -108,6 +108,10 @@ def compile(file, cfile=None, dfile=None
timestamp = long(os.fstat(f.fileno()).st_mtime)
except AttributeError:
timestamp = long(os.stat(file).st_mtime)
+ sde = os.environ.get('SOURCE_DATE_EPOCH')
+ if sde and timestamp > int(sde):
+ timestamp = int(sde)
+ os.utime(file, (timestamp, timestamp))
codestring = f.read()
try:
codeobject = __builtin__.compile(codestring, dfile or file,'exec')

View File

@@ -1,21 +0,0 @@
Python tries to use ncursesw from the host,
if it is not found causes an error on configure,
we should use ncursesw from sysroot instead
Upstream-Status: Pending
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
Index: Python-2.7.9/configure.ac
===================================================================
--- Python-2.7.9.orig/configure.ac
+++ Python-2.7.9/configure.ac
@@ -4311,7 +4311,7 @@ fi
# first curses configure check
ac_save_cppflags="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+CPPFLAGS="$CPPFLAGS -I=/usr/include/ncursesw"
AC_CHECK_HEADERS(curses.h ncurses.h)

View File

@@ -1,260 +0,0 @@
require python.inc
DEPENDS = "libffi bzip2 gdbm openssl \
readline sqlite3 zlib virtual/crypt"
DISTRO_SRC_URI ?= "file://sitecustomize.py"
DISTRO_SRC_URI_linuxstdbase = ""
SRC_URI += " \
file://01-use-proper-tools-for-cross-build.patch \
file://03-fix-tkinter-detection.patch \
file://06-avoid_usr_lib_termcap_path_in_linking.patch \
${DISTRO_SRC_URI} \
file://multilib.patch \
file://cgi_py.patch \
file://setup_py_skip_cross_import_check.patch \
file://add-md5module-support.patch \
file://host_include_contamination.patch \
file://fix_for_using_different_libdir.patch \
file://setuptweaks.patch \
file://check-if-target-is-64b-not-host.patch \
file://search_db_h_in_inc_dirs_and_avoid_warning.patch \
${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
file://avoid_warning_for_sunos_specific_module.patch \
file://python-2.7.3-remove-bsdb-rpath.patch \
file://run-ptest \
file://parallel-makeinst-create-bindir.patch \
file://use_sysroot_ncurses_instead_of_host.patch \
file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
file://pass-missing-libraries-to-Extension-for-mul.patch \
file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \
file://float-endian.patch \
file://0001-python2-use-cc_basename-to-replace-CC-for-checking-c.patch \
"
S = "${WORKDIR}/Python-${PV}"
inherit autotools multilib_header python-dir pythonnative ptest
EXTRA_OECONF += "--with-system-ffi"
CACHED_CONFIGUREVARS = "ac_cv_file__dev_ptmx=yes \
ac_cv_file__dev_ptc=no \
ac_cv_working_tzset=yes"
PACKAGECONFIG ??= "bdb"
PACKAGECONFIG[bdb] = ",,db"
PACKAGECONFIG[tk] = ",,tk"
# pgen isn't needed in the current build, but use the binary from python-native just in case.
EXTRA_OEMAKE = "PGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
STAGING_LIBDIR=${STAGING_LIBDIR} \
STAGING_INCDIR=${STAGING_INCDIR} \
STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
"
do_configure_append() {
rm -f ${S}/Makefile.orig
autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi
}
do_compile() {
# regenerate platform specific files, because they depend on system headers
cd ${S}/Lib/plat-linux2
include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \
${S}/Tools/scripts/h2py.py -i '(u_long)' \
${STAGING_INCDIR}/dlfcn.h \
${STAGING_INCDIR}/linux/cdrom.h \
${STAGING_INCDIR}/netinet/in.h \
${STAGING_INCDIR}/sys/types.h
sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
cd -
# remove any bogus LD_LIBRARY_PATH
sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
if [ ! -f Makefile.orig ]; then
install -m 0644 Makefile Makefile.orig
fi
sed -i -e 's#^LDFLAGS=.*#LDFLAGS=${LDFLAGS} -L. -L${STAGING_LIBDIR}#g' \
-e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
-e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
-e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
-e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
-e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
-e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
Makefile
# save copy of it now, because if we do it in do_install and
# then call do_install twice we get Makefile.orig == Makefile.sysroot
install -m 0644 Makefile Makefile.sysroot
export CROSS_COMPILE="${TARGET_PREFIX}"
export PYTHONBUILDDIR="${B}"
oe_runmake OPT="${CFLAGS}"
}
do_install() {
# make install needs the original Makefile, or otherwise the inclues would
# go to ${D}${STAGING...}/...
install -m 0644 Makefile.orig Makefile
export CROSS_COMPILE="${TARGET_PREFIX}"
export PYTHONBUILDDIR="${B}"
# After swizzling the makefile, we need to run the build again.
# install can race with the build so we have to run this first, then install
oe_runmake DESTDIR=${D} LIBDIR=${libdir}
oe_runmake DESTDIR=${D} LIBDIR=${libdir} install
install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
if [ -e ${WORKDIR}/sitecustomize.py ]; then
install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
fi
oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'bdb', d)}" ]; then
rm -rf ${D}/${libdir}/python${PYTHON_MAJMIN}/bsddb
fi
# Python 3.x version of 2to3 is now the default
mv ${D}/${bindir}/2to3 ${D}/${bindir}/2to3-${PYTHON_MAJMIN}
}
do_install_append_class-nativesdk () {
create_wrapper ${D}${bindir}/python2.7 PYTHONHOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
}
SSTATE_SCAN_FILES += "Makefile"
PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
py_package_preprocess () {
# copy back the old Makefile to fix target package
install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
# Remove references to buildmachine paths in target Makefile and _sysconfigdata
sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
-e 's|${DEBUG_PREFIX_MAP}||g' \
-e 's:${HOSTTOOLS_DIR}/::g' \
-e 's:${RECIPE_SYSROOT_NATIVE}::g' \
-e 's:${RECIPE_SYSROOT}::g' \
-e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \
${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py
(cd ${PKGD}; python -m py_compile ./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py)
}
PACKAGES_remove = "${PN}"
# manual dependency additions
RPROVIDES_${PN}-modules = "${PN}"
RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules"
RRECOMMENDS_${PN}-crypt = "openssl"
# package libpython2
PACKAGES =+ "lib${BPN}2"
FILES_lib${BPN}2 = "${libdir}/libpython*.so.*"
# catch all the rest (unsorted)
PACKAGES += "${PN}-misc"
FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
RDEPENDS_${PN}-modules += "${PN}-misc"
# ptest
RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip tzdata-europe coreutils sed"
RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}"
# catch manpage
PACKAGES += "${PN}-man"
FILES_${PN}-man = "${datadir}/man"
# Nasty but if bdb isn't enabled the package won't be generated
RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}"
RDEPENDS_${PN}-dev = ""
BBCLASSEXTEND = "nativesdk"
# We want bytecode precompiled .py files (.pyc's) by default
# but the user may set it on their own conf
INCLUDE_PYCS ?= "1"
python(){
import collections, json
filename = os.path.join(d.getVar('THISDIR'), 'python', 'python2-manifest.json')
# This python changes the datastore based on the contents of a file, so mark
# that dependency.
bb.parse.mark_dependency(d, filename)
with open(filename) as manifest_file:
manifest_str = manifest_file.read()
json_start = manifest_str.find('# EOC') + 6
manifest_file.seek(json_start)
manifest_str = manifest_file.read()
python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
include_pycs = d.getVar('INCLUDE_PYCS')
packages = d.getVar('PACKAGES').split()
pn = d.getVar('PN')
newpackages=[]
for key in python_manifest:
pypackage= pn + '-' + key
if pypackage not in packages:
# We need to prepend, otherwise python-misc gets everything
# so we use a new variable
newpackages.append(pypackage)
# "Build" python's manifest FILES, RDEPENDS and SUMMARY
d.setVar('FILES_' + pypackage, '')
for value in python_manifest[key]['files']:
d.appendVar('FILES_' + pypackage, ' ' + value)
if include_pycs == '1':
if value.endswith('.py'):
d.appendVar('FILES_' + pypackage, ' ' + value + '?')
for value in python_manifest[key]['rdepends']:
# Make it work with or without $PN
if '${PN}' in value:
value=value.split('-')[1]
d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
# Prepending so to avoid python-misc getting everything
packages = newpackages + packages
d.setVar('PACKAGES', ' '.join(packages))
d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
}
# Files needed to create a new manifest
SRC_URI += "file://create_manifest2.py file://get_module_deps2.py file://python2-manifest.json"
do_create_manifest() {
# This task should be run with every new release of Python.
# We must ensure that PACKAGECONFIG enables everything when creating
# a new manifest, this is to base our new manifest on a complete
# native python build, containing all dependencies, otherwise the task
# wont be able to find the required files.
# e.g. BerkeleyDB is an optional build dependency so it may or may not
# be present, we must ensure it is.
cd ${WORKDIR}
# This needs to be executed by python-native and NOT by HOST's python
nativepython create_manifest2.py
cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json
}
# bitbake python -c create_manifest
addtask do_create_manifest
# Make sure we have native python ready when we create a new manifest
do_create_manifest[depends] += "python:do_prepare_recipe_sysroot"
do_create_manifest[depends] += "python:do_patch"