<s> import os <EOL> import sys <EOL> from distutils . core import setup <EOL> from distutils . core import Command <EOL> from unittest import TextTestRunner , TestLoader <EOL> from glob import glob <EOL> from os . path import splitext , basename , join as pjoin <EOL> import libcloud . utils <EOL> libcloud . utils . SHOW_DEPRECATION_WARNING = False <EOL> HTML_VIEWSOURCE_BASE = '<STR_LIT>' <EOL> PROJECT_BASE_DIR = '<STR_LIT>' <EOL> TEST_PATHS = [ '<STR_LIT:test>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class TestCommand ( Command ) : <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> THIS_DIR = os . path . abspath ( os . path . split ( __file__ ) [ <NUM_LIT:0> ] ) <EOL> sys . path . insert ( <NUM_LIT:0> , THIS_DIR ) <EOL> for test_path in TEST_PATHS : <EOL> sys . path . insert ( <NUM_LIT:0> , pjoin ( THIS_DIR , test_path ) ) <EOL> self . _dir = os . getcwd ( ) <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> status = self . _run_tests ( ) <EOL> sys . exit ( status ) <EOL> def _run_tests ( self ) : <EOL> secrets = pjoin ( self . _dir , '<STR_LIT:test>' , '<STR_LIT>' ) <EOL> if not os . path . isfile ( secrets ) : <EOL> print "<STR_LIT>" % ( secrets ) <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> pre_python26 = ( sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> <EOL> and sys . version_info [ <NUM_LIT:1> ] < <NUM_LIT:6> ) <EOL> if pre_python26 : <EOL> missing = [ ] <EOL> try : <EOL> import simplejson <EOL> except ImportError : <EOL> missing . append ( "<STR_LIT>" ) <EOL> try : <EOL> import ssl <EOL> except ImportError : <EOL> missing . append ( "<STR_LIT>" ) <EOL> if missing : <EOL> print "<STR_LIT>" % "<STR_LIT:U+002CU+0020>" . join ( missing ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> testfiles = [ ] <EOL> for test_path in TEST_PATHS : <EOL> for t in glob ( pjoin ( self . _dir , test_path , '<STR_LIT>' ) ) : <EOL> testfiles . append ( '<STR_LIT:.>' . join ( <EOL> [ test_path . replace ( '<STR_LIT:/>' , '<STR_LIT:.>' ) , splitext ( basename ( t ) ) [ <NUM_LIT:0> ] ] ) <EOL> ) <EOL> tests = TestLoader ( ) . loadTestsFromNames ( testfiles ) <EOL> t = TextTestRunner ( verbosity = <NUM_LIT:2> ) <EOL> res = t . run ( tests ) <EOL> return not res . wasSuccessful ( ) <EOL> class ApiDocsCommand ( Command ) : <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> os . system ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> % ( HTML_VIEWSOURCE_BASE , PROJECT_BASE_DIR ) <EOL> ) <EOL> class CoverageCommand ( Command ) : <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> import coverage <EOL> cov = coverage . coverage ( config_file = '<STR_LIT>' ) <EOL> cov . start ( ) <EOL> tc = TestCommand ( self . distribution ) <EOL> tc . _run_tests ( ) <EOL> cov . stop ( ) <EOL> cov . save ( ) <EOL> cov . html_report ( ) <EOL> pre_python26 = ( sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> and sys . version_info [ <NUM_LIT:1> ] < <NUM_LIT:6> ) <EOL> setup ( <EOL> name = '<STR_LIT>' , <EOL> version = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> requires = ( [ ] , [ '<STR_LIT>' , '<STR_LIT>' ] , ) [ pre_python26 ] , <EOL> packages = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> package_dir = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } , <EOL> license = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> cmdclass = { <EOL> '<STR_LIT:test>' : TestCommand , <EOL> '<STR_LIT>' : ApiDocsCommand , <EOL> '<STR_LIT>' : CoverageCommand <EOL> } , <EOL> classifiers = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] , <EOL> ) </s>
