changeset 1031:cba1aa443bbc

GNU Health Installer : Fix bug #40169: Backward incompatibility using --pre option of pip command. https://savannah.gnu.org/bugs/index.php?40169
author Bruno M. Villasanti <bvillasanti@thymbra.com>
date Fri, 04 Oct 2013 00:29:11 -0300
parents 09caf1abecc9
children ec7d201bef88
files tryton/gnuhealth_install.sh
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/gnuhealth_install.sh
+++ b/tryton/gnuhealth_install.sh
@@ -96,6 +96,7 @@
 
 install_python_dependencies() {
     local PIP_CMD=$(which $PIP_NAME)
+    local PIP_VERSION="$(${PIP_CMD} --version | awk '{print $2}')"
 
     # TODO: Change for virtualenv support.
     local PIP_ARGS="install --user"
@@ -116,13 +117,22 @@
 
     local PIP_PKGS="$PIP_LXML $PIP_RELATORIO $PIP_DATEUTIL $PIP_PSYCOPG2 $PIP_LDAP $PIP_VOBJECT $PIP_PYWEBDAV $PIP_QRCODE $PIP_PIL $PIP_CALDAV $PIP_POLIB"
 
-    message "[INFO] Special Installation of Python Timezone Library PYTZ ..." ${YELLOW}
-    local PIP_PYTZ_ARGS="install --user --pre"
-    ${PIP_CMD} ${PIP_PYTZ_ARGS} ${PIP_PYTZ} || exit 1
-    
-    message "[INFO] Installing python dependencies with pip..." ${YELLOW}
+    message "[INFO] Installing python dependencies with pip-${PIP_VERSION} ..." ${YELLOW}
+
+    # Handling of BACKWARD INCOMPATIBLE arguments for pip command:
+    if [[ "${PIP_VERSION}" > "1.4" ]]; then
+        message " >> ${PIP_PYTZ} (including pre-release and development versions)" ${BLUE}
+        ${PIP_CMD} ${PIP_ARGS} --pre ${PIP_PYTZ} || exit 1
+    else
+        message " >> ${PIP_PYTZ}" ${BLUE}
+        ${PIP_CMD} ${PIP_ARGS} ${PIP_PYTZ} || exit 1
+    fi
+    message " >> OK" ${GREEN}
+
     for PKG in ${PIP_PKGS}; do
+        message " >> ${PKG}" ${BLUE}
         ${PIP_CMD} ${PIP_ARGS} ${PKG} || exit 1
+        message " >> OK" ${GREEN}
     done
 }