]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: pip wheel for python dependencies
authorLoic Dachary <ldachary@redhat.com>
Sat, 2 May 2015 13:59:12 +0000 (15:59 +0200)
committerLoic Dachary <ldachary@redhat.com>
Tue, 5 May 2015 17:16:50 +0000 (19:16 +0200)
For all tox.ini in the source tree which also have requirement.txt
files, create a wheelhouse with the dependencies. This allows tox to
setup test environment with no access to the network with something
like (in tox.ini):

        deps =
          --use-wheel
          --find-links={toxinidir}/wheelhouse
          -r{toxinidir}/requirements.txt
          -r{toxinidir}/test-requirements.txt

Signed-off-by: Loic Dachary <ldachary@redhat.com>
install-deps.sh

index 6fea6bdd182bda19bfa76144d7395c66a984c777..dbc720b8772bea2ead7d78bc490794fd19b0bba4 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # Ceph distributed storage system
 #
-# Copyright (C) 2014 Red Hat <contact@redhat.com>
+# Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
 #
 # Author: Loic Dachary <loic@dachary.org>
 #
@@ -83,3 +83,26 @@ CentOS|Fedora|RedHatEnterpriseServer)
         echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually."
         ;;
 esac
+
+#
+# preload python modules so that tox can run without network access
+#
+for interpreter in python2.7 python3 ; do
+    type $interpreter > /dev/null 2>&1 || continue
+    rm -fr install-deps
+    virtualenv --python $interpreter install-deps
+    . install-deps/bin/activate
+    pip install wheel
+    find . -name tox.ini | while read ini ; do
+        (
+            cd $(dirname $ini)
+            require=$(ls *requirements.txt 2>/dev/null | sed -e 's/^/-r /')
+            if test "$require" ; then
+                # although pip comes with virtualenv, having a recent version
+                # of pip matters when it comes to using wheel packages
+                pip wheel $require 'distribute >= 0.7' 'pip >= 6.1'
+            fi
+        )
+    done
+done
+rm -fr install-deps