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 __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 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 http_gnome_url (package_http, platform): package_ctx = XPATH_CONTEXT (package_http) url_count = package_ctx.int_value ('count (//package/url)') if url_count == 1: xpath = '/package/url' else: xpath = "/package/url[@platform='%s']" % platform result = package_ctx.text (xpath) if url_count == 1: template = Template (result) result = template.substitute (PLATFORM = platform) 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 ''
def __init__(self): # Get version from Eiffel class BUILD_INFO in source f = open(path.normpath('source/build_info.e'), 'r') for ln in f.readlines(): if ln.startswith('\tVersion_number'): numbers = ln[ln.rfind(' ') + 1:-1].split('_') break f.close() for i, n in enumerate(numbers): numbers[i] = str(int(n)) self.version = ('.').join(numbers) project_name = glob('*.ecf')[0] self.exe_name = XPATH_CONTEXT(project_name, 'ec').attribute('/ec:system/@name')
def __init__(self): self.ecf_name = glob('*.ecf')[0] self.name = path.splitext(self.ecf_name)[0] ecf_ctx = XPATH_CONTEXT(self.ecf_name, 'ec') self.exe_name = self.ecf_exe_name(ecf_ctx, '/ec:system/@name') # Get version from Eiffel class BUILD_INFO in source f = open(build_info_path(ecf_ctx), 'r') for ln in f.readlines(): if ln.startswith('\tVersion_number'): numbers = ln[ln.rfind(' ') + 1:-1].split('_') break f.close() for i, n in enumerate(numbers): numbers[i] = str(int(n)) self.version = ('.').join(numbers)
def http_debian_url (package_path, platform): package_ctx = XPATH_CONTEXT (package_path) template = Template (package_ctx.text ('/debian-package/url')) result = template.substitute (PLATFORM = platform) return result