#NEWLINE# def getMajorArch( depList ) : #NEWLINE# #INDENT# 'Return the major architecture from an instruction set dependency\n    @type depList: list (iterable) of Dependency objects representing\n    architectures.\n    @param depGroupL a list (iterable) of Dependency objects.\n    @raise IncompatibleInstructionSets: when incompatible architectures are\n           present in the list.\n    @rtype: instance of Dependency, or None\n    @return: major architecture from the list, or None if the list is empty\n    ' #NEWLINE# majorArch = None #NEWLINE# depList = list ( depList ) #NEWLINE# if ( not depList ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( len ( depList ) == 1 ) : #NEWLINE# #INDENT# return depList [ 0 ] #NEWLINE# #UNINDENT# for dep in depList : #NEWLINE# #INDENT# prefs = set ( getFlavorPreferences ( [ [ dep ] ] ) ) #NEWLINE# if ( not prefs ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# majorArch = dep #NEWLINE# prefArches = set ( ) #NEWLINE# for depSet in prefs : #NEWLINE# #INDENT# for dep in depSet . iterDepsByClass ( deps . InstructionSetDependency ) : #NEWLINE# #INDENT# prefArches . add ( dep . name ) #NEWLINE# #UNINDENT# #UNINDENT# break #NEWLINE# #UNINDENT# if ( not majorArch ) : #NEWLINE# #INDENT# raise IncompatibleInstructionSets ( depList [ 0 ] . name , depList [ 1 ] ) #NEWLINE# #UNINDENT# for dep in depList : #NEWLINE# #INDENT# if ( ( dep . name != majorArch . name ) and getFlavorPreferences ( [ [ dep ] ] ) ) : #NEWLINE# #INDENT# raise IncompatibleInstructionSets ( majorArch . name , dep ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( dep . name not in prefArches ) : #NEWLINE# #INDENT# raise IncompatibleInstructionSets ( majorArch . name , dep ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return majorArch