Print the duration of each steps.
This commit is contained in:
parent
daf93f2e2f
commit
9bbc3930ae
|
@ -1,6 +1,7 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import time
|
||||||
|
|
||||||
from kiwixbuild.utils import pj, Context, SkipCommand, extract_archive, Defaultdict, StopBuild, run_command
|
from kiwixbuild.utils import pj, Context, SkipCommand, extract_archive, Defaultdict, StopBuild, run_command
|
||||||
from kiwixbuild.versions import main_project_versions, base_deps_versions
|
from kiwixbuild.versions import main_project_versions, base_deps_versions
|
||||||
|
@ -72,9 +73,11 @@ class Source:
|
||||||
log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
|
log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
|
||||||
context = Context(name, log, True)
|
context = Context(name, log, True)
|
||||||
try:
|
try:
|
||||||
|
start_time = time.time()
|
||||||
ret = function(*args, context=context)
|
ret = function(*args, context=context)
|
||||||
context._finalise()
|
context._finalise()
|
||||||
print("OK")
|
duration = time.time() - start_time
|
||||||
|
print("OK ({:.1f}s)".format(duration))
|
||||||
return ret
|
return ret
|
||||||
except SkipCommand:
|
except SkipCommand:
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
|
@ -228,9 +231,11 @@ class Builder:
|
||||||
log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
|
log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
|
||||||
context = Context(name, log, self.target.force_native_build)
|
context = Context(name, log, self.target.force_native_build)
|
||||||
try:
|
try:
|
||||||
|
start_time = time.time()
|
||||||
ret = function(*args, context=context)
|
ret = function(*args, context=context)
|
||||||
context._finalise()
|
context._finalise()
|
||||||
print("OK")
|
duration = time.time() - start_time
|
||||||
|
print("OK ({:.1f}s)".format(duration))
|
||||||
return ret
|
return ret
|
||||||
except SkipCommand:
|
except SkipCommand:
|
||||||
print("SKIP")
|
print("SKIP")
|
||||||
|
|
Loading…
Reference in New Issue