@@ -45,17 +45,16 @@ def handle_makemessages(self, **options):
4545 if mapping_file is None and 'extract_messages' in distribution .command_options :
4646 opts = distribution .command_options ['extract_messages' ]
4747 try :
48- mapping_file = opts . get ( 'mapping_file' , ()) [1 ]
49- except IndexError :
48+ mapping_file = opts [ 'mapping_file' ] [1 ]
49+ except ( IndexError , KeyError ) :
5050 mapping_file = None
5151
5252 for path in locale_paths :
5353 potfile = os .path .join (path , '%s.pot' % domain )
5454 if not os .path .exists (potfile ):
5555 continue
5656
57- cmd = ['pybabel' , 'extract' , '-o' ,
58- os .path .join (path , '%s.pot' % domain )]
57+ cmd = ['pybabel' , 'extract' , '-o' , potfile ]
5958
6059 if mapping_file is not None :
6160 cmd .extend (['-F' , mapping_file ])
@@ -66,7 +65,7 @@ def handle_makemessages(self, **options):
6665
6766 for locale in locales :
6867 cmd = ['pybabel' , 'update' , '-D' , domain ,
69- '-i' , os . path . join ( path , '%s.pot' % domain ) ,
68+ '-i' , potfile ,
7069 '-d' , path ,
7170 '-l' , locale ]
7271 call (cmd )
0 commit comments