From: Andrew Gaffney Date: Sun, 11 Jan 2009 22:15:07 +0000 (-0600) Subject: Move countdown() from catalyst.support to catalyst.util X-Git-Tag: CATALYST-2.0.10~3^2~198 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=c9c4421f1635e8d2d0c5b72b62f87068cddf860e;p=catalyst.git Move countdown() from catalyst.support to catalyst.util --- diff --git a/ChangeLog b/ChangeLog index 93503ada..4d70f790 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS) # Distributed under the GPL v2 + 11 Jan 2009; Andrew Gaffney + modules/catalyst/support.py, modules/catalyst/target/generic_stage.py, + modules/catalyst/util.py: + Move countdown() from catalyst.support to catalyst.util + 11 Jan 2009; Andrew Gaffney modules/catalyst/support.py, modules/catalyst/target/generic_stage.py, modules/catalyst/util.py: diff --git a/modules/catalyst/support.py b/modules/catalyst/support.py index d18e8ae3..923c4663 100644 --- a/modules/catalyst/support.py +++ b/modules/catalyst/support.py @@ -551,15 +551,3 @@ def addl_arg_parse(myspec,addlargs,requiredspec,validspec): if not x in myspec: raise CatalystError, "Required argument \""+x+"\" not specified." -def countdown(secs=5, doing="Starting"): - if secs: - print ">>> Waiting",secs,"seconds before starting..." - print ">>> (Control-C to abort)...\n"+doing+" in: ", - ticks=range(secs) - ticks.reverse() - for sec in ticks: - sys.stdout.write(str(sec+1)+" ") - sys.stdout.flush() - time.sleep(1) - print - diff --git a/modules/catalyst/target/generic_stage.py b/modules/catalyst/target/generic_stage.py index d4b7f261..1e18ac51 100644 --- a/modules/catalyst/target/generic_stage.py +++ b/modules/catalyst/target/generic_stage.py @@ -1618,7 +1618,7 @@ class generic_stage_target(generic_target): myf.close() def purge(self): - countdown(10,"Purging Caches ...") + catalyst.util.countdown(10, "Purging Caches ...") if "PURGE" in self.settings or "PURGEONLY" in self.settings: print "clearing autoresume ..." self.clear_autoresume() diff --git a/modules/catalyst/util.py b/modules/catalyst/util.py index 74d89e94..5bc6cb7c 100644 --- a/modules/catalyst/util.py +++ b/modules/catalyst/util.py @@ -128,3 +128,16 @@ def generate_contents(file, contents_function="auto", verbose=False): "Error generating contents, is appropriate utility (%s) installed on your system?" \ % (contents_function, ) +def countdown(secs=5, doing="Starting"): + if secs: + print ">>> Waiting " + secs + " seconds before starting..." + print ">>> (Control-C to abort)..." + print doing + " in: ", + ticks = range(secs) + ticks.reverse() + for sec in ticks: + sys.stdout.write(str(sec+1) + " ") + sys.stdout.flush() + time.sleep(1) + print +