Browse code

More Python package fixes

* Add tools/fixup_stuff.sh to fix prettytable and httplib2 install
with pip 1.4+
* Cache downloads properly in tools/install_pip.sh

Change-Id: I482590cb91f7a10c1436bc9015afd572ac1cc73e

Dean Troyer authored on 2013/08/10 05:09:31
Showing 3 changed files
... ...
@@ -581,6 +581,10 @@ source $TOP_DIR/tools/install_prereqs.sh
581 581
 # Configure an appropriate python environment
582 582
 $TOP_DIR/tools/install_pip.sh
583 583
 
584
+# Do the ugly hacks for borken packages and distros
585
+$TOP_DIR/tools/fixup_stuff.sh
586
+
587
+
584 588
 # System-specific preconfigure
585 589
 # ============================
586 590
 
587 591
new file mode 100755
... ...
@@ -0,0 +1,43 @@
0
+#!/usr/bin/env bash
1
+
2
+# **fixup_stuff.sh**
3
+
4
+# fixup_stuff.sh
5
+#
6
+# All distro and package specific hacks go in here
7
+# - prettytable 0.7.2 permissions are 600 in the package and
8
+#   pip 1.4 doesn't fix it (1.3 did)
9
+# - httplib2 0.8 permissions are 600 in the package and
10
+#   pip 1.4 doesn't fix it (1.3 did)
11
+
12
+# Keep track of the current directory
13
+TOOLS_DIR=$(cd $(dirname "$0") && pwd)
14
+TOP_DIR=`cd $TOOLS_DIR/..; pwd`
15
+
16
+# Change dir to top of devstack
17
+cd $TOP_DIR
18
+
19
+# Import common functions
20
+source $TOP_DIR/functions
21
+
22
+FILES=$TOP_DIR/files
23
+
24
+# Pre-install affected packages so we can fix the permissions
25
+sudo pip install prettytable
26
+sudo pip install httplib2
27
+
28
+SITE_DIRS=$(python -c "import site; import os; print os.linesep.join(site.getsitepackages())")
29
+for dir in $SITE_DIRS; do
30
+
31
+    # Fix prettytable 0.7.2 permissions
32
+    if [[ -r $dir/prettytable.py ]]; then
33
+        sudo chmod +r $dir/prettytable-0.7.2*/*
34
+    fi
35
+
36
+    # Fix httplib2 0.8 permissions
37
+    httplib_dir=httplib2-0.8.egg-info
38
+    if [[ -d $dir/$httplib_dir ]]; then
39
+        sudo chmod +r $dir/$httplib_dir/*
40
+    fi
41
+
42
+done
... ...
@@ -81,10 +81,12 @@ function install_get_pip() {
81 81
 }
82 82
 
83 83
 function install_pip_tarball() {
84
-    curl -O $PIP_TAR_URL
85
-    tar xvfz pip-$INSTALL_PIP_VERSION.tar.gz
86
-    cd pip-$INSTALL_PIP_VERSION
87
-    sudo python setup.py install
84
+    (cd $FILES; \
85
+        curl -O $PIP_TAR_URL; \
86
+        tar xvfz pip-$INSTALL_PIP_VERSION.tar.gz; \
87
+        cd pip-$INSTALL_PIP_VERSION; \
88
+        sudo python setup.py install; \
89
+    )
88 90
 }
89 91
 
90 92
 # Show starting versions