]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-detect-init: make all must setup.py install
authorLoic Dachary <ldachary@redhat.com>
Tue, 19 Jan 2016 08:55:52 +0000 (15:55 +0700)
committerLoic Dachary <ldachary@redhat.com>
Thu, 4 Feb 2016 07:38:08 +0000 (14:38 +0700)
When make all runs in the ceph-detect-init module, it does a "setup.py
build" which is not used. Replace it with a python setup.py install in a
virtualenv so that tests can add the virtualenv/bin to their PATH and
call ceph-detect-init from sources as they would if it was installed.

Part of run-tox.sh is moved to tools/setup-virtualenv.sh so that it can
be re-used by ceph-disk and other python modules.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/ceph-detect-init/.gitignore
src/ceph-detect-init/Makefile.am
src/ceph-detect-init/run-tox.sh
src/ceph-disk/tests/ceph-disk.sh
src/tools/Makefile.am
src/tools/setup-virtualenv.sh [new file with mode: 0755]

index 0b4b8149360ff65894f63ec3ffdd3c5f282b312d..dfb9bc7b567817411bfffa38110d2f1cbcaf588f 100644 (file)
@@ -6,7 +6,7 @@
 *.egg-info
 *.egg
 dist
-build
+virtualenv
 wheelhouse*
 *.log
 *.trs
index 932f7555aaad76303c5110e0fc143b4a9ff4eb4c..45196a54b88078b5cd8d7023c2ba5f7076812947 100644 (file)
@@ -53,11 +53,13 @@ EXTRA_DIST += \
        ceph-detect-init/tests/test_all.py \
        ceph-detect-init/tox.ini
 
-ceph-detect-init-all:
-       cd $(srcdir)/ceph-detect-init ; python setup.py build
+ceph-detect-init-all: ceph-detect-init/virtualenv
+
+ceph-detect-init/virtualenv:
+       cd $(srcdir)/ceph-detect-init ; ../tools/setup-virtualenv.sh ; virtualenv/bin/python setup.py develop
 
 ceph-detect-init-clean:
-       cd $(srcdir)/ceph-detect-init ; python setup.py clean ; rm -fr wheelhouse .tox build .coverage *.egg-info
+       cd $(srcdir)/ceph-detect-init ; python setup.py clean ; rm -fr wheelhouse .tox virtualenv .coverage *.egg-info
 
 ceph-detect-init-install-data:
        cd $(srcdir)/ceph-detect-init ; \
index 206938e28767708557068cfc5ec3384731109fcd..6a8e0735d55508ae8931ed723453a82994bb2014 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Copyright (C) 2015 SUSE LINUX GmbH
-# Copyright (C) 2015 <contact@redhat.com>
+# Copyright (C) 2016 <contact@redhat.com>
 #
 # Author: Owen Synge <osynge@suse.com>
 # Author: Loic Dachary <loic@dachary.org>
 
 # run from the ceph-detect-init directory or from its parent
 test -d ceph-detect-init && cd ceph-detect-init
-trap "rm -fr make-check" EXIT
-virtualenv make-check
-. make-check/bin/activate
-# older versions of pip will not install wrap_console scripts
-# when using wheel packages
-pip --log make-check/log.txt install --upgrade 'pip >= 6.1'
-if test -d wheelhouse ; then
-    export NO_INDEX=--no-index
-fi
-pip --log make-check/log.txt install $NO_INDEX --use-wheel --find-links=file://$(pwd)/wheelhouse --upgrade distribute
-pip --log make-check/log.txt install $NO_INDEX --use-wheel --find-links=file://$(pwd)/wheelhouse 'tox >=1.9' 
-tox > make-check/tox.out 2>&1 
+source virtualenv/bin/activate
+tox > virtualenv/tox.out 2>&1
 status=$?
-grep -v InterpreterNotFound < make-check/tox.out
+grep -v InterpreterNotFound < virtualenv/tox.out
 exit $status
index 7732a73eb51c79a31082c31ef38d8237117915f2..f00432afbd71df20a679e4a5874351852e89706a 100644 (file)
@@ -36,19 +36,9 @@ function teardown_btrfs() {
 PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}:  '
 
 export PATH=..:.:$PATH # make sure program from sources are prefered
+export PATH=../ceph-detect-init/virtualenv/bin:$PATH
+export PATH=virtualenv/bin:$PATH
 DIR=test-ceph-disk
-if virtualenv virtualenv-$DIR && test -d ceph-detect-init ; then
-    . virtualenv-$DIR/bin/activate
-    (
-       # older versions of pip will not install wrap_console scripts
-       # when using wheel packages
-       pip install --upgrade 'pip >= 6.1'
-       if test -d ceph-detect-init/wheelhouse ; then
-            wheelhouse="--no-index --use-wheel --find-links=ceph-detect-init/wheelhouse"
-       fi
-       pip --log virtualenv-$DIR/log.txt install $wheelhouse --editable ceph-detect-init
-    )
-fi
 : ${CEPH_DISK:=ceph-disk}
 OSD_DATA=$DIR/osd
 MON_ID=a
@@ -200,7 +190,7 @@ function test_path() {
 }
 
 function test_no_path() {
-    ( export PATH=..:${VIRTUAL_ENV}/bin:/usr/bin:/bin ; test_activate_dir ) || return 1
+    ( export PATH=../ceph-detect-init/virtualenv/bin:virtualenv/bin:..:/usr/bin:/bin ; test_activate_dir ) || return 1
 }
 
 function test_mark_init() {
index e14f3f8e8b294929ae284932cd5ac0a41e2a21cc..0976bee5361ab7226bc4fe5e7225a7f7cef35cf1 100644 (file)
@@ -45,3 +45,5 @@ noinst_HEADERS += \
        tools/rados/PoolDump.h \
        tools/cephfs/DataScan.h
 
+EXTRA_DIST += \
+       tools/setup-virtualenv.sh
diff --git a/src/tools/setup-virtualenv.sh b/src/tools/setup-virtualenv.sh
new file mode 100755 (executable)
index 0000000..f1c3f9a
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Copyright (C) 2016 <contact@redhat.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library Public License for more details.
+#
+
+rm -fr virtualenv
+virtualenv virtualenv
+. virtualenv/bin/activate
+# older versions of pip will not install wrap_console scripts
+# when using wheel packages
+pip --log virtualenv/log.txt install --upgrade 'pip >= 6.1'
+if test -d wheelhouse ; then
+    export NO_INDEX=--no-index
+fi
+pip --log virtualenv/log.txt install $NO_INDEX --use-wheel --find-links=file://$(pwd)/wheelhouse --upgrade distribute
+pip --log virtualenv/log.txt install $NO_INDEX --use-wheel --find-links=file://$(pwd)/wheelhouse 'tox >=1.9' 
+if test -f requirements.txt ; then
+    pip --log virtualenv/log.txt install $NO_INDEX --use-wheel --find-links=file://$(pwd)/wheelhouse -r requirements.txt
+fi