Merge "Stop doing special things with setuptools"

This commit is contained in:
Jenkins 2013-09-13 11:27:59 +00:00 committed by Gerrit Code Review
commit 7ab1f22c60
1 changed files with 10 additions and 40 deletions

View File

@ -2,13 +2,11 @@
# **install_pip.sh** # **install_pip.sh**
# install_pip.sh [--pip-version <version>] [--use-get-pip] [--setuptools] [--force] # install_pip.sh [--pip-version <version>] [--use-get-pip] [--force]
# #
# Update pip and friends to a known common version # Update pip and friends to a known common version
# Assumptions: # Assumptions:
# - currently we try to leave the system setuptools alone, install
# the system package if it is not already present
# - update pip to $INSTALL_PIP_VERSION # - update pip to $INSTALL_PIP_VERSION
# Keep track of the current directory # Keep track of the current directory
@ -35,9 +33,6 @@ while [[ -n "$1" ]]; do
INSTALL_PIP_VERSION="$2" INSTALL_PIP_VERSION="$2"
shift shift
;; ;;
--setuptools)
SETUPTOOLS=1
;;
--use-get-pip) --use-get-pip)
USE_GET_PIP=1; USE_GET_PIP=1;
;; ;;
@ -45,7 +40,6 @@ while [[ -n "$1" ]]; do
shift shift
done done
SETUPTOOLS_EZ_SETUP_URL=https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
PIP_GET_PIP_URL=https://raw.github.com/pypa/pip/master/contrib/get-pip.py PIP_GET_PIP_URL=https://raw.github.com/pypa/pip/master/contrib/get-pip.py
PIP_TAR_URL=https://pypi.python.org/packages/source/p/pip/pip-$INSTALL_PIP_VERSION.tar.gz PIP_TAR_URL=https://pypi.python.org/packages/source/p/pip/pip-$INSTALL_PIP_VERSION.tar.gz
@ -55,21 +49,11 @@ echo "Distro: $DISTRO"
function get_versions() { function get_versions() {
PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null) PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null)
if [[ -n $PIP ]]; then if [[ -n $PIP ]]; then
DISTRIBUTE_VERSION=$($PIP freeze | grep 'distribute==')
SETUPTOOLS_VERSION=$($PIP freeze | grep 'setuptools==')
PIP_VERSION=$($PIP --version | awk '{ print $2}') PIP_VERSION=$($PIP --version | awk '{ print $2}')
echo "pip: $PIP_VERSION setuptools: $SETUPTOOLS_VERSION distribute: $DISTRIBUTE_VERSION" echo "pip: $PIP_VERSION"
fi fi
} }
function setuptools_ez_setup() {
if [[ ! -r $FILES/ez_setup.py ]]; then
(cd $FILES; \
curl -OR $SETUPTOOLS_EZ_SETUP_URL; \
)
fi
sudo python $FILES/ez_setup.py
}
function install_get_pip() { function install_get_pip() {
if [[ ! -r $FILES/get-pip.py ]]; then if [[ ! -r $FILES/get-pip.py ]]; then
@ -92,29 +76,15 @@ function install_pip_tarball() {
# Show starting versions # Show starting versions
get_versions get_versions
# Do setuptools
if [[ -n "$SETUPTOOLS" ]]; then
# We want it from source
uninstall_package python-setuptools
setuptools_ez_setup
else
# See about installing the distro setuptools
if ! python -c "import setuptools"; then
install_package python-setuptools
fi
fi
# Do pip # Do pip
if [[ -z $PIP || "$PIP_VERSION" != "$INSTALL_PIP_VERSION" || -n $FORCE ]]; then
# Eradicate any and all system packages # Eradicate any and all system packages
uninstall_package python-pip uninstall_package python-pip
if [[ -n "$USE_GET_PIP" ]]; then if [[ -n "$USE_GET_PIP" ]]; then
install_get_pip install_get_pip
else else
install_pip_tarball install_pip_tarball
fi
get_versions
fi fi
get_versions