summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2016-12-07 03:25:04 +0000
committerTim Burke <tim.burke@gmail.com>2017-05-03 16:28:32 -0700
commita514c89d888fc6677d4c988f297563616eaf2e82 (patch)
treeee67af127a355845805e25234e797ab0488f426e
parentebaffcdfc14ba8d2aea2e39100d0e1e53d40aefa (diff)
downloadpyeclib-a514c89d888fc6677d4c988f297563616eaf2e82.tar.gz
Add tox environment to test against liberasurecode master
Go clone liberasurecode to our tox env directory, install it there, and tell setuptools/distutils to use it. To checkout something *other* than tip-of-master, set LIBERASURECODE_REF to the remote ref you're interested in. Change-Id: I13417e058a340ba0d4a79080f0e05dea1be193fc
-rw-r--r--bindep.txt3
-rw-r--r--setup.py14
-rwxr-xr-xtools/pip-install-with-liberasurecode.sh23
-rw-r--r--tox.ini7
4 files changed, 47 insertions, 0 deletions
diff --git a/bindep.txt b/bindep.txt
index 9302ef5..ea8cf54 100644
--- a/bindep.txt
+++ b/bindep.txt
@@ -4,6 +4,9 @@
build-essential [platform:dpkg]
gcc [platform:rpm]
make [platform:rpm]
+autoconf
+automake
+libtool
liberasurecode-dev [platform:dpkg]
liberasurecode-devel [platform:rpm]
python-dev [platform:dpkg]
diff --git a/setup.py b/setup.py
index 81c1968..ecc9534 100644
--- a/setup.py
+++ b/setup.py
@@ -55,6 +55,18 @@ default_python_incdir = get_python_inc()
def _find_library(name):
target_lib = find_library(name)
if platform_str.find("Darwin") > -1:
+ # If we didn't find it, try extending our search a bit
+ if not target_lib:
+ if 'DYLD_LIBRARY_PATH' in os.environ:
+ os.environ['DYLD_LIBRARY_PATH'] += ':%s/lib' % sys.prefix
+ else:
+ os.environ['DYLD_LIBRARY_PATH'] = '%s/lib' % sys.prefix
+ target_lib = find_library(name)
+
+ # If we *still* don't find it, bail
+ if not target_lib:
+ return target_lib
+
target_lib = os.path.abspath(target_lib)
if os.path.islink(target_lib):
p = os.readlink(target_lib)
@@ -167,6 +179,8 @@ module = Extension('pyeclib_c',
'%s/include/liberasurecode' % sys.prefix,
'%s/include' % sys.prefix],
libraries=['erasurecode'],
+ library_dirs=['%s/lib' % sys.prefix],
+ runtime_library_dirs=['%s/lib' % sys.prefix],
# The extra arguments are for debugging
# extra_compile_args=['-g', '-O0'],
sources=['src/c/pyeclib_c/pyeclib_c.c'])
diff --git a/tools/pip-install-with-liberasurecode.sh b/tools/pip-install-with-liberasurecode.sh
new file mode 100755
index 0000000..2be036f
--- /dev/null
+++ b/tools/pip-install-with-liberasurecode.sh
@@ -0,0 +1,23 @@
+#!/bin/bash -xe
+if [ -z "$VIRTUAL_ENV" ]; then
+ echo "Expected VIRTUAL_ENV to be set!"
+ exit 1
+fi
+if [ -z "$LIBERASURECODE_DIR" ]; then
+ echo "Expected LIBERASURECODE_DIR to be set!"
+ exit 1
+fi
+if [ ! -d "$LIBERASURECODE_DIR" ]; then
+ git clone git://git.openstack.org/openstack/liberasurecode "$LIBERASURECODE_DIR"
+fi
+pushd "$LIBERASURECODE_DIR"
+if [ -n "$LIBERASURECODE_REF" ]; then
+ git fetch origin "$LIBERASURECODE_REF"
+ git checkout FETCH_HEAD
+fi
+./autogen.sh
+./configure --prefix "$VIRTUAL_ENV"
+make
+make install
+popd
+pip install "$@"
diff --git a/tox.ini b/tox.ini
index ccb36ed..bf54142 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,7 +7,14 @@ deps =
commands=
nosetests -v test/
+[testenv:liberasurecode-git]
+setenv = LIBERASURECODE_DIR={envdir}/liberasurecode
+passenv = LIBERASURECODE_REF
+install_command =
+ {toxinidir}/tools/pip-install-with-liberasurecode.sh {opts} {packages}
+
[testenv:pep8]
+skip_install = True
deps=
pep8
commands=