Install a known working recent version of pip that handles installation
dependencies more correctly than before. Extract to a separate script
so it can be used apart from stack.sh.
* Install distro setuptools if it not already present
* Install pip from source tarball as get-pip.py proved to be unreliable
* Remove python-distribute and python-pip from all prereq files,
move python-setuptools to 'general'
* Remove the earlier unfubar_setuptppls() call that attenpted to fix this
* Only update requirements.txt when no changes in repo
Tested on Precise, F18 and CentOS6.
* Fedora and RHEL allow pip to install packages ON TOP OF RPM-installed
packages. THIS IS BROKEN. And is one reason we have to be so picky
about order and so forth.
Change-Id: Ibb4b42119dc2e51577c77bbbbffb110863e5324d
... | ... |
@@ -4,10 +4,9 @@ python-paste #dist:f16,f17,f18,f19 |
4 | 4 |
python-paste-deploy #dist:f16,f17,f18,f19 |
5 | 5 |
python-paste-script #dist:f16,f17,f18,f19 |
6 | 6 |
python-routes |
7 |
-python-setuptools #dist:f16,f17,f18,f19 |
|
8 | 7 |
python-sqlalchemy |
9 | 8 |
python-sqlite2 |
10 | 9 |
python-webob |
11 | 10 |
sqlite |
12 | 11 |
|
13 |
-# Deps installed via pip for RHEL |
|
14 | 12 |
\ No newline at end of file |
13 |
+# Deps installed via pip for RHEL |
... | ... |
@@ -1140,8 +1140,11 @@ function setup_develop() { |
1140 | 1140 |
|
1141 | 1141 |
echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir" |
1142 | 1142 |
|
1143 |
- (cd $REQUIREMENTS_DIR; \ |
|
1144 |
- $SUDO_CMD python update.py $project_dir) |
|
1143 |
+ # Don't update repo if local changes exist |
|
1144 |
+ if (cd $project_dir && git diff --quiet); then |
|
1145 |
+ (cd $REQUIREMENTS_DIR; \ |
|
1146 |
+ $SUDO_CMD python update.py $project_dir) |
|
1147 |
+ fi |
|
1145 | 1148 |
|
1146 | 1149 |
pip_install -e $project_dir |
1147 | 1150 |
# ensure that further actions can do things like setup.py sdist |
... | ... |
@@ -578,18 +578,8 @@ set -o xtrace |
578 | 578 |
echo_summary "Installing package prerequisites" |
579 | 579 |
source $TOP_DIR/tools/install_prereqs.sh |
580 | 580 |
|
581 |
-install_rpc_backend |
|
582 |
- |
|
583 |
-if is_service_enabled $DATABASE_BACKENDS; then |
|
584 |
- install_database |
|
585 |
-fi |
|
586 |
- |
|
587 |
-if is_service_enabled neutron; then |
|
588 |
- install_neutron_agent_packages |
|
589 |
-fi |
|
590 |
- |
|
591 |
-# Unbreak the giant mess that is the current state of setuptools |
|
592 |
-unfubar_setuptools |
|
581 |
+# Configure an appropriate python environment |
|
582 |
+$TOP_DIR/tools/install_pip.sh |
|
593 | 583 |
|
594 | 584 |
# System-specific preconfigure |
595 | 585 |
# ============================ |
... | ... |
@@ -642,6 +632,16 @@ if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then |
642 | 642 |
sudo ln -sf /usr/bin/nosetests1.1 /usr/local/bin/nosetests |
643 | 643 |
fi |
644 | 644 |
|
645 |
+install_rpc_backend |
|
646 |
+ |
|
647 |
+if is_service_enabled $DATABASE_BACKENDS; then |
|
648 |
+ install_database |
|
649 |
+fi |
|
650 |
+ |
|
651 |
+if is_service_enabled neutron; then |
|
652 |
+ install_neutron_agent_packages |
|
653 |
+fi |
|
654 |
+ |
|
645 | 655 |
TRACK_DEPENDS=${TRACK_DEPENDS:-False} |
646 | 656 |
|
647 | 657 |
# Install python packages into a virtualenv so that we can track them |
648 | 658 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,118 @@ |
0 |
+#!/usr/bin/env bash |
|
1 |
+ |
|
2 |
+# **install_pip.sh** |
|
3 |
+ |
|
4 |
+# install_pip.sh [--pip-version <version>] [--use-get-pip] [--setuptools] [--force] |
|
5 |
+# |
|
6 |
+# Update pip and friends to a known common version |
|
7 |
+ |
|
8 |
+# Assumptions: |
|
9 |
+# - currently we try to leave the system setuptools alone, install |
|
10 |
+# the system package if it is not already present |
|
11 |
+# - update pip to $INSTALL_PIP_VERSION |
|
12 |
+ |
|
13 |
+# Keep track of the current directory |
|
14 |
+TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
|
15 |
+TOP_DIR=`cd $TOOLS_DIR/..; pwd` |
|
16 |
+ |
|
17 |
+# Change dir to top of devstack |
|
18 |
+cd $TOP_DIR |
|
19 |
+ |
|
20 |
+# Import common functions |
|
21 |
+source $TOP_DIR/functions |
|
22 |
+ |
|
23 |
+FILES=$TOP_DIR/files |
|
24 |
+ |
|
25 |
+# Handle arguments |
|
26 |
+ |
|
27 |
+INSTALL_PIP_VERSION=${INSTALL_PIP_VERSION:-"1.4"} |
|
28 |
+while [[ -n "$1" ]]; do |
|
29 |
+ case $1 in |
|
30 |
+ --force) |
|
31 |
+ FORCE=1 |
|
32 |
+ ;; |
|
33 |
+ --pip-version) |
|
34 |
+ INSTALL_PIP_VERSION="$2" |
|
35 |
+ shift |
|
36 |
+ ;; |
|
37 |
+ --setuptools) |
|
38 |
+ SETUPTOOLS=1 |
|
39 |
+ ;; |
|
40 |
+ --use-get-pip) |
|
41 |
+ USE_GET_PIP=1; |
|
42 |
+ ;; |
|
43 |
+ esac |
|
44 |
+ shift |
|
45 |
+done |
|
46 |
+ |
|
47 |
+SETUPTOOLS_EZ_SETUP_URL=https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py |
|
48 |
+PIP_GET_PIP_URL=https://raw.github.com/pypa/pip/master/contrib/get-pip.py |
|
49 |
+PIP_TAR_URL=https://pypi.python.org/packages/source/p/pip/pip-$INSTALL_PIP_VERSION.tar.gz |
|
50 |
+ |
|
51 |
+GetDistro |
|
52 |
+echo "Distro: $DISTRO" |
|
53 |
+ |
|
54 |
+function get_versions() { |
|
55 |
+ PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null) |
|
56 |
+ if [[ -n $PIP ]]; then |
|
57 |
+ DISTRIBUTE_VERSION=$($PIP freeze | grep 'distribute==') |
|
58 |
+ SETUPTOOLS_VERSION=$($PIP freeze | grep 'setuptools==') |
|
59 |
+ PIP_VERSION=$($PIP --version | awk '{ print $2}') |
|
60 |
+ echo "pip: $PIP_VERSION setuptools: $SETUPTOOLS_VERSION distribute: $DISTRIBUTE_VERSION" |
|
61 |
+ fi |
|
62 |
+} |
|
63 |
+ |
|
64 |
+function setuptools_ez_setup() { |
|
65 |
+ if [[ ! -r $FILES/ez_setup.py ]]; then |
|
66 |
+ (cd $FILES; \ |
|
67 |
+ curl -OR $SETUPTOOLS_EZ_SETUP_URL; \ |
|
68 |
+ ) |
|
69 |
+ fi |
|
70 |
+ sudo python $FILES/ez_setup.py |
|
71 |
+} |
|
72 |
+ |
|
73 |
+function install_get_pip() { |
|
74 |
+ if [[ ! -r $FILES/get-pip.py ]]; then |
|
75 |
+ (cd $FILES; \ |
|
76 |
+ curl $PIP_GET_PIP_URL; \ |
|
77 |
+ ) |
|
78 |
+ fi |
|
79 |
+ sudo python $FILES/get-pip.py |
|
80 |
+} |
|
81 |
+ |
|
82 |
+function install_pip_tarball() { |
|
83 |
+ curl -O $PIP_TAR_URL |
|
84 |
+ tar xvfz pip-$INSTALL_PIP_VERSION.tar.gz |
|
85 |
+ cd pip-$INSTALL_PIP_VERSION |
|
86 |
+ sudo python setup.py install |
|
87 |
+} |
|
88 |
+ |
|
89 |
+# Show starting versions |
|
90 |
+get_versions |
|
91 |
+ |
|
92 |
+# Do setuptools |
|
93 |
+if [[ -n "$SETUPTOOLS" ]]; then |
|
94 |
+ # We want it from source |
|
95 |
+ uninstall_package python-setuptools |
|
96 |
+ setuptools_ez_setup |
|
97 |
+else |
|
98 |
+ # See about installing the distro setuptools |
|
99 |
+ if ! python -c "import setuptools"; then |
|
100 |
+ install_package python-setuptools |
|
101 |
+ fi |
|
102 |
+fi |
|
103 |
+ |
|
104 |
+# Do pip |
|
105 |
+if [[ -z $PIP || "$PIP_VERSION" != "$INSTALL_PIP_VERSION" || -n $FORCE ]]; then |
|
106 |
+ |
|
107 |
+ # Eradicate any and all system packages |
|
108 |
+ uninstall_package python-pip |
|
109 |
+ |
|
110 |
+ if [[ -n "$USE_GET_PIP" ]]; then |
|
111 |
+ install_get_pip |
|
112 |
+ else |
|
113 |
+ install_pip_tarball |
|
114 |
+ fi |
|
115 |
+ |
|
116 |
+ get_versions |
|
117 |
+fi |