From: Ville Skyttä Date: Tue, 26 Jul 2016 20:33:52 +0000 (+0300) Subject: Abort catalog update earlier if there are no message catalogs X-Git-Tag: v2.4.0~13^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fe8312872898fe970f3117cf46c7ed202e17482;p=thirdparty%2Fbabel.git Abort catalog update earlier if there are no message catalogs --- diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py index 5a1c7417..3c94bf3f 100644 --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -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: