[Install] Improve installation script
Two changes: * get rid of complicated determining of latest setuptools package URL and switch to usage of script ez_setup.py * run script ez_setup.py in any case, no matter if we have setuptools version lesser that 0.8 or not. As result, we will always have latest setuptools version in virtualenv These changes simplify the code a lot and provide reliable installation of latest setuptools version. See details about usage of script ez_setup.py at https://pypi.python.org/pypi/setuptools Change-Id: Ia8980ad4afc22daa25258c219861e5949930d199
This commit is contained in:
parent
ac92fe786e
commit
8ab351b1ab
@ -273,30 +273,6 @@ download() {
|
||||
wget -nv $VERBOSE --no-check-certificate -O "$@";
|
||||
}
|
||||
|
||||
download_setuptools () {
|
||||
local url
|
||||
# NOTE(stpierre): This (admittedly ugly) one-liner parses the JSON
|
||||
# returned from pypi and fetches the URL for the latest version of
|
||||
# the source (i.e., .tar.gz) package. It's safe here to look for
|
||||
# the .tar.gz explicitly (rather than matching on package type ==
|
||||
# source) because we untar it later anyway.
|
||||
url=$(python -c '
|
||||
import json
|
||||
import urllib2
|
||||
|
||||
print [u["url"]
|
||||
for u in json.load(urllib2.urlopen("http://pypi.python.org/pypi/setuptools/json/"))["urls"]
|
||||
if u["filename"].endswith(".tar.gz")].pop()')
|
||||
|
||||
if [ -n "$url" ]; then
|
||||
download "$(basename "$url")" "$url"
|
||||
else
|
||||
die $EX_PROTOCOL "Setuptools not found on PyPI!" <<__EOF__
|
||||
Unable to download package 'setuptools' from PyPI.
|
||||
__EOF__
|
||||
fi
|
||||
}
|
||||
|
||||
install_required_sw () {
|
||||
# instead of guessing which distribution this is, we check for the
|
||||
# package manager name as it basically identifies the distro
|
||||
@ -446,30 +422,18 @@ __EOF__
|
||||
download "$VIRTUALENV_DST" "$VIRTUALENV_191_URL"
|
||||
"$PYTHON" "$VIRTUALENV_DST" $VERBOSE -p "$PYTHON" "$DESTDIR"
|
||||
|
||||
. "$DESTDIR"/bin/activate
|
||||
cd "${DESTDIR}" && . bin/activate
|
||||
|
||||
# Recent versions of `pip` insist that setuptools>=0.8 is installed,
|
||||
# because they try to use the "wheel" format for any kind of package.
|
||||
# So we need to update setuptools, or `pip` will error out::
|
||||
#
|
||||
# Wheel installs require setuptools >= 0.8 for dist-info support.
|
||||
#
|
||||
if pip wheel --help 1>/dev/null 2>/dev/null; then
|
||||
(cd "$DESTDIR" && download_setuptools)
|
||||
# setup.py must be called with `python', which will be the
|
||||
# python executable inside the virtualenv, not `$PYTHON',
|
||||
# which is the system python.
|
||||
if ! (cd "$DESTDIR" && tar -xzf setuptools-*.tar.gz && \
|
||||
cd setuptools-* && python setup.py install);
|
||||
then
|
||||
die $EX_SOFTWARE \
|
||||
"Failed to install the latest version of Python 'setuptools'" <<__EOF__
|
||||
# Setuptools>=0.8 is required to support "wheel" format, otherwise
|
||||
# pip will fail with an error. To be sure, just run upgrade to the
|
||||
# recent version of setuptools
|
||||
download - https://bootstrap.pypa.io/ez_setup.py | python - --insecure\
|
||||
|| die ${EX_SOFTWARE}\
|
||||
"Failed to install the latest version of Python 'setuptools'" <<__EOF__
|
||||
|
||||
The required Python package setuptools could not be installed.
|
||||
|
||||
__EOF__
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_rally_configuration () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user