def link_files(self): if self.type == 'static': self.project_name = 'lib{0}.a'.format(self.project_name) self.lflags('-static') elif self.type == 'dynamic': self.project_name = 'lib{0}{1}'.format(self.project_name, self.link_extension) self.lflags('-shared') try: os.makedirs(self.build_directory) except OSError: pass # Stops extra parameters from existing self.linker_flags = list(set(self.linker_flags)) run_list = ' '.join(flatten([self.executable, '-o', '{0}/{1}'.format(self.build_directory, self.project_name)] + self.link_list + self.linker_flags)) command('[LINK] {0}'.format(self.project_name)) try: subprocess.call(run_list) except OSError: os.system(run_list) return 0
def link_files(self): try: os.makedirs(self.build_directory) except OSError: pass if self.type == 'static': self.executable = 'lib' out_comm = '/OUT:{0}/{1}.lib'.format(self.build_directory, self.project_name) elif self.type == 'dynamic': self.lflags('/LD'), self.lflags('/DLL'), self.lflags('/link') out_comm = '/OUT:{0}/{1}.dll'.format(self.build_directory, self.project_name) else: self.lflags('/Fe"{0}/{1}.exe"'.format(self.build_directory, self.project_name)) out_comm = [ ] run_list = flatten([self.executable, '/nologo'] + self.link_list + self.linker_flags + [out_comm]) run_list = ' '.join(run_list) command('[LINK] {0}'.format(self.project_name)) try: subprocess.call(run_list) except OSError: os.system(run_list) return 0
def format_command(self, percentage, file_name): command('[{0:>3}%] {1}: {2}'.format(percentage, self.name.upper(), file_name))