Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Zac Medico (zmedico)" <zmedico@g.o>
Subject: portage r10952 - main/trunk/pym/_emerge
Date: Sun, 06 Jul 2008 03:44:26 +0000

 1.1

Author: zmedico
Date: 2008-07-06 03:44:25 +0000 (Sun, 06 Jul 2008)
New Revision: 10952

Modified:
   main/trunk/pym/_emerge/__init__.py
Log:
Split out a CompositeTask._start_task() for subclasses to use as a generic
way to start a task.


Modified: main/trunk/pym/_emerge/__init__.py
===================================================================
--- main/trunk/pym/_emerge/__init__.py	2008-07-06 01:51:50 UTC (rev 10951)
+++ main/trunk/pym/_emerge/__init__.py	2008-07-06 03:44:25 UTC (rev 10952)
@@ -1565,6 +1565,19 @@
 		self._current_task = None
 		self.returncode = task.returncode
 
+	def _start_task(self, task, exit_handler):
+		"""
+		Register exit handler for the given task, set it
+		as self._current_task, and call task.start().
+
+		Subclasses can use this as a generic way to start
+		a task.
+
+		"""
+		task.addExitListener(exit_handler)
+		self._current_task = task
+		task.start()
+
 class TaskSequence(CompositeTask):
 	"""
 	A collection of tasks that executes sequentially. Each task
@@ -1589,10 +1602,8 @@
 		CompositeTask.cancel(self)
 
 	def _start_next_task(self):
-		self._current_task = self._task_queue.popleft()
-		task = self._current_task
-		task.addExitListener(self._task_exit_handler)
-		task.start()
+		self._start_task(self._task_queue.popleft(),
+			self._task_exit_handler)
 
 	def _task_exit_handler(self, task):
 		if self._default_exit(task) == os.EX_OK and \
@@ -2006,9 +2017,7 @@
 		phase = "clean"
 		clean_phase = EbuildPhase(pkg=pkg, phase=phase,
 			scheduler=scheduler, settings=settings, tree=tree)
-		clean_phase.addExitListener(self._clean_phase_exit)
-		self._current_task = clean_phase
-		clean_phase.start()
+		self._start_task(clean_phase, self._clean_phase_exit)
 
 	def _clean_phase_exit(self, clean_phase):
 
@@ -2037,9 +2046,7 @@
 				pkg=pkg, phase=phase, scheduler=scheduler,
 				settings=settings, tree=tree))
 
-		ebuild_phases.addExitListener(self._final_exit)
-		self._current_task = ebuild_phases
-		ebuild_phases.start()
+		self._start_task(ebuild_phases, self._final_exit)
 
 class EbuildPhase(SubProcess):
 

-- 
gentoo-commits@g.o mailing list


Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
gentoo-x86 commit in sys-devel/gcc: ChangeLog gcc-4.3.1-r1.ebuild
Next by thread:
portage r10953 - main/trunk/pym/_emerge
Previous by date:
gentoo-x86 commit in sys-devel/gcc: ChangeLog gcc-4.3.1-r1.ebuild
Next by date:
gentoo-x86 commit in app-text/texlive-core: texlive-core-2007-r13.ebuild ChangeLog


Oct 12, 2008

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.