Skip to contentSkip to conversation

python3: correct the multilib support patch

PATCH In review Li Zhou 4 participants 4 messages Jun 29, 2016

lore
Share & tools
lore

Li Zhou

author
#0 lore raw

PATCH 1/1 python3: correct the multilib support patch

When python3 rebased its multilib patch, the hard coded "lib" path isn't really changed because of the rebasing's error, and cause phthon3's failure when running on 64bit platforms as below:
Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Here correct the rebasing error and solve this issue.

---
 ...ython3-correct-the-multilib-support-patch.patch | 47 ++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.5.1.bb      |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/0001-python3-correct-the-multilib-support-patch.patch
meta/recipes-devtools/python/python3/0001-python3-correct-the-multilib-support-patch.patch new file +47 -0
new file mode 100644
index 0000000..0443fb4
@@ -0,0 +1,47 @@
+From ea237efcfa72012f044c7b3091c9c9b038141df8 Mon Sep 17 00:00:00 2001
+From: Li Zhou <[email protected]>
+Date: Wed, 29 Jun 2016 10:45:01 +0800
+Subject: [PATCH] python3: correct the multilib support patch
+
+When python3 rebased its multilib patch, the hard coded "lib" path
+isn't really changed because of the rebasing's error, and cause
+phthon3's failure when running on 64bit platforms as below:
+Could not find platform independent libraries <prefix>
+Could not find platform dependent libraries <exec_prefix>
+Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
+Fatal Python error: Py_Initialize: Unable to get the locale encoding
+ImportError: No module named 'encodings'
+
+Here correct the rebasing error and solve this issue.
+
+Upstream-Status: Pending
+
+Signed-off-by: Li Zhou <[email protected]>
+---
+ Modules/getpath.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/Modules/getpath.c b/Modules/getpath.c
+index 034d91a..5deb33d 100644
+--- a/Modules/getpath.c
++++ b/Modules/getpath.c
+@@ -132,7 +132,6 @@ static wchar_t prefix[MAXPATHLEN+1];
+ static wchar_t exec_prefix[MAXPATHLEN+1];
+ static wchar_t progpath[MAXPATHLEN+1];
+ static wchar_t *module_search_path = NULL;
+-static wchar_t *lib_python = L"" LIB_PYTHON;
+ 
+ /* Get file status. Encode the path to the locale encoding. */
+ 
+@@ -514,7 +513,7 @@ calculate_path(void)
+     _pythonpath = Py_DecodeLocale(PYTHONPATH, NULL);
+     _prefix = Py_DecodeLocale(PREFIX, NULL);
+     _exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL);
+-    lib_python = Py_DecodeLocale("lib/python" VERSION, NULL);
++    lib_python = Py_DecodeLocale(LIB_PYTHON, NULL);
+ 
+     if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
+         Py_FatalError(
+-- 
+2.9.0
+
meta/recipes-devtools/python/python3_3.5.1.bb +1 -0
index 2fbb3cb..1e6626f 100644
@@ -38,6 +38,7 @@ SRC_URI += "\
             file://setup.py-find-libraries-in-staging-dirs.patch \
             file://use_packed_importlib.patch \
             file://configure.ac-fix-LIBPL.patch \
+            file://0001-python3-correct-the-multilib-support-patch.patch \
            "
 SRC_URI[md5sum] = "e9ea6f2623fffcdd871b7b19113fde80"
 SRC_URI[sha256sum] = "c6d57c0c366d9060ab6c0cdf889ebf3d92711d466cc0119c441dbf2746f725c9"
Signature · 1 line
2.9.0
#1 lore raw
Quoted 11 lines · Li Zhou

When python3 rebased its multilib patch, the hard coded "lib" path isn't really changed because of the rebasing's error, and cause phthon3's failure when running on 64bit platforms as below:
Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Here correct the rebasing error and solve this issue.

Quoted 8 lines
---
 ...ython3-correct-the-multilib-support-patch.patch | 47
++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.5.1.bb      |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/0001-python3

-correct-the-multilib-support-patch.patch

Don't we want to correct the "bad" patch rather than adding an additional patch? Or did I misunderstand the problem?

Also, are there some automated tests we should be adding to catch this kind of problem? I'm a little worried none of our testing caught this.

Cheers,

Richard

#2 lore raw

On Wed, 2016-06-29 at 07:33 +0100, Richard Purdie wrote:

On Wed, 2016-06-29 at 11:12 +0800, Li Zhou wrote:

When python3 rebased its multilib patch, the hard coded "lib" path isn't really changed because of the rebasing's error, and cause phthon3's failure when running on 64bit platforms as below:
Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Here correct the rebasing error and solve this issue.

---
 ...ython3-correct-the-multilib-support-patch.patch | 47
++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.5.1.bb      |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/0001-python3

-correct-the-multilib-support-patch.patch

Don't we want to correct the "bad" patch rather than adding an additional patch? Or did I misunderstand the problem?

Also, are there some automated tests we should be adding to catch this kind of problem? I'm a little worried none of our testing caught this.

Cheers,

Richard

I would agree that since the original patch has not been accepted upstream, it would make the most sense to just regenerate it.

In addition, there are a couple of other places in getpath.c that have a hard coded "lib/". Have you verified those are correct as is? (I.e., ~line 706 'L:lib/pyhton00.zip"' and ~line 718 'L"lib/lib-dynload"'. Seems like the second case should use code similar other palces lib-dynload is used in the file that uses lib_python to build the path.)

-Bill

#3 lore raw
Quoted 33 lines · William C
Quoted 31 lines · Richard Purdie
Quoted 12 lines · Li Zhou

When python3 rebased its multilib patch, the hard coded "lib" path isn't really changed because of the rebasing's error, and cause phthon3's failure when running on 64bit platforms as below:
Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Here correct the rebasing error and solve this issue.

Quoted 8 lines
---
 ...ython3-correct-the-multilib-support-patch.patch | 47
++++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.5.1.bb      |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/0001-python3

-correct-the-multilib-support-patch.patch

Don't we want to correct the "bad" patch rather than adding an additional patch? Or did I misunderstand the problem?

Also, are there some automated tests we should be adding to catch this kind of problem? I'm a little worried none of our testing caught this.

Quoted 6 lines
Quoted 3 lines

Cheers,

Richard

I would agree that since the original patch has not been accepted

upstream, it would make the most sense to just regenerate it.

Quoted 2 lines

In addition, there are a couple of other places in getpath.c that have a

hard coded "lib/". Have you verified those are correct as is? (I.e., ~line 706 'L:lib/pyhton00.zip"' and ~line 718 'L"lib/lib-dynload"'. Seems like the second case should use code similar other palces lib-dynload is used in the file that uses lib_python to build the path.)

Quoted 2 lines

-Bill

Fedora and others have similar patches. Have people checked them out?

Quoted 7 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core