]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Abort catalog update earlier if there are no message catalogs 437/head
authorVille Skyttä <ville.skytta@iki.fi>
Tue, 26 Jul 2016 20:33:52 +0000 (23:33 +0300)
committerVille Skyttä <ville.skytta@iki.fi>
Wed, 27 Jul 2016 05:42:14 +0000 (08:42 +0300)
babel/messages/frontend.py

index 5a1c7417f6fde6de9fd145c0e0ca8cfe2044f964..3c94bf3f3e818f4da619d4fe210ca36d96c73f7b 100644 (file)
@@ -690,6 +690,9 @@ class update_catalog(Command):
         else:
             po_files.append((self.locale, self.output_file))
 
+        if not po_files:
+            raise DistutilsOptionError('no message catalogs found')
+
         domain = self.domain
         if not domain:
             domain = os.path.splitext(os.path.basename(self.input_file))[0]
@@ -697,9 +700,6 @@ class update_catalog(Command):
         with open(self.input_file, 'rb') as infile:
             template = read_po(infile)
 
-        if not po_files:
-            raise DistutilsOptionError('no message catalogs found')
-
         for locale, filename in po_files:
             self.log.info('updating catalog %s based on %s', filename, self.input_file)
             with open(filename, 'rb') as infile: