From e6d4420784da14df61ec6cc1cf16bf7b539354cb Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 14 Aug 2010 09:37:43 -0700 Subject: [PATCH] Move 'phase' attribute to AbstractEbuildProcess from subclasses, so the _get_phase() method isn't needed. --- pym/_emerge/AbstractEbuildProcess.py | 18 +++++++++--------- pym/_emerge/EbuildProcess.py | 2 +- pym/_emerge/MiscFunctionsProcess.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 21fd88038..0dec65036 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -19,21 +19,21 @@ from portage.util import writemsg_stdout class AbstractEbuildProcess(SpawnProcess): - __slots__ = ('settings',) + \ + __slots__ = ('phase', 'settings',) + \ ('_ipc_daemon', '_exit_command',) _phases_without_builddir = ('clean', 'cleanrm', 'depend', 'help',) - def _get_phase(self): - phase = getattr(self, 'phase', None) - if not phase: + def __init__(self, **kwargs): + SpawnProcess.__init__(self, **kwargs) + if self.phase is None: phase = self.settings.get("EBUILD_PHASE") if not phase: phase = 'other' - return phase + self.phase = phase def _start(self): - if self._get_phase() not in self._phases_without_builddir: + if self.phase not in self._phases_without_builddir: self.settings['PORTAGE_IPC_DAEMON'] = "1" self._exit_command = ExitCommand() self._exit_command.reply_hook = self._exit_command_callback @@ -71,7 +71,7 @@ class AbstractEbuildProcess(SpawnProcess): self.cancel() def _orphan_process_warn(self): - phase = self._get_phase() + phase = self.phase msg = _("The ebuild phase '%s' with pid %s appears " "to have left an orphan process running in the " @@ -94,7 +94,7 @@ class AbstractEbuildProcess(SpawnProcess): def _unexpected_exit(self): - phase = self._get_phase() + phase = self.phase msg = _("The ebuild phase '%s' has exited " "unexpectedly. This type of behavior " @@ -120,7 +120,7 @@ class AbstractEbuildProcess(SpawnProcess): def _eerror(self, lines): out = StringIO() - phase = self._get_phase() + phase = self.phase for line in lines: eerror(line, phase=phase, key=self.settings.mycpv, out=out) logfile = self.logfile diff --git a/pym/_emerge/EbuildProcess.py b/pym/_emerge/EbuildProcess.py index 147f73a16..c643c3bd2 100644 --- a/pym/_emerge/EbuildProcess.py +++ b/pym/_emerge/EbuildProcess.py @@ -8,7 +8,7 @@ from portage.package.ebuild.doebuild import doebuild, \ class EbuildProcess(AbstractEbuildProcess): - __slots__ = ('phase', 'pkg', 'tree',) + __slots__ = ('pkg', 'tree',) def _start(self): # Don't open the log file during the clean phase since the diff --git a/pym/_emerge/MiscFunctionsProcess.py b/pym/_emerge/MiscFunctionsProcess.py index bc70448d0..eaf8c2235 100644 --- a/pym/_emerge/MiscFunctionsProcess.py +++ b/pym/_emerge/MiscFunctionsProcess.py @@ -11,7 +11,7 @@ class MiscFunctionsProcess(AbstractEbuildProcess): Spawns misc-functions.sh with an existing ebuild environment. """ - __slots__ = ('commands', 'phase', 'pkg',) + __slots__ = ('commands', 'pkg',) def _start(self): settings = self.settings -- 2.26.2