Stop doing special things with setuptools

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
This commit is contained in:
Monty Taylor 2013-08-10 23:49:47 -03:00
parent ba963468a5
commit dace92f557
1 changed files with 11 additions and 41 deletions

View File

@ -2,13 +2,11 @@
# **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
# 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
# Keep track of the current directory
@ -25,7 +23,7 @@ FILES=$TOP_DIR/files
# Handle arguments
INSTALL_PIP_VERSION=${INSTALL_PIP_VERSION:-"1.4"}
INSTALL_PIP_VERSION=${INSTALL_PIP_VERSION:-"1.4.1"}
while [[ -n "$1" ]]; do
case $1 in
--force)
@ -35,9 +33,6 @@ while [[ -n "$1" ]]; do
INSTALL_PIP_VERSION="$2"
shift
;;
--setuptools)
SETUPTOOLS=1
;;
--use-get-pip)
USE_GET_PIP=1;
;;
@ -45,7 +40,6 @@ while [[ -n "$1" ]]; do
shift
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_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() {
PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null)
if [[ -n $PIP ]]; then
DISTRIBUTE_VERSION=$($PIP freeze | grep 'distribute==')
SETUPTOOLS_VERSION=$($PIP freeze | grep 'setuptools==')
PIP_VERSION=$($PIP --version | awk '{ print $2}')
echo "pip: $PIP_VERSION setuptools: $SETUPTOOLS_VERSION distribute: $DISTRIBUTE_VERSION"
echo "pip: $PIP_VERSION"
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() {
if [[ ! -r $FILES/get-pip.py ]]; then
@ -90,29 +74,15 @@ function install_pip_tarball() {
# Show starting 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
if [[ -z $PIP || "$PIP_VERSION" != "$INSTALL_PIP_VERSION" || -n $FORCE ]]; then
# Eradicate any and all system packages
uninstall_package python-pip
# Eradicate any and all system packages
uninstall_package python-pip
if [[ -n "$USE_GET_PIP" ]]; then
install_get_pip
else
install_pip_tarball
fi
get_versions
if [[ -n "$USE_GET_PIP" ]]; then
install_get_pip
else
install_pip_tarball
fi
get_versions