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 408a4a7d1c)

Conflicts:
	functions

Closes-Bug: #1266094
Change-Id: Iffd068c94ef84475ebb30758bcf612075d225bea
This commit is contained in:
Monty Taylor 2013-08-02 15:43:47 -04:00 committed by Xavier Queralt
parent 7610f0d875
commit ee29648991
1 changed files with 11 additions and 15 deletions

View File

@ -1049,9 +1049,10 @@ function service_check() {
fi
}
# ``pip install`` the dependencies of the package before ``setup.py develop``
# so pip and not distutils processes the dependency chain
# Uses globals ``TRACK_DEPENDES``, ``*_proxy`
# ``pip install -e`` the package, which processes the dependencies
# using pip before running `setup.py develop`
# Uses globals ``STACK_USER``, ``TRACK_DEPENDES``, ``*_proxy`
# setup_develop directory
function setup_develop() {
if [[ $TRACK_DEPENDS = True ]]; then
@ -1059,18 +1060,13 @@ function setup_develop() {
else
SUDO_CMD="sudo"
fi
(cd $1; \
python setup.py egg_info; \
raw_links=$(awk '/^.+/ {print "-f " $1}' *.egg-info/dependency_links.txt); \
depend_links=$(echo $raw_links | xargs); \
require_file=$([ ! -r *-info/requires.txt ] || echo "-r *-info/requires.txt"); \
pip_install $require_file $depend_links; \
$SUDO_CMD \
HTTP_PROXY=$http_proxy \
HTTPS_PROXY=$https_proxy \
NO_PROXY=$no_proxy \
python setup.py develop \
)
$SUDO_CMD \
HTTP_PROXY=$http_proxy \
HTTPS_PROXY=$https_proxy \
NO_PROXY=$no_proxy \
pip install -e $1
# ensure that further actions can do things like setup.py sdist
$SUDO_CMD chown -R $STACK_USER $1/*.egg-info
}