-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconfig.sh
More file actions
118 lines (91 loc) · 3.51 KB
/
config.sh
File metadata and controls
118 lines (91 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Define custom utilities
# Test for OSX with [ -n "$IS_OSX" ]
LIBEV_VERSION=4.24
function pre_build {
# Any stuff that you need to do before you start building the wheels
# Runs in the root directory of this repository.
:
curl -o libev-${LIBEV_VERSION}.tar.gz http://dist.schmorp.de/libev/Attic/libev-${LIBEV_VERSION}.tar.gz
tar -xzf libev-${LIBEV_VERSION}.tar.gz
pushd libev-${LIBEV_VERSION}/
if (./configure); then
echo "Build succeeded, continuing with install"
make
make install
popd
else
echo "Build failed, trying to display config.log"
cat config.log
exit 1
fi
}
function run_tests {
# Runs tests on installed distribution from an empty directory
echo "Running cassandra-driver verification tests"
cat << 'EOF' > verify_driver_installation.py
import re
import cassandra
from cassandra.protocol import cython_protocol_handler
def name_from_module(module):
return module.__name__.split(".")[1]
def module_to_cythonized_file(module):
return name_from_module(module) + ".so"
def assert_module_file(module):
cython_module_file = module_to_cythonized_file(module)
cython_module_name = name_from_module(module)
# This would match for example
# site-packages/cassandra/cluster.so
if module.__file__.endswith(cython_module_file):
return
# This would match
# site-packages/cassandra/cluster.cpython-34m.so
if re.match(r'.*{}.*\.so$'.format(cython_module_name), module.__file__):
return
raise AssertionError("File being used is {}, "
"it should have matched with {}".format(module.__file__, cython_module_file))
def load_module(module_name):
__import__("cassandra." + module_name)
return eval("cassandra." + module_name)
########################################
# Verify cython extensions
########################################
# Files that will be cythonized
# This modules should be imported from a file finished in .so
cython_candidates = ['cluster', 'concurrent', 'connection', 'cqltypes', 'pool', 'metadata', 'protocol', 'query', 'util']
# Cython files
#type_codes is missing from here, not sure why but it looks like it's never cythonized
cython_files = ['bytesio', 'cython_marshal', 'cython_utils', 'deserializers', 'ioutils', 'obj_parser',
'parsing', 'row_parser'] # 'type_codes']
files_to_check = cython_candidates + cython_files
modules_to_assert = (load_module(module) for module in cython_candidates)
for module in modules_to_assert:
assert_module_file(module)
from cassandra.obj_parser import ListParser, LazyParser
ProtocolHandler = cython_protocol_handler(ListParser())
LazyProtocolHandler = cython_protocol_handler(LazyParser())
########################################
# Verify numpy extensions
########################################
try:
import numpy
HAVE_NUMPY = True
except ImportError:
HAVE_NUMPY = False
if HAVE_NUMPY:
assert_module_file(load_module("numpy_parser"))
from cassandra.numpy_parser import NumpyParser
NumpyProtocolHandler = cython_protocol_handler(NumpyParser())
########################################
# Verify murmur3
########################################
from cassandra.cmurmur3 import murmur3
assert murmur3("key") == -6847573755651342660
########################################
# Verify libev
########################################
import cassandra.io.libevwrapper as libev
loop = libev.Loop()
EOF
python verify_driver_installation.py
echo "Driver verification tests completed successfully"
}