Fixed #29492 -- Improved compilemessages speed
This commit is contained in:
parent
553617e613
commit
998d774195
|
@ -1,4 +1,5 @@
|
|||
import codecs
|
||||
import concurrent.futures
|
||||
import glob
|
||||
import os
|
||||
|
||||
|
@ -106,6 +107,8 @@ class Command(BaseCommand):
|
|||
"""
|
||||
Locations is a list of tuples: [(directory, file), ...]
|
||||
"""
|
||||
with concurrent.futures.ThreadPoolExecutor() as executor:
|
||||
futures = []
|
||||
for i, (dirpath, f) in enumerate(locations):
|
||||
if self.verbosity > 0:
|
||||
self.stdout.write('processing file %s in %s\n' % (f, dirpath))
|
||||
|
@ -131,10 +134,14 @@ class Command(BaseCommand):
|
|||
args = [self.program] + self.program_options + [
|
||||
'-o', base_path + '.mo', base_path + '.po'
|
||||
]
|
||||
output, errors, status = popen_wrapper(args)
|
||||
futures.append(executor.submit(popen_wrapper, args))
|
||||
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
output, errors, status = future.result()
|
||||
if status:
|
||||
if self.verbosity > 0:
|
||||
if errors:
|
||||
self.stderr.write('Execution of %s failed: %s.' % (self.program, errors))
|
||||
self.stderr.write("Execution of %s failed: %s" % (self.program, errors))
|
||||
else:
|
||||
self.stderr.write('Execution of %s failed.' % self.program)
|
||||
self.stderr.write("Execution of %s failed" % self.program)
|
||||
self.has_errors = True
|
||||
|
|
Loading…
Reference in New Issue