<s> """<STR_LIT>""" <EOL> import distutils . command <EOL> try : <EOL> import distutils . command . bdist_msi <EOL> except ImportError : <EOL> distutils . command . bdist_msi = None <EOL> try : <EOL> import distutils . command . bdist_wininst <EOL> except ImportError : <EOL> distutils . command . bdist_wininst = None <EOL> import distutils . command . bdist_rpm <EOL> import distutils . command . build <EOL> import distutils . core <EOL> import distutils . dist <EOL> import distutils . util <EOL> import os <EOL> import re <EOL> import struct <EOL> import sys <EOL> from distutils . errors import DistutilsSetupError <EOL> try : <EOL> from setuptools import setup , Extension <EOL> except : <EOL> from distutils . core import setup <EOL> from distutils . extension import Extension <EOL> BUILD_VERSION = "<STR_LIT>" <EOL> dataFiles = None <EOL> if sys . platform in ( "<STR_LIT:win32>" , "<STR_LIT>" ) : <EOL> baseName = "<STR_LIT>" <EOL> dataFiles = [ ( baseName , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) ] <EOL> for dir in ( "<STR_LIT:html>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:test>" ) : <EOL> files = [ ] <EOL> fullDirName = "<STR_LIT>" % ( baseName , dir ) <EOL> for name in os . listdir ( dir ) : <EOL> if name . startswith ( "<STR_LIT:.>" ) : <EOL> continue <EOL> if os . path . isdir ( os . path . join ( dir , name ) ) : <EOL> continue <EOL> fullName = "<STR_LIT>" % ( dir , name ) <EOL> files . append ( fullName ) <EOL> dataFiles . append ( ( fullDirName , files ) ) <EOL> docFiles = "<STR_LIT>" <EOL> def CheckOracleHome ( directoryToCheck ) : <EOL> global oracleHome , oracleVersion , oracleLibDir <EOL> import os <EOL> import struct <EOL> import sys <EOL> if sys . platform in ( "<STR_LIT:win32>" , "<STR_LIT>" ) : <EOL> subDirs = [ "<STR_LIT>" ] <EOL> filesToCheck = [ <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ] <EOL> elif sys . platform == "<STR_LIT>" : <EOL> subDirs = [ "<STR_LIT>" ] <EOL> filesToCheck = [ <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ] <EOL> else : <EOL> if struct . calcsize ( "<STR_LIT:P>" ) == <NUM_LIT:4> : <EOL> subDirs = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> else : <EOL> subDirs = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> filesToCheck = [ <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ] <EOL> for version , baseFileName in filesToCheck : <EOL> fileName = os . path . join ( directoryToCheck , baseFileName ) <EOL> if os . path . exists ( fileName ) : <EOL> if os . path . basename ( directoryToCheck ) . lower ( ) == "<STR_LIT>" : <EOL> oracleHome = os . path . dirname ( directoryToCheck ) <EOL> else : <EOL> oracleHome = directoryToCheck <EOL> oracleLibDir = directoryToCheck <EOL> oracleVersion = version <EOL> return True <EOL> for subDir in subDirs : <EOL> fileName = os . path . join ( directoryToCheck , subDir , baseFileName ) <EOL> if os . path . exists ( fileName ) : <EOL> oracleHome = directoryToCheck <EOL> oracleLibDir = os . path . join ( directoryToCheck , subDir ) <EOL> oracleVersion = version <EOL> return True <EOL> dirName = os . path . dirname ( directoryToCheck ) <EOL> fileName = os . path . join ( dirName , subDir , baseFileName ) <EOL> if os . path . exists ( fileName ) : <EOL> oracleHome = dirName <EOL> oracleLibDir = os . path . join ( dirName , subDir ) <EOL> oracleVersion = version <EOL> return True <EOL> oracleHome = oracleVersion = oracleLibDir = None <EOL> return False <EOL> userOracleHome = os . environ . get ( "<STR_LIT>" , os . environ . get ( "<STR_LIT>" ) ) <EOL> if userOracleHome is not None : <EOL> if not CheckOracleHome ( userOracleHome ) : <EOL> messageFormat = "<STR_LIT>" "<STR_LIT>" <EOL> raise DistutilsSetupError ( messageFormat % userOracleHome ) <EOL> else : <EOL> for path in os . environ [ "<STR_LIT>" ] . split ( os . pathsep ) : <EOL> if CheckOracleHome ( path ) : <EOL> break <EOL> if oracleHome is None : <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> if sys . platform == "<STR_LIT:win32>" : <EOL> libDirs = [ os . path . join ( oracleHome , "<STR_LIT>" ) , oracleHome , <EOL> os . path . join ( oracleHome , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> os . path . join ( oracleHome , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ] <EOL> possibleIncludeDirs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> includeDirs = [ ] <EOL> for dir in possibleIncludeDirs : <EOL> path = os . path . normpath ( os . path . join ( oracleHome , dir ) ) <EOL> if os . path . isdir ( path ) : <EOL> includeDirs . append ( path ) <EOL> if not includeDirs : <EOL> message = "<STR_LIT>" % oracleHome <EOL> raise DistutilsSetupError ( message ) <EOL> libs = [ "<STR_LIT>" ] <EOL> elif sys . platform == "<STR_LIT>" : <EOL> includeDirs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> libDirs = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> for i in range ( len ( includeDirs ) ) : <EOL> includeDirs [ i ] = os . path . join ( oracleHome , includeDirs [ i ] ) <EOL> for i in range ( len ( libDirs ) ) : <EOL> libDirs [ i ] = os . path . join ( oracleHome , libDirs [ i ] ) <EOL> libs = [ "<STR_LIT>" ] <EOL> else : <EOL> libDirs = [ oracleLibDir ] <EOL> libs = [ "<STR_LIT>" ] <EOL> possibleIncludeDirs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> if sys . platform == "<STR_LIT>" : <EOL> possibleIncludeDirs . append ( "<STR_LIT>" ) <EOL> includeDirs = [ ] <EOL> for dir in possibleIncludeDirs : <EOL> path = os . path . join ( oracleHome , dir ) <EOL> if os . path . isdir ( path ) : <EOL> includeDirs . append ( path ) <EOL> if not includeDirs : <EOL> path = os . path . join ( oracleLibDir , "<STR_LIT>" ) <EOL> if os . path . isdir ( path ) : <EOL> includeDirs . append ( path ) <EOL> if not includeDirs : <EOL> path = re . sub ( "<STR_LIT>" , "<STR_LIT>" , oracleHome ) <EOL> if os . path . isdir ( path ) : <EOL> includeDirs . append ( path ) <EOL> if not includeDirs : <EOL> raise DistutilsSetupError ( "<STR_LIT>" ) <EOL> extraCompileArgs = [ "<STR_LIT>" % BUILD_VERSION ] <EOL> extraLinkArgs = [ ] <EOL> if sys . platform == "<STR_LIT>" : <EOL> extraCompileArgs . append ( "<STR_LIT>" ) <EOL> elif sys . platform == "<STR_LIT>" : <EOL> extraCompileArgs . append ( "<STR_LIT>" ) <EOL> elif sys . platform == "<STR_LIT>" : <EOL> extraCompileArgs . append ( "<STR_LIT>" ) <EOL> extraLinkArgs . append ( "<STR_LIT>" ) <EOL> elif sys . platform == "<STR_LIT>" : <EOL> extraLinkArgs . append ( "<STR_LIT>" ) <EOL> if "<STR_LIT>" in os . environ : <EOL> extraLinkArgs . append ( "<STR_LIT>" % oracleLibDir ) <EOL> class Distribution ( distutils . dist . Distribution ) : <EOL> def get_fullname_with_oracle_version ( self ) : <EOL> name = self . metadata . get_fullname ( ) <EOL> return "<STR_LIT>" % ( name , oracleVersion ) <EOL> class bdist_rpm ( distutils . command . bdist_rpm . bdist_rpm ) : <EOL> def run ( self ) : <EOL> distutils . command . bdist_rpm . bdist_rpm . run ( self ) <EOL> specFile = os . path . join ( self . rpm_base , "<STR_LIT>" , <EOL> "<STR_LIT>" % self . distribution . get_name ( ) ) <EOL> queryFormat = "<STR_LIT>" <EOL> command = "<STR_LIT>" % ( queryFormat , specFile ) <EOL> origFileName = os . popen ( command ) . read ( ) <EOL> parts = origFileName . split ( "<STR_LIT:->" ) <EOL> parts . insert ( <NUM_LIT:2> , oracleVersion ) <EOL> parts . insert ( <NUM_LIT:3> , "<STR_LIT>" % sys . version_info [ : <NUM_LIT:2> ] ) <EOL> newFileName = "<STR_LIT:->" . join ( parts ) <EOL> self . move_file ( os . path . join ( "<STR_LIT>" , origFileName ) , <EOL> os . path . join ( "<STR_LIT>" , newFileName ) ) <EOL> class build ( distutils . command . build . build ) : <EOL> def finalize_options ( self ) : <EOL> import distutils . util <EOL> import os <EOL> import sys <EOL> platSpecifier = "<STR_LIT>" % ( distutils . util . get_platform ( ) , sys . version [ <NUM_LIT:0> : <NUM_LIT:3> ] , <EOL> oracleVersion ) <EOL> if self . build_platlib is None : <EOL> self . build_platlib = os . path . join ( self . build_base , <EOL> "<STR_LIT>" % platSpecifier ) <EOL> if self . build_temp is None : <EOL> self . build_temp = os . path . join ( self . build_base , <EOL> "<STR_LIT>" % platSpecifier ) <EOL> distutils . command . build . build . finalize_options ( self ) <EOL> class test ( distutils . core . Command ) : <EOL> description = "<STR_LIT>" <EOL> user_options = [ ] <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> self . run_command ( "<STR_LIT>" ) <EOL> buildCommand = self . distribution . get_command_obj ( "<STR_LIT>" ) <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . abspath ( "<STR_LIT:test>" ) ) <EOL> sys . path . insert ( <NUM_LIT:0> , os . path . abspath ( buildCommand . build_lib ) ) <EOL> if sys . version_info [ <NUM_LIT:0> ] < <NUM_LIT:3> : <EOL> execfile ( os . path . join ( "<STR_LIT:test>" , "<STR_LIT>" ) ) <EOL> else : <EOL> fileName = os . path . join ( "<STR_LIT:test>" , "<STR_LIT>" ) <EOL> exec ( open ( fileName ) . read ( ) ) <EOL> commandClasses = dict ( build = build , bdist_rpm = bdist_rpm , test = test ) <EOL> if distutils . command . bdist_msi is not None : <EOL> class bdist_msi ( distutils . command . bdist_msi . bdist_msi ) : <EOL> def run ( self ) : <EOL> origMethod = self . distribution . get_fullname <EOL> self . distribution . get_fullname = self . distribution . get_fullname_with_oracle_version <EOL> distutils . command . bdist_msi . bdist_msi . run ( self ) <EOL> self . distribution . get_fullname = origMethod <EOL> commandClasses [ "<STR_LIT>" ] = bdist_msi <EOL> if distutils . command . bdist_wininst is not None : <EOL> class bdist_wininst ( distutils . command . bdist_wininst . bdist_wininst ) : <EOL> def run ( self ) : <EOL> origMethod = self . distribution . get_fullname <EOL> self . distribution . get_fullname = self . distribution . get_fullname_with_oracle_version <EOL> distutils . command . bdist_wininst . bdist_wininst . run ( self ) <EOL> self . distribution . get_fullname = origMethod <EOL> commandClasses [ "<STR_LIT>" ] = bdist_wininst <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> ] <EOL> extension = Extension ( <EOL> name = "<STR_LIT>" , <EOL> include_dirs = includeDirs , <EOL> libraries = libs , <EOL> library_dirs = libDirs , <EOL> extra_compile_args = extraCompileArgs , <EOL> extra_link_args = extraLinkArgs , <EOL> sources = [ "<STR_LIT>" ] , <EOL> depends = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> setup ( <EOL> name = "<STR_LIT>" , <EOL> version = BUILD_VERSION , <EOL> distclass = Distribution , <EOL> description = "<STR_LIT>" , <EOL> data_files = dataFiles , <EOL> cmdclass = commandClasses , <EOL> options = dict ( bdist_rpm = dict ( doc_files = docFiles ) ) , <EOL> long_description = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> author = "<STR_LIT>" , <EOL> author_email = "<STR_LIT>" , <EOL> url = "<STR_LIT>" , <EOL> ext_modules = [ extension ] , <EOL> keywords = "<STR_LIT>" , <EOL> license = "<STR_LIT>" , <EOL> classifiers = classifiers ) </s>
