<s> """<STR_LIT>""" <EOL> import atexit <EOL> import contextlib <EOL> import io <EOL> import os <EOL> import sys <EOL> import tempfile <EOL> import platform <EOL> try : <EOL> from setuptools import setup , Extension <EOL> except ImportError : <EOL> from distutils . core import setup , Extension <EOL> HERE = os . path . abspath ( os . path . dirname ( __file__ ) ) <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . join ( HERE , "<STR_LIT>" ) ) <EOL> import _common <EOL> def get_version ( ) : <EOL> INIT = os . path . join ( HERE , '<STR_LIT>' ) <EOL> with open ( INIT , '<STR_LIT:r>' ) as f : <EOL> for line in f : <EOL> if line . startswith ( '<STR_LIT>' ) : <EOL> ret = eval ( line . strip ( ) . split ( '<STR_LIT>' ) [ <NUM_LIT:1> ] ) <EOL> assert ret . count ( '<STR_LIT:.>' ) == <NUM_LIT:2> , ret <EOL> for num in ret . split ( '<STR_LIT:.>' ) : <EOL> assert num . isdigit ( ) , ret <EOL> return ret <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> def get_description ( ) : <EOL> README = os . path . join ( HERE , '<STR_LIT>' ) <EOL> with open ( README , '<STR_LIT:r>' ) as f : <EOL> return f . read ( ) <EOL> @ contextlib . contextmanager <EOL> def silenced_output ( stream_name ) : <EOL> class DummyFile ( io . BytesIO ) : <EOL> errors = "<STR_LIT:ignore>" <EOL> def write ( self , s ) : <EOL> pass <EOL> orig = getattr ( sys , stream_name ) <EOL> try : <EOL> setattr ( sys , stream_name , DummyFile ( ) ) <EOL> yield <EOL> finally : <EOL> setattr ( sys , stream_name , orig ) <EOL> VERSION = get_version ( ) <EOL> VERSION_MACRO = ( '<STR_LIT>' , int ( VERSION . replace ( '<STR_LIT:.>' , '<STR_LIT>' ) ) ) <EOL> if _common . POSIX : <EOL> posix_extension = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ '<STR_LIT>' ] ) <EOL> if sys . platform . startswith ( "<STR_LIT>" ) or sys . platform . startswith ( "<STR_LIT>" ) : <EOL> posix_extension . libraries . append ( '<STR_LIT>' ) <EOL> if platform . release ( ) == '<STR_LIT>' : <EOL> posix_extension . sources . append ( '<STR_LIT>' ) <EOL> posix_extension . define_macros . append ( ( '<STR_LIT>' , <NUM_LIT:1> ) ) <EOL> if _common . WINDOWS : <EOL> def get_winver ( ) : <EOL> maj , min = sys . getwindowsversion ( ) [ <NUM_LIT:0> : <NUM_LIT:2> ] <EOL> return '<STR_LIT>' % ( ( maj * <NUM_LIT:100> ) + min ) <EOL> ext = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> define_macros = [ <EOL> VERSION_MACRO , <EOL> ( '<STR_LIT>' , get_winver ( ) ) , <EOL> ( '<STR_LIT>' , get_winver ( ) ) , <EOL> ( '<STR_LIT>' , None ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:1> ) , <EOL> ] , <EOL> libraries = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> ] , <EOL> ) <EOL> extensions = [ ext ] <EOL> elif _common . OSX : <EOL> ext = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> define_macros = [ VERSION_MACRO ] , <EOL> extra_link_args = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ] ) <EOL> extensions = [ ext , posix_extension ] <EOL> elif _common . FREEBSD : <EOL> ext = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> define_macros = [ VERSION_MACRO ] , <EOL> libraries = [ "<STR_LIT>" ] ) <EOL> extensions = [ ext , posix_extension ] <EOL> elif _common . OPENBSD : <EOL> ext = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> define_macros = [ VERSION_MACRO ] , <EOL> libraries = [ "<STR_LIT>" ] ) <EOL> extensions = [ ext , posix_extension ] <EOL> elif _common . NETBSD : <EOL> ext = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> define_macros = [ VERSION_MACRO ] , <EOL> libraries = [ "<STR_LIT>" ] ) <EOL> extensions = [ ext , posix_extension ] <EOL> elif _common . LINUX : <EOL> def get_ethtool_macro ( ) : <EOL> from distutils . unixccompiler import UnixCCompiler <EOL> from distutils . errors import CompileError <EOL> with tempfile . NamedTemporaryFile ( <EOL> suffix = '<STR_LIT>' , delete = False , mode = "<STR_LIT>" ) as f : <EOL> f . write ( "<STR_LIT>" ) <EOL> @ atexit . register <EOL> def on_exit ( ) : <EOL> try : <EOL> os . remove ( f . name ) <EOL> except OSError : <EOL> pass <EOL> compiler = UnixCCompiler ( ) <EOL> try : <EOL> with silenced_output ( '<STR_LIT>' ) : <EOL> with silenced_output ( '<STR_LIT>' ) : <EOL> compiler . compile ( [ f . name ] ) <EOL> except CompileError : <EOL> return ( "<STR_LIT>" , <NUM_LIT:1> ) <EOL> else : <EOL> return None <EOL> ETHTOOL_MACRO = get_ethtool_macro ( ) <EOL> macros = [ VERSION_MACRO ] <EOL> if ETHTOOL_MACRO is not None : <EOL> macros . append ( ETHTOOL_MACRO ) <EOL> ext = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ '<STR_LIT>' ] , <EOL> define_macros = macros ) <EOL> extensions = [ ext , posix_extension ] <EOL> elif _common . SUNOS : <EOL> ext = Extension ( <EOL> '<STR_LIT>' , <EOL> sources = [ '<STR_LIT>' ] , <EOL> define_macros = [ VERSION_MACRO ] , <EOL> libraries = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> extensions = [ ext , posix_extension ] <EOL> else : <EOL> sys . exit ( '<STR_LIT>' % sys . platform ) <EOL> def main ( ) : <EOL> setup_args = dict ( <EOL> name = '<STR_LIT>' , <EOL> version = VERSION , <EOL> description = __doc__ . replace ( '<STR_LIT:\n>' , '<STR_LIT>' ) . strip ( ) , <EOL> long_description = get_description ( ) , <EOL> keywords = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> ] , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> platforms = '<STR_LIT>' , <EOL> license = '<STR_LIT>' , <EOL> packages = [ '<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> '<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> '<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> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> ) <EOL> if extensions is not None : <EOL> setup_args [ "<STR_LIT>" ] = extensions <EOL> setup ( ** setup_args ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
