<s> from __future__ import print_function <EOL> import os <EOL> import sys <EOL> import warnings <EOL> if __name__ == '<STR_LIT:__main__>' and sys . argv [ <NUM_LIT:1> ] == "<STR_LIT>" : <EOL> print ( "<STR_LIT>" ) <EOL> from gevent . monkey import patch_all <EOL> patch_all ( ) <EOL> if __name__ == '<STR_LIT:__main__>' and sys . argv [ <NUM_LIT:1> ] == "<STR_LIT>" : <EOL> print ( "<STR_LIT>" ) <EOL> from eventlet import monkey_patch <EOL> monkey_patch ( ) <EOL> import ez_setup <EOL> ez_setup . use_setuptools ( ) <EOL> from setuptools import setup <EOL> from distutils . command . build_ext import build_ext <EOL> from distutils . core import Extension <EOL> from distutils . errors import ( CCompilerError , DistutilsPlatformError , <EOL> DistutilsExecError ) <EOL> from distutils . cmd import Command <EOL> PY3 = sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:3> <EOL> try : <EOL> import subprocess <EOL> has_subprocess = True <EOL> except ImportError : <EOL> has_subprocess = False <EOL> from cassandra import __version__ <EOL> long_description = "<STR_LIT>" <EOL> with open ( "<STR_LIT>" ) as f : <EOL> long_description = f . read ( ) <EOL> try : <EOL> from nose . commands import nosetests <EOL> except ImportError : <EOL> gevent_nosetests = None <EOL> eventlet_nosetests = None <EOL> else : <EOL> class gevent_nosetests ( nosetests ) : <EOL> description = "<STR_LIT>" <EOL> class eventlet_nosetests ( nosetests ) : <EOL> description = "<STR_LIT>" <EOL> has_cqlengine = False <EOL> if __name__ == '<STR_LIT:__main__>' and sys . argv [ <NUM_LIT:1> ] == "<STR_LIT>" : <EOL> try : <EOL> import cqlengine <EOL> has_cqlengine = True <EOL> except ImportError : <EOL> pass <EOL> PROFILING = False <EOL> class DocCommand ( Command ) : <EOL> description = "<STR_LIT>" <EOL> user_options = [ ( "<STR_LIT:test>" , "<STR_LIT:t>" , <EOL> "<STR_LIT>" ) ] <EOL> boolean_options = [ "<STR_LIT:test>" ] <EOL> def initialize_options ( self ) : <EOL> self . test = False <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> if self . test : <EOL> path = "<STR_LIT>" <EOL> mode = "<STR_LIT>" <EOL> else : <EOL> path = "<STR_LIT>" % __version__ <EOL> mode = "<STR_LIT:html>" <EOL> try : <EOL> os . makedirs ( path ) <EOL> except : <EOL> pass <EOL> if has_subprocess : <EOL> import glob <EOL> for f in glob . glob ( "<STR_LIT>" ) : <EOL> print ( "<STR_LIT>" % ( f , ) ) <EOL> os . unlink ( f ) <EOL> try : <EOL> output = subprocess . check_output ( <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , <EOL> stderr = subprocess . STDOUT ) <EOL> except subprocess . CalledProcessError as exc : <EOL> raise RuntimeError ( "<STR_LIT>" % ( "<STR_LIT>" , exc , exc . output ) ) <EOL> else : <EOL> print ( output ) <EOL> try : <EOL> output = subprocess . check_output ( <EOL> [ "<STR_LIT>" , "<STR_LIT>" , mode , "<STR_LIT>" , path ] , <EOL> stderr = subprocess . STDOUT ) <EOL> except subprocess . CalledProcessError as exc : <EOL> raise RuntimeError ( "<STR_LIT>" % ( mode , exc , exc . output ) ) <EOL> else : <EOL> print ( output ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" % mode ) <EOL> print ( "<STR_LIT>" % ( os . path . dirname ( os . path . realpath ( __file__ ) ) , path ) ) <EOL> class BuildFailed ( Exception ) : <EOL> def __init__ ( self , ext ) : <EOL> self . ext = ext <EOL> murmur3_ext = Extension ( '<STR_LIT>' , <EOL> sources = [ '<STR_LIT>' ] ) <EOL> libev_ext = Extension ( '<STR_LIT>' , <EOL> sources = [ '<STR_LIT>' ] , <EOL> include_dirs = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> libraries = [ '<STR_LIT>' ] , <EOL> library_dirs = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> platform_unsupported_msg = """<STR_LIT>""" <EOL> arch_unsupported_msg = """<STR_LIT>""" <EOL> pypy_unsupported_msg = """<STR_LIT>""" <EOL> is_windows = os . name == '<STR_LIT>' <EOL> is_pypy = "<STR_LIT>" in sys . version <EOL> if is_pypy : <EOL> sys . stderr . write ( pypy_unsupported_msg ) <EOL> is_supported_platform = sys . platform != "<STR_LIT>" and not sys . platform . startswith ( "<STR_LIT>" ) <EOL> is_supported_arch = sys . byteorder != "<STR_LIT>" <EOL> if not is_supported_platform : <EOL> sys . stderr . write ( platform_unsupported_msg ) <EOL> elif not is_supported_arch : <EOL> sys . stderr . write ( arch_unsupported_msg ) <EOL> try_extensions = "<STR_LIT>" not in sys . argv and is_supported_platform and is_supported_arch and not os . environ . get ( '<STR_LIT>' ) <EOL> try_murmur3 = try_extensions and "<STR_LIT>" not in sys . argv <EOL> try_libev = try_extensions and "<STR_LIT>" not in sys . argv and not is_pypy and not is_windows <EOL> try_cython = try_extensions and "<STR_LIT>" not in sys . argv and not is_pypy and not os . environ . get ( '<STR_LIT>' ) <EOL> try_cython &= '<STR_LIT>' not in sys . argv <EOL> sys . argv = [ a for a in sys . argv if a not in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ] <EOL> build_concurrency = int ( os . environ . get ( '<STR_LIT>' , '<STR_LIT:0>' ) ) <EOL> class NoPatchExtension ( Extension ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> if Extension . __bases__ : <EOL> base , = Extension . __bases__ <EOL> base . __init__ ( self , * args , ** kwargs ) <EOL> else : <EOL> Extension . __init__ ( self , * args , ** kwargs ) <EOL> class build_extensions ( build_ext ) : <EOL> error_message = """<STR_LIT>""" if is_windows else """<STR_LIT>""" <EOL> def run ( self ) : <EOL> try : <EOL> self . _setup_extensions ( ) <EOL> build_ext . run ( self ) <EOL> except DistutilsPlatformError as exc : <EOL> sys . stderr . write ( '<STR_LIT>' % str ( exc ) ) <EOL> warnings . warn ( self . error_message % "<STR_LIT>" ) <EOL> def build_extensions ( self ) : <EOL> if build_concurrency > <NUM_LIT:1> : <EOL> self . check_extensions_list ( self . extensions ) <EOL> import multiprocessing . pool <EOL> multiprocessing . pool . ThreadPool ( processes = build_concurrency ) . map ( self . build_extension , self . extensions ) <EOL> else : <EOL> build_ext . build_extensions ( self ) <EOL> def build_extension ( self , ext ) : <EOL> try : <EOL> build_ext . build_extension ( self , ext ) <EOL> except ( CCompilerError , DistutilsExecError , <EOL> DistutilsPlatformError , IOError ) as exc : <EOL> sys . stderr . write ( '<STR_LIT>' % str ( exc ) ) <EOL> name = "<STR_LIT>" % ( ext . name , ) <EOL> warnings . warn ( self . error_message % ( name , ) ) <EOL> def _setup_extensions ( self ) : <EOL> self . extensions = [ ] <EOL> if try_murmur3 : <EOL> self . extensions . append ( murmur3_ext ) <EOL> if try_libev : <EOL> self . extensions . append ( libev_ext ) <EOL> if try_cython : <EOL> try : <EOL> from Cython . Build import cythonize <EOL> cython_candidates = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> compile_args = [ ] if is_windows else [ '<STR_LIT>' ] <EOL> self . extensions . extend ( cythonize ( <EOL> [ Extension ( '<STR_LIT>' % m , [ '<STR_LIT>' % m ] , <EOL> extra_compile_args = compile_args ) <EOL> for m in cython_candidates ] , <EOL> nthreads = build_concurrency , <EOL> exclude_failures = True ) ) <EOL> self . extensions . extend ( cythonize ( NoPatchExtension ( "<STR_LIT:*>" , [ "<STR_LIT>" ] , extra_compile_args = compile_args ) , <EOL> nthreads = build_concurrency ) ) <EOL> except Exception : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> def pre_build_check ( ) : <EOL> """<STR_LIT>""" <EOL> if os . environ . get ( '<STR_LIT>' ) : <EOL> return True <EOL> try : <EOL> from distutils . ccompiler import new_compiler <EOL> from distutils . sysconfig import customize_compiler <EOL> from distutils . dist import Distribution <EOL> be = build_ext ( Distribution ( ) ) <EOL> be . initialize_options ( ) <EOL> be . finalize_options ( ) <EOL> have_python_include = any ( os . path . isfile ( os . path . join ( p , '<STR_LIT>' ) ) for p in be . include_dirs ) <EOL> if not have_python_include : <EOL> sys . stderr . write ( "<STR_LIT>" % ( be . include_dirs , ) ) <EOL> return False <EOL> compiler = new_compiler ( compiler = be . compiler ) <EOL> customize_compiler ( compiler ) <EOL> executables = [ ] <EOL> if compiler . compiler_type in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> executables = [ compiler . executables [ exe ] [ <NUM_LIT:0> ] for exe in ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> elif compiler . compiler_type == '<STR_LIT>' : <EOL> executables = [ getattr ( compiler , exe ) for exe in ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> if executables : <EOL> from distutils . spawn import find_executable <EOL> for exe in executables : <EOL> if not find_executable ( exe ) : <EOL> sys . stderr . write ( "<STR_LIT>" % ( exe , compiler . compiler_type ) ) <EOL> return False <EOL> except Exception as exc : <EOL> sys . stderr . write ( '<STR_LIT>' % str ( exc ) ) <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> return True <EOL> def run_setup ( extensions ) : <EOL> kw = { '<STR_LIT>' : { '<STR_LIT>' : DocCommand } } <EOL> if gevent_nosetests is not None : <EOL> kw [ '<STR_LIT>' ] [ '<STR_LIT>' ] = gevent_nosetests <EOL> if eventlet_nosetests is not None : <EOL> kw [ '<STR_LIT>' ] [ '<STR_LIT>' ] = eventlet_nosetests <EOL> kw [ '<STR_LIT>' ] [ '<STR_LIT>' ] = build_extensions <EOL> kw [ '<STR_LIT>' ] = [ Extension ( '<STR_LIT>' , [ ] ) ] <EOL> if try_cython : <EOL> if pre_build_check ( ) : <EOL> kw [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> else : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> dependencies = [ '<STR_LIT>' ] <EOL> if not PY3 : <EOL> dependencies . append ( '<STR_LIT>' ) <EOL> setup ( <EOL> name = '<STR_LIT>' , <EOL> version = __version__ , <EOL> description = '<STR_LIT>' , <EOL> long_description = long_description , <EOL> url = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> packages = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> keywords = '<STR_LIT>' , <EOL> include_package_data = True , <EOL> install_requires = dependencies , <EOL> tests_require = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> classifiers = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] , <EOL> ** kw ) <EOL> run_setup ( None ) <EOL> if has_cqlengine : <EOL> warnings . warn ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % cqlengine . __file__ ) </s>
