From 540a223fc0fb6b07dab3316de6236924bd97613c Mon Sep 17 00:00:00 2001 From: Dominic Sacré Date: Tue, 28 Jul 2015 16:58:35 +0200 Subject: python3: detect libraries in STAGING_LIBDIR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch setup.py so that the detect_modules() function looks for required libraries and headers in STAGING_LIBDIR / STAGING_INCDIR. Without this patch, several extension modules are not built, even though their dependencies are present in the compiler's search paths. The result is the following warning, and ultimately incomplete packages: | The necessary bits to build these optional modules were not found: | _bz2 _curses_panel _dbm | _gdbm _lzma _sqlite3 | nis readline zlib | To find the necessary bits, look in setup.py in detect_modules() for the module's name. With the Python 3.3 version of the recipe, at least some of these modules were built, because STAGING_LIBDIR happened to be in the search path by coincidence. Due to changes to distutils in Python 3.4, this is no longer the case. A previous patch that only affects the search paths for SSL is dropped, as this one is a more complete fix for [YOCTO #7768]. Part of the fix for [YOCTO #8048]. Signed-off-by: Dominic Sacré Signed-off-by: Richard Purdie --- .../python/python3/fix_ssl_include_dir.patch | 41 ---------------------- .../setup.py-find-libraries-in-staging-dirs.patch | 30 ++++++++++++++++ meta/recipes-devtools/python/python3_3.4.3.bb | 2 +- 3 files changed, 31 insertions(+), 42 deletions(-) delete mode 100644 meta/recipes-devtools/python/python3/fix_ssl_include_dir.patch create mode 100644 meta/recipes-devtools/python/python3/setup.py-find-libraries-in-staging-dirs.patch diff --git a/meta/recipes-devtools/python/python3/fix_ssl_include_dir.patch b/meta/recipes-devtools/python/python3/fix_ssl_include_dir.patch deleted file mode 100644 index 9972829c78..0000000000 --- a/meta/recipes-devtools/python/python3/fix_ssl_include_dir.patch +++ /dev/null @@ -1,41 +0,0 @@ -Upstream-Status: Inappropriate [Embedded Specific] - -Python 3 fails to compile the ssl module, later, when requesting to install packages that should include such modules -no error is shown; but a running python shell trying to import the ssl library results in an import error, -since it was never installed. - -This looks for the modules in the correct directories so they are corretcly compiled and installed along with python3. - -ImportError: No module named _ssl - -Signed-Off-By: Alejandro Hernandez - -Index: Python-3.4.3/setup.py -=================================================================== ---- Python-3.4.3.orig/setup.py -+++ Python-3.4.3/setup.py -@@ -726,10 +726,9 @@ class PyBuildExt(build_ext): - exts.append( Extension('_socket', ['socketmodule.c'], - depends = ['socketmodule.h']) ) - # Detect SSL support for the socket module (via _ssl) -- search_for_ssl_incs_in = [ -- '/usr/local/ssl/include', -- '/usr/contrib/ssl/include/' -- ] -+ search_for_ssl_incs_in = [] -+ for dir in [os.getenv("STAGING_INCDIR")]: -+ search_for_ssl_incs_in.append(dir) - ssl_incs = find_file('openssl/ssl.h', inc_dirs, - search_for_ssl_incs_in - ) -@@ -739,9 +738,7 @@ class PyBuildExt(build_ext): - if krb5_h: - ssl_incs += krb5_h - ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, -- ['/usr/local/ssl/lib', -- '/usr/contrib/ssl/lib/' -- ] ) -+ [os.getenv("STAGING_LIBDIR")]) - - if (ssl_incs is not None and - ssl_libs is not None): diff --git a/meta/recipes-devtools/python/python3/setup.py-find-libraries-in-staging-dirs.patch b/meta/recipes-devtools/python/python3/setup.py-find-libraries-in-staging-dirs.patch new file mode 100644 index 0000000000..f26bd38b02 --- /dev/null +++ b/meta/recipes-devtools/python/python3/setup.py-find-libraries-in-staging-dirs.patch @@ -0,0 +1,30 @@ +Patch setup.py so that the detect_modules() function looks for required +libraries and headers in STAGING_LIBDIR / STAGING_INCDIR. + +Without this patch, several extension modules are not built, even though +their dependencies are present in the compiler's search paths. +The result is the following warning, and ultimately incomplete packages: + +| The necessary bits to build these optional modules were not found: +| _bz2 _curses_panel _dbm +| _gdbm _lzma _sqlite3 +| nis readline zlib +| To find the necessary bits, look in setup.py in detect_modules() for the module's name. + +Upstream-Status: Inappropriate [Cross compile specific] + +Signed-off-by: Dominic Sacré + +Index: Python-3.4.3/setup.py +=================================================================== +--- Python-3.4.3.orig/setup.py ++++ Python-3.4.3/setup.py +@@ -521,6 +521,8 @@ class PyBuildExt(build_ext): + else: + lib_dirs = self.compiler.library_dirs[:] + inc_dirs = self.compiler.include_dirs[:] ++ lib_dirs.append(os.environ.get('STAGING_LIBDIR')) ++ inc_dirs.append(os.environ.get('STAGING_INCDIR')) + exts = [] + missing = [] + diff --git a/meta/recipes-devtools/python/python3_3.4.3.bb b/meta/recipes-devtools/python/python3_3.4.3.bb index dce778a593..e2d9f796f1 100644 --- a/meta/recipes-devtools/python/python3_3.4.3.bb +++ b/meta/recipes-devtools/python/python3_3.4.3.bb @@ -36,7 +36,7 @@ SRC_URI += "\ file://python3-setup.py-no-host-headers-libs.patch \ file://sysconfig.py-add-_PYTHON_PROJECT_SRC.patch \ file://setup.py-check-cross_compiling-when-get-FLAGS.patch \ - file://fix_ssl_include_dir.patch \ + file://setup.py-find-libraries-in-staging-dirs.patch \ " SRC_URI[md5sum] = "7d092d1bba6e17f0d9bd21b49e441dd5" SRC_URI[sha256sum] = "b5b3963533768d5fc325a4d7a6bd6f666726002d696f1d399ec06b043ea996b8" -- cgit 1.2.3-korg