@@ -108,22 +108,16 @@ def make(filenames, outfile):
108108 outfile is a string for the name of an input file or None.
109109
110110 If it is not None, the output file receives a merge of the input files
111- If it is None, then each input file is separately compiled into its
112- corresponding output file (same name with po replaced with mo) .
111+ If it is None, then filenames must be a string and the name of the output
112+ file is obtained by replacing the po extension with mo.
113113 Both ways are for compatibility reasons with previous behaviour.
114114 """
115115 messages = {}
116116 if isinstance (filenames , str ):
117117 infile , outfile = get_names (filenames , outfile )
118118 process (infile , messages )
119119 elif outfile is None :
120- for filename in filenames :
121- infile , outfile = get_names (filename , None )
122- messages .clear ()
123- process (infile , messages )
124- output = generate (messages )
125- writefile (outfile , output )
126- return
120+ raise TypeError ("outfile cannot be None with more than one infile" )
127121 else :
128122 for filename in filenames :
129123 infile , _ = get_names (filename , outfile )
@@ -272,7 +266,11 @@ def main(argv):
272266 print ('No input file given' , file = sys .stderr )
273267 print ("Try `msgfmt --help' for more information." , file = sys .stderr )
274268 return
275- make (args , outfile )
269+ if outfile is None :
270+ for filename in args :
271+ make (filename , None )
272+ else :
273+ make (args , outfile )
276274
277275
278276if __name__ == '__main__' :
0 commit comments