(self, *args, **options)
| 315 | ) |
| 316 | |
| 317 | def handle(self, *args, **options): |
| 318 | locale = options["locale"] |
| 319 | exclude = options["exclude"] |
| 320 | self.domain = options["domain"] |
| 321 | self.verbosity = options["verbosity"] |
| 322 | process_all = options["all"] |
| 323 | extensions = options["extensions"] |
| 324 | self.symlinks = options["symlinks"] |
| 325 | |
| 326 | ignore_patterns = options["ignore_patterns"] |
| 327 | if options["use_default_ignore_patterns"]: |
| 328 | ignore_patterns += ["CVS", ".*", "*~", "*.pyc"] |
| 329 | self.ignore_patterns = list(set(ignore_patterns)) |
| 330 | |
| 331 | # Avoid messing with mutable class variables |
| 332 | if options["no_wrap"]: |
| 333 | self.msgmerge_options = self.msgmerge_options[:] + ["--no-wrap"] |
| 334 | self.msguniq_options = self.msguniq_options[:] + ["--no-wrap"] |
| 335 | self.msgattrib_options = self.msgattrib_options[:] + ["--no-wrap"] |
| 336 | self.xgettext_options = self.xgettext_options[:] + ["--no-wrap"] |
| 337 | if options["no_location"]: |
| 338 | self.msgmerge_options = self.msgmerge_options[:] + ["--no-location"] |
| 339 | self.msguniq_options = self.msguniq_options[:] + ["--no-location"] |
| 340 | self.msgattrib_options = self.msgattrib_options[:] + ["--no-location"] |
| 341 | self.xgettext_options = self.xgettext_options[:] + ["--no-location"] |
| 342 | if options["add_location"]: |
| 343 | arg_add_location = "--add-location=%s" % options["add_location"] |
| 344 | self.msgmerge_options = self.msgmerge_options[:] + [arg_add_location] |
| 345 | self.msguniq_options = self.msguniq_options[:] + [arg_add_location] |
| 346 | self.msgattrib_options = self.msgattrib_options[:] + [arg_add_location] |
| 347 | self.xgettext_options = self.xgettext_options[:] + [arg_add_location] |
| 348 | |
| 349 | self.no_obsolete = options["no_obsolete"] |
| 350 | self.keep_pot = options["keep_pot"] |
| 351 | |
| 352 | if self.domain not in ("django", "djangojs"): |
| 353 | raise CommandError( |
| 354 | "currently makemessages only supports domains " |
| 355 | "'django' and 'djangojs'" |
| 356 | ) |
| 357 | if self.domain == "djangojs": |
| 358 | exts = extensions or ["js"] |
| 359 | else: |
| 360 | exts = extensions or ["html", "txt", "py"] |
| 361 | self.extensions = handle_extensions(exts) |
| 362 | |
| 363 | if (not locale and not exclude and not process_all) or self.domain is None: |
| 364 | raise CommandError( |
| 365 | "Type '%s help %s' for usage information." |
| 366 | % (os.path.basename(sys.argv[0]), sys.argv[1]) |
| 367 | ) |
| 368 | |
| 369 | if self.verbosity > 1: |
| 370 | self.stdout.write( |
| 371 | "examining files with the extensions: %s" |
| 372 | % get_text_list(list(self.extensions), "and") |
| 373 | ) |
| 374 |
nothing calls this directly
no test coverage detected