#NEWLINE# @ staticmethod #NEWLINE# def FindPathByUuid( path , uuid , arch ) : #NEWLINE# #INDENT# def ViewfinderPath( uuid ) : #NEWLINE# #INDENT# p = os . path . join ( _VIEWFINDER_DSYMS_UUID_PATH , uuid ) #NEWLINE# if ( not os . path . exists ( p ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# p = open ( p ) . read ( ) . strip ( ) #NEWLINE# if ( not p ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# return os . path . join ( _VIEWFINDER_DSYMS_PATH , p , _VIEWFINDER_DSYMS_SUFFIX ) #NEWLINE# #UNINDENT# def DsymForUuid( path , uuid , arch ) : #NEWLINE# #INDENT# dwarfdump = subprocess . Popen ( [ 'dwarfdump' , ( '--arch=%s' % arch ) , '--uuid' , path ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) #NEWLINE# for line in dwarfdump . stdout : #NEWLINE# #INDENT# if ( uuid in line ) : #NEWLINE# #INDENT# return ' ' . join ( line . strip ( ) . split ( ' ' ) [ 3 : ] ) #NEWLINE# #UNINDENT# #UNINDENT# return None #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# p = uuid_cache [ uuid ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# p = ViewfinderPath ( uuid ) #NEWLINE# if ( not p ) : #NEWLINE# #INDENT# mdfind = subprocess . Popen ( [ 'mdfind' , ( 'com_apple_xcode_dsym_uuids = ' + uuid ) ] , stdout = subprocess . PIPE ) #NEWLINE# try : #NEWLINE# #INDENT# p = iter ( mdfind . stdout ) . next ( ) [ : ( - 1 ) ] #NEWLINE# if p . endswith ( '.xcarchive' ) : #NEWLINE# #INDENT# dsym_folder = os . path . join ( arch , 'dSYMs' ) #NEWLINE# dsyms = glob . glob ( os . path . join ( p , 'dSYMs/*.dSYM' ) ) #NEWLINE# if ( len ( dsyms ) == 1 ) : #NEWLINE# #INDENT# p = os . path . join ( p , 'dSYMs' , dsyms [ 0 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# p = None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except StopIteration : #NEWLINE# #INDENT# p = None #NEWLINE# #UNINDENT# mdfind . wait ( ) #NEWLINE# #UNINDENT# if p : #NEWLINE# #INDENT# p = DsymForUuid ( p , uuid , arch ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# global symbol_dirs #NEWLINE# for d in symbol_dirs : #NEWLINE# #INDENT# p = ( '%s/%s' % ( d , path ) ) #NEWLINE# if os . path . exists ( p ) : #NEWLINE# #INDENT# p = DsymForUuid ( p , uuid , arch ) #NEWLINE# if p : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# p = None #NEWLINE# #UNINDENT# #UNINDENT# uuid_cache [ uuid ] = p #NEWLINE# #UNINDENT# return p