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
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
import warnings
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
@@ -35,7 +36,15 @@ apache_cassandra_type_prefix = 'org.apache.cassandra.db.marshal.'
|
|||||||
|
|
||||||
_number_types = frozenset((int, long, float))
|
_number_types = frozenset((int, long, float))
|
||||||
|
|
||||||
|
try:
|
||||||
from blist import sortedset
|
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:
|
try:
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|||||||
7
setup.py
7
setup.py
@@ -1,3 +1,4 @@
|
|||||||
|
import platform
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
@@ -146,6 +147,10 @@ def run_setup(extensions):
|
|||||||
kw['cmdclass']['build_ext'] = build_extensions
|
kw['cmdclass']['build_ext'] = build_extensions
|
||||||
kw['ext_modules'] = extensions
|
kw['ext_modules'] = extensions
|
||||||
|
|
||||||
|
dependencies = ['futures', 'scales', 'blist']
|
||||||
|
if platform.python_implementation() != "CPython":
|
||||||
|
dependencies.remove('blist')
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='cassandra-driver',
|
name='cassandra-driver',
|
||||||
version=__version__,
|
version=__version__,
|
||||||
@@ -156,7 +161,7 @@ def run_setup(extensions):
|
|||||||
author_email='tyler@datastax.com',
|
author_email='tyler@datastax.com',
|
||||||
packages=['cassandra', 'cassandra.io'],
|
packages=['cassandra', 'cassandra.io'],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=['futures', 'scales', 'blist'],
|
install_requires=dependencies,
|
||||||
tests_require=['nose', 'mock', 'ccm'],
|
tests_require=['nose', 'mock', 'ccm'],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 3 - Beta',
|
'Development Status :: 3 - Beta',
|
||||||
|
|||||||
Reference in New Issue
Block a user