def __init__(self, ecf_path, top_level=False): self.location = ecf_path ecf_ctx = XPATH_CONTEXT(ecf_path, 'ec') self.uuid = ecf_ctx.attribute("/ec:system/@uuid") self.name = ecf_ctx.attribute("/ec:system/@name") self.libraries_table = {self.uuid: self} self.precompile_path = None if top_level: self.__set_top_level_properties(ecf_ctx) self.external_libs = self.__external_libs(ecf_ctx) self.c_shared_objects = self.__external_shared_objects(ecf_ctx) library_condition = "not (starts-with(@location,'$ISE_LIBRARY')) and count (%s)=0" % self.__excluded_library_or_external_object_conditions( ) xpath = "//ec:system/ec:target/ec:library[%s]/@location" % library_condition for attrib in ecf_ctx.node_list(xpath): location = expanded_path(attrib) #print 'location:', location if not path.isabs(location): location = path.join(path.dirname(ecf_path), location) # Recurse ecf file ecf = EIFFEL_CONFIG_FILE(location) self.libraries_table[ecf.uuid] = ecf for uuid in ecf.libraries_table: self.libraries_table[uuid] = ecf.libraries_table[uuid] if top_level: self.libraries = [] for uuid in self.libraries_table: self.libraries.append(self.libraries_table[uuid])
def __init__ (self, ecf_path, top_level = False): self.location = ecf_path ecf_ctx = XPATH_CONTEXT (ecf_path, 'ec') self.uuid = ecf_ctx.attribute ("/ec:system/@uuid") self.name = ecf_ctx.attribute ("/ec:system/@name") self.libraries_table = {self.uuid : self} self.precompile_path = None if top_level: self.__set_top_level_properties (ecf_ctx) self.external_libs = self.__external_libs (ecf_ctx) self.c_shared_objects = self.__external_shared_objects (ecf_ctx) library_condition = "not (starts-with(@location,'$ISE_LIBRARY')) and count (%s)=0" % self.__excluded_library_or_external_object_conditions () xpath = "//ec:system/ec:target/ec:library[%s]/@location" % library_condition for attrib in ecf_ctx.node_list (xpath): location = path.normpath (path.expandvars (attrib).translate (string.maketrans ('\\','/'))) #print 'location:', location if not path.dirname (location) or location.startswith ('..'): location = path.join (path.dirname (ecf_path), location) # Recurse ecf file ecf = EIFFEL_CONFIG_FILE (location) self.libraries_table [ecf.uuid] = ecf for uuid in ecf.libraries_table: self.libraries_table [uuid] = ecf.libraries_table [uuid] if top_level: self.libraries = [] for uuid in self.libraries_table: self.libraries.append (self.libraries_table [uuid])
def precompile_name (self): # Platform version may not exist yet so look for copy in parent directory (precomp) parent_dir = path.dirname (path.dirname (self.precompile_path)) precompile_path = path.join (parent_dir, path.basename (self.precompile_path)) ctx = XPATH_CONTEXT (precompile_path, 'ec') result = ctx.attribute ('/ec:system/@library_target') if result: result = result.lower () return result
def __init__(self, ecf_path, ecf_table=dict()): self.location = ecf_path ecf_ctx = XPATH_CONTEXT(ecf_path, 'ec') self.uuid = ecf_ctx.attribute("/ec:system/@uuid") self.name = ecf_ctx.attribute("/ec:system/@name") self.libraries_table = {self.uuid: self} self.precompile_path = None top_level = len(ecf_table) == 0 if top_level: self.__set_top_level_properties(ecf_ctx) print "\nLibraries:", print path.basename(ecf_path), ',', ecf_table[ecf_path] = self self.external_libs = self.__external_libs(ecf_ctx) self.c_shared_objects = self.__external_shared_objects(ecf_ctx) library_condition = "not (starts-with(@location,'$ISE_LIBRARY')) and count (%s)=0" % self.__excluded_library_or_external_object_conditions( ) xpath = "//ec:system/ec:target/ec:library[%s]/@location" % library_condition for attrib in ecf_ctx.node_list(xpath): location = expanded_path(attrib) #print 'location:', location if not path.isabs(location): location = path.normpath( path.join(path.dirname(ecf_path), location)) # prevent infinite recursion for circular references if ecf_table.has_key(location): ecf = ecf_table[location] else: # Recurse ecf file ecf = EIFFEL_CONFIG_FILE(location, ecf_table) self.libraries_table[ecf.uuid] = ecf for uuid in ecf.libraries_table: self.libraries_table[uuid] = ecf.libraries_table[uuid] if top_level: self.libraries = [] for uuid in self.libraries_table: self.libraries.append(self.libraries_table[uuid]) print '' print ''
def __init__ (self, ecf_path, ecf_table = dict ()): self.location = ecf_path ecf_ctx = XPATH_CONTEXT (ecf_path, 'ec') self.uuid = ecf_ctx.attribute ("/ec:system/@uuid") self.name = ecf_ctx.attribute ("/ec:system/@name") self.libraries_table = {self.uuid : self} self.precompile_path = None top_level = len (ecf_table) == 0 if top_level: self.__set_top_level_properties (ecf_ctx) print "\nLibraries:", print path.basename (ecf_path), ',', ecf_table [ecf_path] = self self.external_libs = self.__external_libs (ecf_ctx) self.c_shared_objects = self.__external_shared_objects (ecf_ctx) library_condition = "not (starts-with(@location,'$ISE_LIBRARY')) and count (%s)=0" % self.__excluded_library_or_external_object_conditions () xpath = "//ec:system/ec:target/ec:library[%s]/@location" % library_condition for attrib in ecf_ctx.node_list (xpath): location = expanded_path (attrib) #print 'location:', location if not path.isabs (location): location = path.normpath (path.join (path.dirname (ecf_path), location)) # prevent infinite recursion for circular references if ecf_table.has_key (location): ecf = ecf_table [location] else: # Recurse ecf file ecf = EIFFEL_CONFIG_FILE (location, ecf_table) self.libraries_table [ecf.uuid] = ecf for uuid in ecf.libraries_table: self.libraries_table [uuid] = ecf.libraries_table [uuid] if top_level: self.libraries = [] for uuid in self.libraries_table: self.libraries.append (self.libraries_table [uuid]) print '' print ''