summaryrefslogtreecommitdiffstats
path: root/pym/_emerge
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-14 09:37:43 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-14 09:37:43 -0700
commite6d4420784da14df61ec6cc1cf16bf7b539354cb (patch)
treeaf56ad4b9d2043d29edf75383df76e07447706a4 /pym/_emerge
parente38aa7eef4b9ddf873cc0958ef4511e4577106ff (diff)
downloadportage-e6d4420784da14df61ec6cc1cf16bf7b539354cb.tar.gz
portage-e6d4420784da14df61ec6cc1cf16bf7b539354cb.tar.bz2
portage-e6d4420784da14df61ec6cc1cf16bf7b539354cb.zip
Move 'phase' attribute to AbstractEbuildProcess from subclasses, so
the _get_phase() method isn't needed.
Diffstat (limited to 'pym/_emerge')
-rw-r--r--pym/_emerge/AbstractEbuildProcess.py18
-rw-r--r--pym/_emerge/EbuildProcess.py2
-rw-r--r--pym/_emerge/MiscFunctionsProcess.py2
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