#NEWLINE# def find_sql_file( self , name , sqlfile ) : #NEWLINE# #INDENT# sqlfile = os . path . basename ( sqlfile ) #NEWLINE# sharedir = self . call_pg_config ( 'sharedir' ) #NEWLINE# tries = [ ( ( name + '/' ) + sqlfile ) , ( ( sqlfile . rsplit ( '.' , 1 ) [ 0 ] + '/' ) + sqlfile ) , ( 'contrib/' + sqlfile ) ] #NEWLINE# tried = set ( ) #NEWLINE# for fn in tries : #NEWLINE# #INDENT# if ( fn in tried ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# tried . add ( fn ) #NEWLINE# fn = ( ( sharedir + '/' ) + fn ) #NEWLINE# logger . debug ( ( 'checking sql file in %s' % fn ) ) #NEWLINE# if os . path . exists ( fn ) : #NEWLINE# #INDENT# return fn #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise PgxnClientException ( ( "cannot find sql file for extension '%s': '%s'" % ( name , sqlfile ) ) )