| ... | ... |
@@ -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 |
| ... | ... |
@@ -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 |
| ... | ... |
@@ -92,29 +76,15 @@ function install_pip_tarball() {
|
| 92 | 92 |
# Show starting versions |
| 93 | 93 |
get_versions |
| 94 | 94 |
|
| 95 |
-# Do setuptools |
|
| 96 |
-if [[ -n "$SETUPTOOLS" ]]; then |
|
| 97 |
- # We want it from source |
|
| 98 |
- uninstall_package python-setuptools |
|
| 99 |
- setuptools_ez_setup |
|
| 100 |
-else |
|
| 101 |
- # See about installing the distro setuptools |
|
| 102 |
- if ! python -c "import setuptools"; then |
|
| 103 |
- install_package python-setuptools |
|
| 104 |
- fi |
|
| 105 |
-fi |
|
| 106 |
- |
|
| 107 | 95 |
# Do pip |
| 108 |
-if [[ -z $PIP || "$PIP_VERSION" != "$INSTALL_PIP_VERSION" || -n $FORCE ]]; then |
|
| 109 | 96 |
|
| 110 |
- # Eradicate any and all system packages |
|
| 111 |
- uninstall_package python-pip |
|
| 112 |
- |
|
| 113 |
- if [[ -n "$USE_GET_PIP" ]]; then |
|
| 114 |
- install_get_pip |
|
| 115 |
- else |
|
| 116 |
- install_pip_tarball |
|
| 117 |
- fi |
|
| 97 |
+# Eradicate any and all system packages |
|
| 98 |
+uninstall_package python-pip |
|
| 118 | 99 |
|
| 119 |
- get_versions |
|
| 100 |
+if [[ -n "$USE_GET_PIP" ]]; then |
|
| 101 |
+ install_get_pip |
|
| 102 |
+else |
|
| 103 |
+ install_pip_tarball |
|
| 120 | 104 |
fi |
| 105 |
+ |
|
| 106 |
+get_versions |