mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Merge pull request #3114 from sarahmarshy/uvision-filetype-fix
Fix issue with unrecognized uvision file typespull/3180/merge
						commit
						9da1ff5290
					
				| 
						 | 
					@ -131,10 +131,10 @@ class Uvision(Exporter):
 | 
				
			||||||
                  '.obj': 3, '.o': 3, '.lib': 4,
 | 
					                  '.obj': 3, '.o': 3, '.lib': 4,
 | 
				
			||||||
                  '.ar': 4, '.h': 5, '.hpp': 5, '.sct': 4}
 | 
					                  '.ar': 4, '.h': 5, '.hpp': 5, '.sct': 4}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def uv_file(self, loc):
 | 
					    def uv_files(self, files):
 | 
				
			||||||
        """Return a namedtuple of information about project file
 | 
					        """An generator containing Uvision specific information about project files
 | 
				
			||||||
        Positional Arguments:
 | 
					        Positional Arguments:
 | 
				
			||||||
        loc - the file's location
 | 
					        files - the location of source files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        .uvprojx XML for project file:
 | 
					        .uvprojx XML for project file:
 | 
				
			||||||
        <File>
 | 
					        <File>
 | 
				
			||||||
| 
						 | 
					@ -143,11 +143,14 @@ class Uvision(Exporter):
 | 
				
			||||||
            <FilePath>{{file.loc}}</FilePath>
 | 
					            <FilePath>{{file.loc}}</FilePath>
 | 
				
			||||||
        </File>
 | 
					        </File>
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        UVFile = namedtuple('UVFile', ['type','loc','name'])
 | 
					        for loc in files:
 | 
				
			||||||
        _, ext = os.path.splitext(loc)
 | 
					            #Encapsulates the information necessary for template entry above
 | 
				
			||||||
        type = self.file_types[ext.lower()]
 | 
					            UVFile = namedtuple('UVFile', ['type','loc','name'])
 | 
				
			||||||
        name = ntpath.basename(normpath(loc))
 | 
					            _, ext = os.path.splitext(loc)
 | 
				
			||||||
        return UVFile(type, loc, name)
 | 
					            if ext.lower() in self.file_types:
 | 
				
			||||||
 | 
					                type = self.file_types[ext.lower()]
 | 
				
			||||||
 | 
					                name = ntpath.basename(normpath(loc))
 | 
				
			||||||
 | 
					                yield UVFile(type, loc, name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def format_flags(self):
 | 
					    def format_flags(self):
 | 
				
			||||||
        """Format toolchain flags for Uvision"""
 | 
					        """Format toolchain flags for Uvision"""
 | 
				
			||||||
| 
						 | 
					@ -179,7 +182,7 @@ class Uvision(Exporter):
 | 
				
			||||||
        """Make sources into the named tuple for use in the template"""
 | 
					        """Make sources into the named tuple for use in the template"""
 | 
				
			||||||
        grouped = self.group_project_files(srcs)
 | 
					        grouped = self.group_project_files(srcs)
 | 
				
			||||||
        for group, files in grouped.items():
 | 
					        for group, files in grouped.items():
 | 
				
			||||||
            grouped[group] = [self.uv_file(src) for src in files]
 | 
					            grouped[group] = self.uv_files(files)
 | 
				
			||||||
        return grouped
 | 
					        return grouped
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def generate(self):
 | 
					    def generate(self):
 | 
				
			||||||
| 
						 | 
					@ -193,6 +196,8 @@ class Uvision(Exporter):
 | 
				
			||||||
               self.resources.objects + self.resources.libraries
 | 
					               self.resources.objects + self.resources.libraries
 | 
				
			||||||
        ctx = {
 | 
					        ctx = {
 | 
				
			||||||
            'name': self.project_name,
 | 
					            'name': self.project_name,
 | 
				
			||||||
 | 
					            # project_files => dict of generators - file group to generator of
 | 
				
			||||||
 | 
					            # UVFile tuples defined above
 | 
				
			||||||
            'project_files': self.format_src(srcs),
 | 
					            'project_files': self.format_src(srcs),
 | 
				
			||||||
            'linker_script':self.resources.linker_script,
 | 
					            'linker_script':self.resources.linker_script,
 | 
				
			||||||
            'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'),
 | 
					            'include_paths': '; '.join(self.resources.inc_dirs).encode('utf-8'),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue