summaryrefslogtreecommitdiffstats
path: root/make/lib
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2016-05-24 16:47:48 -0400
committerBradley Sepos <[email protected]>2016-05-25 15:45:05 -0400
commit3bf86382ab351ac0db02dcef41ed27502ff4fb41 (patch)
tree39e2f2e8539e60cc25eecd722ddb16adcb9ad2df /make/lib
parent12745a5fe307f7933eecc1b97419617597b1e8a0 (diff)
build: Add download jobs option and progress display.
Diffstat (limited to 'make/lib')
-rw-r--r--make/lib/hb_distfile.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/make/lib/hb_distfile.py b/make/lib/hb_distfile.py
index 72cda054b..d9dced164 100644
--- a/make/lib/hb_distfile.py
+++ b/make/lib/hb_distfile.py
@@ -71,6 +71,17 @@ class Tool(object):
if self.options.verbosity >= Tool.LOG_INFO:
sys.stdout.write(format % args)
+ ## newline not required
+ def progressf(self, percent, format, *args):
+ if self.options.verbosity >= Tool.LOG_INFO:
+ sys.stdout.write(format % args)
+ if percent >= 0:
+ sys.stdout.write(" [%-20s] %.1f%%" % ('='*int(percent*20), percent*100))
+ sys.stdout.write('\n') # needed to flush on some systems
+ if self.options.jobs == 1:
+ sys.stdout.write('\033[F') # reuse line
+ sys.stdout.flush()
+
## newline required
def verbosef(self, format, *args):
if self.options.verbosity >= Tool.LOG_VERBOSE:
@@ -89,7 +100,7 @@ class Tool(object):
## generate a temporary filename - not worried about race conditions
def mktmpname(self, filename):
- return filename + '.tmp.' + ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8))
+ return filename + '.' + ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8)) + '.tmp'
###############################################################################