From 8fe8312872898fe970f3117cf46c7ed202e17482 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ville=20Skytt=C3=A4?= Date: Tue, 26 Jul 2016 23:33:52 +0300 Subject: [PATCH] Abort catalog update earlier if there are no message catalogs --- babel/messages/frontend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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: -- 2.47.2