pip 1.4 can handle the distribute/setuptools upgrade sequencing
appropriate. So it turns out all we need to upgrade is pip, and then the
rest will fall in to place. This will still not fix the packages vs. pip
interactions, but we don't to muck with the system setuptools packages
at all.
Change-Id: I99220ccc190798c3eb77bb2361abc6606bd546b4
| ... | ... |
@@ -2,13 +2,11 @@ |
| 2 | 2 |
|
| 3 | 3 |
# **install_pip.sh** |
| 4 | 4 |
|
| 5 |
-# install_pip.sh [--pip-version <version>] [--use-get-pip] [--setuptools] [--force] |
|
| 5 |
+# install_pip.sh [--pip-version <version>] [--use-get-pip] [--force] |
|
| 6 | 6 |
# |
| 7 | 7 |
# Update pip and friends to a known common version |
| 8 | 8 |
|
| 9 | 9 |
# Assumptions: |
| 10 |
-# - currently we try to leave the system setuptools alone, install |
|
| 11 |
-# the system package if it is not already present |
|
| 12 | 10 |
# - update pip to $INSTALL_PIP_VERSION |
| 13 | 11 |
|
| 14 | 12 |
# Keep track of the current directory |
| ... | ... |
@@ -25,7 +23,7 @@ FILES=$TOP_DIR/files |
| 25 | 25 |
|
| 26 | 26 |
# Handle arguments |
| 27 | 27 |
|
| 28 |
-INSTALL_PIP_VERSION=${INSTALL_PIP_VERSION:-"1.4"}
|
|
| 28 |
+INSTALL_PIP_VERSION=${INSTALL_PIP_VERSION:-"1.4.1"}
|
|
| 29 | 29 |
while [[ -n "$1" ]]; do |
| 30 | 30 |
case $1 in |
| 31 | 31 |
--force) |
| ... | ... |
@@ -35,9 +33,6 @@ while [[ -n "$1" ]]; do |
| 35 | 35 |
INSTALL_PIP_VERSION="$2" |
| 36 | 36 |
shift |
| 37 | 37 |
;; |
| 38 |
- --setuptools) |
|
| 39 |
- SETUPTOOLS=1 |
|
| 40 |
- ;; |
|
| 41 | 38 |
--use-get-pip) |
| 42 | 39 |
USE_GET_PIP=1; |
| 43 | 40 |
;; |
| ... | ... |
@@ -45,7 +40,6 @@ while [[ -n "$1" ]]; do |
| 45 | 45 |
shift |
| 46 | 46 |
done |
| 47 | 47 |
|
| 48 |
-SETUPTOOLS_EZ_SETUP_URL=https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py |
|
| 49 | 48 |
PIP_GET_PIP_URL=https://raw.github.com/pypa/pip/master/contrib/get-pip.py |
| 50 | 49 |
PIP_TAR_URL=https://pypi.python.org/packages/source/p/pip/pip-$INSTALL_PIP_VERSION.tar.gz |
| 51 | 50 |
|
| ... | ... |
@@ -55,21 +49,11 @@ echo "Distro: $DISTRO" |
| 55 | 55 |
function get_versions() {
|
| 56 | 56 |
PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null) |
| 57 | 57 |
if [[ -n $PIP ]]; then |
| 58 |
- DISTRIBUTE_VERSION=$($PIP freeze | grep 'distribute==') |
|
| 59 |
- SETUPTOOLS_VERSION=$($PIP freeze | grep 'setuptools==') |
|
| 60 | 58 |
PIP_VERSION=$($PIP --version | awk '{ print $2}')
|
| 61 |
- echo "pip: $PIP_VERSION setuptools: $SETUPTOOLS_VERSION distribute: $DISTRIBUTE_VERSION" |
|
| 59 |
+ echo "pip: $PIP_VERSION" |
|
| 62 | 60 |
fi |
| 63 | 61 |
} |
| 64 | 62 |
|
| 65 |
-function setuptools_ez_setup() {
|
|
| 66 |
- if [[ ! -r $FILES/ez_setup.py ]]; then |
|
| 67 |
- (cd $FILES; \ |
|
| 68 |
- curl -OR $SETUPTOOLS_EZ_SETUP_URL; \ |
|
| 69 |
- ) |
|
| 70 |
- fi |
|
| 71 |
- sudo python $FILES/ez_setup.py |
|
| 72 |
-} |
|
| 73 | 63 |
|
| 74 | 64 |
function install_get_pip() {
|
| 75 | 65 |
if [[ ! -r $FILES/get-pip.py ]]; then |
| ... | ... |
@@ -90,29 +74,15 @@ function install_pip_tarball() {
|
| 90 | 90 |
# Show starting versions |
| 91 | 91 |
get_versions |
| 92 | 92 |
|
| 93 |
-# Do setuptools |
|
| 94 |
-if [[ -n "$SETUPTOOLS" ]]; then |
|
| 95 |
- # We want it from source |
|
| 96 |
- uninstall_package python-setuptools |
|
| 97 |
- setuptools_ez_setup |
|
| 98 |
-else |
|
| 99 |
- # See about installing the distro setuptools |
|
| 100 |
- if ! python -c "import setuptools"; then |
|
| 101 |
- install_package python-setuptools |
|
| 102 |
- fi |
|
| 103 |
-fi |
|
| 104 |
- |
|
| 105 | 93 |
# Do pip |
| 106 |
-if [[ -z $PIP || "$PIP_VERSION" != "$INSTALL_PIP_VERSION" || -n $FORCE ]]; then |
|
| 107 | 94 |
|
| 108 |
- # Eradicate any and all system packages |
|
| 109 |
- uninstall_package python-pip |
|
| 110 |
- |
|
| 111 |
- if [[ -n "$USE_GET_PIP" ]]; then |
|
| 112 |
- install_get_pip |
|
| 113 |
- else |
|
| 114 |
- install_pip_tarball |
|
| 115 |
- fi |
|
| 95 |
+# Eradicate any and all system packages |
|
| 96 |
+uninstall_package python-pip |
|
| 116 | 97 |
|
| 117 |
- get_versions |
|
| 98 |
+if [[ -n "$USE_GET_PIP" ]]; then |
|
| 99 |
+ install_get_pip |
|
| 100 |
+else |
|
| 101 |
+ install_pip_tarball |
|
| 118 | 102 |
fi |
| 103 |
+ |
|
| 104 |
+get_versions |