From: Eric Edgar Date: Thu, 21 Apr 2005 18:18:46 +0000 (+0000) Subject: Added a better exception handling message for keyboard interrupt and added countdown... X-Git-Tag: CATALYST_2_0_6_916~760 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=524849d98c3aec69925e20206c3f6d4aa379787c;p=catalyst.git Added a better exception handling message for keyboard interrupt and added countdown timer for purge operation to give an opportunity to exit git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@623 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 44bd72c4..0a5032fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.235 2005/04/21 17:45:31 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.236 2005/04/21 18:18:46 rocket Exp $ + + 21 Apr 2005; Eric Edgar catalyst, + modules/catalyst_support.py, modules/generic_stage_target.py: + Added a better exception handling message for keyboard interrupt and added + countdown timer for purge operation to give an opportunity to exit 21 Apr 2005; Eric Edgar catalyst, modules/catalyst_support.py, modules/generic_stage_target.py: diff --git a/catalyst b/catalyst index 59562df2..43efd8bb 100755 --- a/catalyst +++ b/catalyst @@ -1,7 +1,7 @@ #!/usr/bin/python # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.74 2005/04/21 17:45:31 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.75 2005/04/21 18:18:46 rocket Exp $ # Maintained in full by: # Eric Edgar @@ -338,3 +338,6 @@ if __name__ == "__main__": except CatalystError: raise CatalystError,"Could not complete build" sys.exit(2) + except KeyboardInterrupt: + print "\nCatalyst build aborted due to user interrupt" + sys.exit(2) diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py index 3c22bfd1..df24966b 100644 --- a/modules/catalyst_support.py +++ b/modules/catalyst_support.py @@ -1,8 +1,8 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.41 2005/04/21 17:45:31 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.42 2005/04/21 18:18:46 rocket Exp $ -import sys,string,os,types,re,signal,traceback,md5 +import sys,string,os,types,re,signal,traceback,md5,time # a function to turn a string of non-printable characters into a string of # hex characters def hexify(str): @@ -358,3 +358,16 @@ def touch(myfile): myf.close() except IOError: raise CatalystError, "Could not touch "+myfile+"." + +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/generic_stage_target.py b/modules/generic_stage_target.py index 07570317..dd8ab95f 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.36 2005/04/21 17:45:31 rocket Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.37 2005/04/21 18:18:46 rocket Exp $ """ This class does all of the chroot setup, copying of files, etc. It is @@ -1012,6 +1012,7 @@ class generic_stage_target(generic_target): os.makedirs(myemp,0755) def purge(self): + countdown(10,"Purging Caches ...") if self.settings.has_key("PURGE"): print "clearing autoresume ..." self.clear_autoresume