From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D9B371381F3 for ; Thu, 25 Apr 2013 16:44:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0BAD4E0B9F; Thu, 25 Apr 2013 16:44:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A07C2E0B9E for ; Thu, 25 Apr 2013 16:44:24 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0DFDE33DF6A for ; Thu, 25 Apr 2013 16:44:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 81290E441D for ; Thu, 25 Apr 2013 16:44:20 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1366902584.2e601a6f8b3171fde698c7f5284dbc94b35705bc.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/overlay/category.py X-VCS-Directories: roverlay/overlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 2e601a6f8b3171fde698c7f5284dbc94b35705bc X-VCS-Branch: master Date: Thu, 25 Apr 2013 16:44:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2cccbb50-4952-4b23-b08e-c746ff346f08 X-Archives-Hash: a943054f3c1fac410bf1ed5909dc6c79 commit: 2e601a6f8b3171fde698c7f5284dbc94b35705bc Author: André Erdmann mailerd de> AuthorDate: Thu Apr 25 15:09:44 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Apr 25 15:09:44 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=2e601a6f overlay/category: stop queue workers Stop write queue workers when an exception is caught. Also changed the RERAISE code (again). --- roverlay/overlay/category.py | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/roverlay/overlay/category.py b/roverlay/overlay/category.py index 97f87e7..dd55c14 100644 --- a/roverlay/overlay/category.py +++ b/roverlay/overlay/category.py @@ -199,7 +199,7 @@ class Category ( object ): * q -- queue * write_kw -- keywords for write(...) """ - while not q.empty(): + while not q.empty() and not hasattr ( self, 'RERAISE' ): try: pkg = q.get_nowait() # remove manifest writing from threaded writing since it's @@ -207,7 +207,8 @@ class Category ( object ): pkg.write ( **write_kw ) except queue.Empty: break - except: + except ( Exception, KeyboardInterrupt ) as err: + self.logger.exception ( err ) self.RERAISE = sys.exc_info() # --- end of run_write_queue (...) --- @@ -258,7 +259,19 @@ class Category ( object ): for w in workers: w.join() if hasattr ( self, 'RERAISE' ) and self.RERAISE: - raise ( self.RERAISE [0], self.RERAISE [1], self.RERAISE [2] ) + # ref: PEP 3109 + # results in correct traceback when running python 3.x + # and inaccurate traceback with python 2.x, + # which can be tolerated since the exception has been logged + try: + reraise = self.RERAISE[0] ( self.RERAISE[1] ) + except TypeError: + # "portage.exception.FileNotFound is not subscriptable" + reraise = self.RERAISE[1] + + reraise.__traceback__ = self.RERAISE [2] + raise reraise + # --- end RERAISE; self.remove_empty()