MCPcopy
hub / github.com/django/django / build_potfiles

Method build_potfiles

django/core/management/commands/makemessages.py:497–522  ·  view source on GitHub ↗

Build pot files and apply msguniq to them.

(self)

Source from the content-addressed store, hash-verified

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:

Callers 1

handleMethod · 0.95

Calls 10

find_filesMethod · 0.95
remove_potfilesMethod · 0.95
process_filesMethod · 0.95
popen_wrapperFunction · 0.90
CommandErrorClass · 0.90
normalize_eolsFunction · 0.85
joinMethod · 0.45
existsMethod · 0.45
writeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected