Handle no blist on non-cpython
blist provides the sortedset class, but it's not currently compatible with pypy. This marks blist as a dependency only when using cpython and gracefully handles blist not being installed with a warning and the use of 'set' instead of 'sortedset'.
This commit is contained in:
@@ -20,6 +20,7 @@ import socket
|
||||
import time
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
import warnings
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
@@ -35,7 +36,15 @@ apache_cassandra_type_prefix = 'org.apache.cassandra.db.marshal.'
|
||||
|
||||
_number_types = frozenset((int, long, float))
|
||||
|
||||
from blist import sortedset
|
||||
try:
|
||||
from blist import sortedset
|
||||
except ImportError:
|
||||
warnings.warn(
|
||||
"The blist library is not available, so a normal set will "
|
||||
"be used in place of blist.sortedset for set collection values. "
|
||||
"You can find the blist library here: https://pypi.python.org/pypi/blist/")
|
||||
|
||||
sortedset = set
|
||||
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
|
||||
7
setup.py
7
setup.py
@@ -1,3 +1,4 @@
|
||||
import platform
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
@@ -146,6 +147,10 @@ def run_setup(extensions):
|
||||
kw['cmdclass']['build_ext'] = build_extensions
|
||||
kw['ext_modules'] = extensions
|
||||
|
||||
dependencies = ['futures', 'scales', 'blist']
|
||||
if platform.python_implementation() != "CPython":
|
||||
dependencies.remove('blist')
|
||||
|
||||
setup(
|
||||
name='cassandra-driver',
|
||||
version=__version__,
|
||||
@@ -156,7 +161,7 @@ def run_setup(extensions):
|
||||
author_email='tyler@datastax.com',
|
||||
packages=['cassandra', 'cassandra.io'],
|
||||
include_package_data=True,
|
||||
install_requires=['futures', 'scales', 'blist'],
|
||||
install_requires=dependencies,
|
||||
tests_require=['nose', 'mock', 'ccm'],
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Beta',
|
||||
|
||||
Reference in New Issue
Block a user