aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_emerge/countdown.py')
-rw-r--r--lib/_emerge/countdown.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/_emerge/countdown.py b/lib/_emerge/countdown.py
new file mode 100644
index 000000000..62e3c8dea
--- /dev/null
+++ b/lib/_emerge/countdown.py
@@ -0,0 +1,22 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from __future__ import print_function
+
+import sys
+import time
+
+from portage.output import colorize
+
+
+def countdown(secs=5, doing='Starting'):
+ if secs:
+ print(
+ '>>> Waiting %s seconds before starting...\n'
+ '>>> (Control-C to abort)...\n'
+ '%s in:' % (secs, doing), end='')
+ for sec in range(secs, 0, -1):
+ sys.stdout.write(colorize('UNMERGE_WARN', ' %i' % sec))
+ sys.stdout.flush()
+ time.sleep(1)
+ print()