Skip to content

Commit

Permalink
Merge pull request #43 from osuosl/tschuy/39/pip_proxy
Browse files Browse the repository at this point in the history
Allow user to specify pip proxy with setup script
  • Loading branch information
tschuy committed Jun 4, 2015
2 parents 50f2bc3 + b4a30a1 commit fbeb01f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/source/getting_started/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ own, here's the list:
requires ``psycopg2`` package installed within virtual environment, which in
turn requires ``libpq5`` on Ubuntu/Debian and ``postgresql-libs`` on CentOS.

If your using the ``setup.sh`` script these database dependencies should be
If you're using the ``setup.sh`` script these database dependencies should be
installed for you. But if it runs into errors, these are the dependencies needed.

LDAP
Expand Down
8 changes: 8 additions & 0 deletions docs/source/ref/setup-script.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ Command line arguments
permission to install some system dependencies.


.. cmdoption:: -p <http proxy url>

:default: none

If you provide an HTTP proxy URL, pip will use this proxy to install all
of the required packages.


.. cmdoption:: -u <install directory>

:default: ``./ganeti_webmgr``
Expand Down
17 changes: 12 additions & 5 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Options:
(unless -N). If you don't specify it, SQLite
will be assumed the default DB.
-N Don't try to install system dependencies.
-p <http proxy url> Make pip use the HTTP proxy specified
-w <wheels (local/remote) directory location>
Where wheel packages are stored. Don't change
this value unless you know what you're doing!
Expand Down Expand Up @@ -122,9 +123,10 @@ fi
no_dependencies=0
upgrade=0
database_server='sqlite'
pip_proxy=""

### Runtime arguments and help text
while getopts "hud:D:Nw:" opt; do
while getopts "hud:D:Nw:p:" opt; do
case $opt in
h)
usage
Expand Down Expand Up @@ -164,6 +166,10 @@ while getopts "hud:D:Nw:" opt; do
base_url="$OPTARG"
;;

p)
$pip_proxy="--proxy=$OPTARG"
;;

\?)
# unknown parameter
exit 2
Expand Down Expand Up @@ -290,7 +296,8 @@ fi
### updating pip and setuptools to the newest versions, installing wheel
pip="$install_directory/bin/pip"
check_if_exists "$pip"
${pip} install --upgrade setuptools pip wheel
${pip} install $pip_proxy --upgrade setuptools pip wheel
echo

# check if successfully upgraded pip and setuptools
if [ ! $? -eq 0 ]; then
Expand All @@ -312,7 +319,7 @@ echo "------------------------------------------------------------------------"
# WARNING: watch out for double slashes when concatenating these strings!
url="$base_url/$os/$os_codename/$architecture/"

${pip} install --upgrade --use-wheel --find-link="$url" "$gwm_location"
${pip} install $pip_proxy --upgrade --use-wheel --find-link="$url" "$gwm_location"

if [ ! $? -eq 0 ]; then
echo "${txtboldred}Something went wrong. Could not install GWM nor its" \
Expand All @@ -328,10 +335,10 @@ fi
if [ "$database_server" != "sqlite" ]; then
case $database_server in
postgresql)
${pip} install --upgrade --use-wheel --find-link="$url" psycopg2
${pip} install $pip_proxy --upgrade --use-wheel --find-link="$url" psycopg2
;;
mysql)
${pip} install --upgrade --use-wheel --find-link="$url" MySQL-python
${pip} install $pip_proxy --upgrade --use-wheel --find-link="$url" MySQL-python
;;
esac

Expand Down

0 comments on commit fbeb01f

Please sign in to comment.