From 7d992b85d5e48691d1d9dfd2637c9747169c576d Mon Sep 17 00:00:00 2001 From: Tyler Hobbs Date: Wed, 7 May 2014 10:46:00 -0500 Subject: [PATCH] Make scales, blist optional dependencies Fixes #114 --- CHANGELOG.rst | 1 + cassandra/metrics.py | 7 ++++++- requirements.txt | 2 -- setup.py | 5 +---- test-requirements.txt | 1 + tox.ini | 1 + 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a19653b5..d0e7e129 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,7 @@ Other ----- * Don't log at ERROR when a connection is closed during the startup communications +* Mke scales, blist optional dependencies 1.1.1 ===== diff --git a/cassandra/metrics.py b/cassandra/metrics.py index 6ed8218b..dcaa1783 100644 --- a/cassandra/metrics.py +++ b/cassandra/metrics.py @@ -15,7 +15,12 @@ from itertools import chain import logging -from greplin import scales +try: + from greplin import scales +except ImportError: + raise ImportError( + "The scales library is required for metrics support: " + "https://pypi.python.org/pypi/scales") log = logging.getLogger(__name__) diff --git a/requirements.txt b/requirements.txt index 1f4212c2..b5cca97d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1 @@ -blist futures -scales diff --git a/setup.py b/setup.py index 11f7322d..7afa655f 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,6 @@ from distutils.errors import (CCompilerError, DistutilsPlatformError, from distutils.cmd import Command -import platform import os import warnings @@ -181,9 +180,7 @@ 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') + dependencies = ['futures'] setup( name='cassandra-driver', diff --git a/test-requirements.txt b/test-requirements.txt index c3abe728..25405dd2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,4 @@ +scales nose mock ccm diff --git a/tox.ini b/tox.ini index eb51cc78..0912dec4 100644 --- a/tox.ini +++ b/tox.ini @@ -8,5 +8,6 @@ deps = nose unittest2 pip PyYAML + scales commands = {envpython} setup.py build_ext --inplace nosetests --verbosity=2 tests/unit/