[oe-commits] Alejandro Hernandez : python3-native: Fix pip install issue due to unclean build directory

git at git.openembedded.org git at git.openembedded.org
Tue Apr 21 11:48:21 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 66844808b49dcb9ec093ed5857da967500b9cd59
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=66844808b49dcb9ec093ed5857da967500b9cd59

Author: Alejandro Hernandez <alejandro.hernandez at linux.intel.com>
Date:   Thu Apr 16 09:45:29 2015 +0000

python3-native: Fix pip install issue due to unclean build directory

When installing python3-native sometimes pips default build
directory (which is on the host and is user dependant) is left unclean,
due to this, when python3-core is being installed it tries to use
the same directory producing an error, this explicitly removes
what the previous installation might have left behind, fixing the issue.

Signed-off-by: Alejandro Hernandez <alejandro.hernandez at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 .../python/python3-native_3.4.2.bb                 |  1 +
 .../python3/pip_build_directory_unclean.patch      | 28 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/meta/recipes-devtools/python/python3-native_3.4.2.bb b/meta/recipes-devtools/python/python3-native_3.4.2.bb
index d98a278..37399be 100644
--- a/meta/recipes-devtools/python/python3-native_3.4.2.bb
+++ b/meta/recipes-devtools/python/python3-native_3.4.2.bb
@@ -26,6 +26,7 @@ file://makerace.patch \
 ${DISTRO_SRC_URI} \
 file://sysconfig.py-add-_PYTHON_PROJECT_SRC.patch \
 file://setup.py-check-cross_compiling-when-get-FLAGS.patch \
+file://pip_build_directory_unclean.patch \
 "
 SRC_URI[md5sum] = "36fc7327c02c6f12fa24fc9ba78039e3"
 SRC_URI[sha256sum] = "1c6d9682d145c056537e477bbfa060ce727f9edd38df1827e0f970dcf04b2def"
diff --git a/meta/recipes-devtools/python/python3/pip_build_directory_unclean.patch b/meta/recipes-devtools/python/python3/pip_build_directory_unclean.patch
new file mode 100644
index 0000000..c0c4617
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/pip_build_directory_unclean.patch
@@ -0,0 +1,28 @@
+Index: Python-3.4.2/Lib/ensurepip/__init__.py
+===================================================================
+--- Python-3.4.2.orig/Lib/ensurepip/__init__.py
++++ Python-3.4.2/Lib/ensurepip/__init__.py
+@@ -3,6 +3,7 @@ import os.path
+ import pkgutil
+ import sys
+ import tempfile
++import pwd
+ 
+ 
+ __all__ = ["version", "bootstrap"]
+@@ -36,6 +37,15 @@ def _run_pip(args, additional_paths=None
+     if additional_paths is not None:
+         sys.path = additional_paths + sys.path
+ 
++    # Explicitly make sure pip build directory was left clean
++    user = pwd.getpwuid(os.getuid())[0]
++    if os.path.exists("/tmp/pip_build_" + user + "/pip-delete-this-directory.txt"):
++        os.remove("/tmp/pip_build_" + user + "/pip-delete-this-directory.txt")
++        try:
++            os.rmdir("/tmp/pip_build_" + user + "/")
++        except OSError:
++            print("Error: Pip build directory (%s) was left unclean, make sure it is clean before continuing\n" % ("/tmp/pip_build_" + user + "/"))
++
+     # Install the bundled software
+     import pip
+     pip.main(args)



More information about the Openembedded-commits mailing list