655 @param filter list of source file extension that should be considered |
655 @param filter list of source file extension that should be considered |
656 (list of strings) |
656 (list of strings) |
657 @return flag indicating success |
657 @return flag indicating success |
658 """ |
658 """ |
659 path, ext = os.path.splitext(self.project.pfile) |
659 path, ext = os.path.splitext(self.project.pfile) |
660 pfile = '%s_e4x.pro' % path |
660 pfile = '{0}_e4x.pro'.format(path) |
661 |
661 |
662 # only consider files satisfying the filter criteria |
662 # only consider files satisfying the filter criteria |
663 _sources = [s for s in self.project.pdata["SOURCES"] \ |
663 _sources = [s for s in self.project.pdata["SOURCES"] \ |
664 if os.path.splitext(s)[1] in filter] |
664 if os.path.splitext(s)[1] in filter] |
665 sources = [] |
665 sources = [] |
708 |
708 |
709 try: |
709 try: |
710 pf = open(pfile, "w", encoding = "utf-8") |
710 pf = open(pfile, "w", encoding = "utf-8") |
711 for key, list in sections: |
711 for key, list in sections: |
712 if len(list) > 0: |
712 if len(list) > 0: |
713 pf.write('%s = ' % key) |
713 pf.write('{0} = '.format(key)) |
714 last = len(list) - 1 |
714 last = len(list) - 1 |
715 if last > 0: |
715 if last > 0: |
716 pf.write('%s \\%s' % \ |
716 pf.write('{0} \\{1}'.format( |
717 (list[0].replace(os.sep, '/'), "\n")) |
717 list[0].replace(os.sep, '/'), "\n")) |
718 for i in range(1, last): |
718 for i in range(1, last): |
719 pf.write('\t%s \\%s' % \ |
719 pf.write('\t{0} \\{1}'.format( |
720 (list[i].replace(os.sep, '/'), "\n")) |
720 list[i].replace(os.sep, '/'), "\n")) |
721 pf.write('\t%s %s%s' % \ |
721 pf.write('\t{0} {1}{2}'.format( |
722 (list[last].replace(os.sep, '/'), "\n", "\n")) |
722 list[last].replace(os.sep, '/'), "\n", "\n")) |
723 else: |
723 else: |
724 pf.write('%s %s%s' % \ |
724 pf.write('{0} {1}{2}'.format( |
725 (list[0].replace(os.sep, '/'), "\n", "\n")) |
725 list[0].replace(os.sep, '/'), "\n", "\n")) |
726 |
726 |
727 pf.close() |
727 pf.close() |
728 self.tmpProject = pfile |
728 self.tmpProject = pfile |
729 return True |
729 return True |
730 except IOError: |
730 except IOError: |