Browse code

Install things in setup_develop with pip -e

We have some complex logic in here to try to do the right things with
the requirements before doing the install of the package which still
winds up being wrong in some cases. Since having written this code,
we've learned that the logic we're trying to achieve is actually what
pip install -e does. So just use that. We have to follow up with a chown
of the resulting egg-info directory, because the sudo command will cause
it to be written by root, which prevents subsequent commands from
operating without privilege in the directory.

(cherry picked from commit 408a4a7d1c24322b35f9a8617c7c62adeeee0dbe)

Conflicts:
functions

Closes-Bug: #1266094
Change-Id: Iffd068c94ef84475ebb30758bcf612075d225bea

Monty Taylor authored on 2013/08/03 04:43:47
Showing 1 changed files
... ...
@@ -1049,9 +1049,10 @@ function service_check() {
1049 1049
     fi
1050 1050
 }
1051 1051
 
1052
-# ``pip install`` the dependencies of the package before ``setup.py develop``
1053
-# so pip and not distutils processes the dependency chain
1054
-# Uses globals ``TRACK_DEPENDES``, ``*_proxy`
1052
+
1053
+# ``pip install -e`` the package, which processes the dependencies
1054
+# using pip before running `setup.py develop`
1055
+# Uses globals ``STACK_USER``, ``TRACK_DEPENDES``, ``*_proxy`
1055 1056
 # setup_develop directory
1056 1057
 function setup_develop() {
1057 1058
     if [[ $TRACK_DEPENDS = True ]]; then
... ...
@@ -1059,18 +1060,13 @@ function setup_develop() {
1059 1059
     else
1060 1060
         SUDO_CMD="sudo"
1061 1061
     fi
1062
-    (cd $1; \
1063
-        python setup.py egg_info; \
1064
-        raw_links=$(awk '/^.+/ {print "-f " $1}' *.egg-info/dependency_links.txt); \
1065
-        depend_links=$(echo $raw_links | xargs); \
1066
-        require_file=$([ ! -r *-info/requires.txt ] || echo "-r *-info/requires.txt"); \
1067
-        pip_install $require_file $depend_links; \
1068
-        $SUDO_CMD \
1069
-            HTTP_PROXY=$http_proxy \
1070
-            HTTPS_PROXY=$https_proxy \
1071
-            NO_PROXY=$no_proxy \
1072
-            python setup.py develop \
1073
-    )
1062
+    $SUDO_CMD \
1063
+        HTTP_PROXY=$http_proxy \
1064
+        HTTPS_PROXY=$https_proxy \
1065
+        NO_PROXY=$no_proxy \
1066
+        pip install -e $1
1067
+    # ensure that further actions can do things like setup.py sdist
1068
+    $SUDO_CMD chown -R $STACK_USER $1/*.egg-info
1074 1069
 }
1075 1070
 
1076 1071