From 37b85f23cf8173d4efb4670312f001966d901afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Mon, 25 Jun 2012 13:09:43 +0200 Subject: [PATCH] move build time into image build function --- bin/is | 10 ++-------- installsystems/image.py | 4 ++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/bin/is b/bin/is index 3f05cf3..2186a0d 100755 --- a/bin/is +++ b/bin/is @@ -21,7 +21,6 @@ InstallSystems Command line Tool ''' import os -import time import datetime import re import fnmatch @@ -127,16 +126,11 @@ def c_build(args): os.chdir(path) path = "." arrowlevel(1) - # build start time - t0 = time.time() # load source image simg = SourceImage(path) # do the job - simg.build(force=args.force, force_payload=args.payload, - check=not args.no_check, script=not args.no_script) - # compute building time - t1 = time.time() - dt = int(t1 - t0) + dt = simg.build(force=args.force, force_payload=args.payload, + check=not args.no_check, script=not args.no_script) arrow(u"Build time: %s" % datetime.timedelta(seconds=dt)) if args.chdir: os.chdir(cwd) diff --git a/installsystems/image.py b/installsystems/image.py index 0e0edbc..e68399f 100644 --- a/installsystems/image.py +++ b/installsystems/image.py @@ -301,6 +301,8 @@ class SourceImage(Image): # check if free to create script tarball if os.path.exists(self.image_name) and force == False: raise ISError("Tarball already exists. Remove it before") + # register start time + t0 = time.time() # check python scripts if check: for d in (self.build_path, self.parser_path, self.setup_path): @@ -322,6 +324,8 @@ class SourceImage(Image): jdesc = self.generate_json_description() # creating scripts tarball self.create_image(jdesc) + # compute building time + return int(time.time() - t0) def create_image(self, jdescription): ''' -- GitLab