[OE-core] [PATCH][morty] python3: do not hardcode "lib" into site-packages search path
From: Alexander Kanavin This was not working in multilib or x32 setups and amazingly, was not noticed until now. The actual modification is in Lib/site.py, the rest is just devtool moving things around in the patch. Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- .../python/python3/python-3.3-multilib.patch | 290 - 1 file changed, 165 insertions(+), 125 deletions(-) diff --git a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch index 860190340e..08c4403cbf 100644 --- a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch +++ b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch @@ -1,16 +1,34 @@ -Upstream-Status: Pending - -get the sys.lib from python itself and do not use hardcoded value of 'lib' +From 51fe6f22d0ba113674fb358bd11d75fe659bd26e Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 14 May 2013 15:00:26 -0700 +Subject: [PATCH 01/13] get the sys.lib from python itself and do not use + hardcoded value of 'lib' 02/2015 Rebased for 3.4.2 +Upstream-Status: Pending Signed-off-by: Khem Raj Signed-off-by: Alejandro Hernandez -Index: Python-3.5.2/Include/pythonrun.h -=== Python-3.5.2.orig/Include/pythonrun.h -+++ Python-3.5.2/Include/pythonrun.h +--- + Include/pythonrun.h | 3 +++ + Lib/distutils/command/install.py | 4 +++- + Lib/pydoc.py | 2 +- + Lib/site.py | 4 ++-- + Lib/sysconfig.py | 18 +- + Lib/trace.py | 4 ++-- + Makefile.pre.in | 7 +-- + Modules/getpath.c| 10 +- + Python/getplatform.c | 20 + Python/sysmodule.c | 4 + configure.ac | 35 +++ + setup.py | 9 - + 12 files changed, 97 insertions(+), 23 deletions(-) + +diff --git a/Include/pythonrun.h b/Include/pythonrun.h +index 9c2e813..2f79cb6 100644 +--- a/Include/pythonrun.h b/Include/pythonrun.h @@ -23,6 +23,9 @@ typedef struct { } PyCompilerFlags; #endif @@ -21,10 +39,10 @@ Index: Python-3.5.2/Include/pythonrun.h #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); -Index: Python-3.5.2/Lib/distutils/command/install.py -=== Python-3.5.2.orig/Lib/distutils/command/install.py -+++ Python-3.5.2/Lib/distutils/command/install.py +diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py +index 67db007..b46b45b 100644 +--- a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py @@ -19,6 +19,8 @@ from site import USER_BASE from site import USER_SITE HAS_USER_SITE = True @@ -43,10 +61,10 @@ Index: Python-3.5.2/Lib/distutils/command/install.py 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', 'scripts': '$base/bin', 'data' : '$base', -Index: Python-3.5.2/Lib/pydoc.py -=== Python-3.5.2.orig/Lib/pydoc.py -+++ Python-3.5.2/Lib/pydoc.py +diff --git a/Lib/pydoc.py b/Lib/pydoc.py +index 3ca08c9..6528730 100755 +--- a/Lib/pydoc.py b/Lib/pydoc.py @@ -384,7 +384,7 @@ class Doc: docmodule = docclass = docroutine = docother = docproperty = docdata = fail @@ -56,10 +74,75 @@ Index: Python-3.5.2/Lib/pydoc.py "python%d.%d" % sys.version_info[:2])): """Return the location of module docs or None""" -Index: Python-3.5.2/Lib/trace.py -=== Python-3.5.2.orig/Lib/trace.py -+++ Python-3.5.2/Lib/trace.py +diff --git a/Lib/site.py b/Lib/site.py +index 3f78ef5..511931e 100644 +--- a/Lib/site.py b/Lib/site.py +@@ -303,12 +303,12 @@ def getsitepackages(prefixes=None): + seen.add(prefix) + + if os.sep == '/': +-sitepackages.append(os.path.join(prefix, "lib", ++sitepackages.append(os.path.join(prefix, sys.lib, + "python" + sys.version[:3], + "site-packages")) + else: + sitepackages.append(prefix) +-sitepackages.append(os.path.join(prefix, "lib", "site-packages")) ++sitepackages.append(os.path.join(prefix, sys.lib, "site-packages")) + if sys.platform == "darwin": + # for framework builds *only* we add the standard Apple + # locations. +diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py +index 9c34be0..3d1181a 100644 +--- a/Lib/sysconfig.py b/Lib/sysconfig
Re: [OE-core] [PATCH][morty] python3: do not hardcode "lib" into site-packages search path
in akuster/morty-next On 11/22/2017 11:46 AM, Aníbal Limón wrote: > From: Alexander Kanavin > > This was not working in multilib or x32 setups and amazingly, was not > noticed until now. > > The actual modification is in Lib/site.py, the rest is just devtool moving > things around in the patch. > > Signed-off-by: Alexander Kanavin > Signed-off-by: Richard Purdie > --- > .../python/python3/python-3.3-multilib.patch | 290 > - > 1 file changed, 165 insertions(+), 125 deletions(-) > > diff --git a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch > b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch > index 860190340e..08c4403cbf 100644 > --- a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch > +++ b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch > @@ -1,16 +1,34 @@ > -Upstream-Status: Pending > - > -get the sys.lib from python itself and do not use hardcoded value of 'lib' > +From 51fe6f22d0ba113674fb358bd11d75fe659bd26e Mon Sep 17 00:00:00 2001 > +From: Khem Raj > +Date: Tue, 14 May 2013 15:00:26 -0700 > +Subject: [PATCH 01/13] get the sys.lib from python itself and do not use > + hardcoded value of 'lib' > > 02/2015 Rebased for 3.4.2 > > +Upstream-Status: Pending > Signed-off-by: Khem Raj > Signed-off-by: Alejandro Hernandez > > -Index: Python-3.5.2/Include/pythonrun.h > -=== > Python-3.5.2.orig/Include/pythonrun.h > -+++ Python-3.5.2/Include/pythonrun.h > +--- > + Include/pythonrun.h | 3 +++ > + Lib/distutils/command/install.py | 4 +++- > + Lib/pydoc.py | 2 +- > + Lib/site.py | 4 ++-- > + Lib/sysconfig.py | 18 +- > + Lib/trace.py | 4 ++-- > + Makefile.pre.in | 7 +-- > + Modules/getpath.c| 10 +- > + Python/getplatform.c | 20 > + Python/sysmodule.c | 4 > + configure.ac | 35 +++ > + setup.py | 9 - > + 12 files changed, 97 insertions(+), 23 deletions(-) > + > +diff --git a/Include/pythonrun.h b/Include/pythonrun.h > +index 9c2e813..2f79cb6 100644 > +--- a/Include/pythonrun.h > b/Include/pythonrun.h > @@ -23,6 +23,9 @@ typedef struct { > } PyCompilerFlags; > #endif > @@ -21,10 +39,10 @@ Index: Python-3.5.2/Include/pythonrun.h > #ifndef Py_LIMITED_API > PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); > PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); > -Index: Python-3.5.2/Lib/distutils/command/install.py > -=== > Python-3.5.2.orig/Lib/distutils/command/install.py > -+++ Python-3.5.2/Lib/distutils/command/install.py > +diff --git a/Lib/distutils/command/install.py > b/Lib/distutils/command/install.py > +index 67db007..b46b45b 100644 > +--- a/Lib/distutils/command/install.py > b/Lib/distutils/command/install.py > @@ -19,6 +19,8 @@ from site import USER_BASE > from site import USER_SITE > HAS_USER_SITE = True > @@ -43,10 +61,10 @@ Index: Python-3.5.2/Lib/distutils/command/install.py > 'headers': > '$base/include/python$py_version_short$abiflags/$dist_name', > 'scripts': '$base/bin', > 'data' : '$base', > -Index: Python-3.5.2/Lib/pydoc.py > -=== > Python-3.5.2.orig/Lib/pydoc.py > -+++ Python-3.5.2/Lib/pydoc.py > +diff --git a/Lib/pydoc.py b/Lib/pydoc.py > +index 3ca08c9..6528730 100755 > +--- a/Lib/pydoc.py > b/Lib/pydoc.py > @@ -384,7 +384,7 @@ class Doc: > docmodule = docclass = docroutine = docother = docproperty = docdata = > fail > > @@ -56,10 +74,75 @@ Index: Python-3.5.2/Lib/pydoc.py > "python%d.%d" % > sys.version_info[:2])): > """Return the location of module docs or None""" > > -Index: Python-3.5.2/Lib/trace.py > -=== > Python-3.5.2.orig/Lib/trace.py > -+++ Python-3.5.2/Lib/trace.py > +diff --git a/Lib/site.py b/Lib/site.py > +index 3f78ef5..511931e 100644 > +--- a/Lib/site.py > b/Lib/site.py > +@@ -303,12 +303,12 @@ def getsitepackages(prefixes=None): > + seen.add(prefix) > + > + if os.sep == '/': > +-sitepackages.append(os.path.join(prefix, "lib", > ++sitepackages.append(os.path.join(prefix, sys.lib, > + "python" + sys.version[:3], > + "site-packages")) > + else: > + sitepackages.append(prefix) > +-sitepackages.append(os.path.join(prefix, "lib", > "site-packages")) > ++sitepackages.append(os