Build pot files and apply msguniq to them.
(self)
| 495 | return True |
| 496 | |
| 497 | def build_potfiles(self): |
| 498 | """ |
| 499 | Build pot files and apply msguniq to them. |
| 500 | """ |
| 501 | file_list = self.find_files(".") |
| 502 | self.remove_potfiles() |
| 503 | self.process_files(file_list) |
| 504 | potfiles = [] |
| 505 | for path in self.locale_paths: |
| 506 | potfile = os.path.join(path, "%s.pot" % self.domain) |
| 507 | if not os.path.exists(potfile): |
| 508 | continue |
| 509 | args = ["msguniq", *self.msguniq_options, potfile] |
| 510 | msgs, errors, status = popen_wrapper(args) |
| 511 | if errors: |
| 512 | if status != STATUS_OK: |
| 513 | raise CommandError( |
| 514 | "errors happened while running msguniq\n%s" % errors |
| 515 | ) |
| 516 | elif self.verbosity > 0: |
| 517 | self.stdout.write(errors) |
| 518 | msgs = normalize_eols(msgs) |
| 519 | with open(potfile, "w", encoding="utf-8") as fp: |
| 520 | fp.write(msgs) |
| 521 | potfiles.append(potfile) |
| 522 | return potfiles |
| 523 | |
| 524 | def remove_potfiles(self): |
| 525 | for path in self.locale_paths: |
no test coverage detected