* [gentoo-portage-dev] [PATCH 2/3] portage/sync/syncbase.py: Change has_bin to an @property function
@ 2015-01-29 19:45 99% ` Brian Dolbec
0 siblings, 0 replies; 1+ results
From: Brian Dolbec @ 2015-01-29 19:45 UTC (permalink / raw
To: gentoo-portage-dev
This avoids that self.logger is None error in the __init__().
---
pym/portage/sync/syncbase.py | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index c820bcf..973d545 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -35,17 +35,23 @@ class SyncBase(object):
self.xterm_titles = None
self.spawn_kwargs = None
self.bin_command = None
- self.has_bin = False
+ self._bin_command = bin_command
+ self.bin_pkg = bin_pkg
if bin_command:
self.bin_command = portage.process.find_binary(bin_command)
- if self.bin_command is None:
- msg = ["Command not found: %s" % bin_command,
- "Type \"emerge %s\" to enable %s support." % (bin_pkg, bin_command)]
- for l in msg:
- writemsg_level("!!! %s\n" % l,
- level=self.logger.ERROR, noiselevel=-1)
- else:
- self.has_bin = True
+
+
+ @property
+ def has_bin(self):
+ if self.bin_command is None:
+ msg = ["Command not found: %s" % self._bin_command,
+ "Type \"emerge %s\" to enable %s support."
+ % (self.bin_pkg, self._bin_command)]
+ for l in msg:
+ writemsg_level("!!! %s\n" % l,
+ level=self.logger.ERROR, noiselevel=-1)
+ return False
+ return True
def _kwargs(self, kwargs):
--
2.2.2
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-01-29 19:45 [gentoo-portage-dev] portage sync changes, fixes Brian Dolbec
2015-01-29 19:45 99% ` [gentoo-portage-dev] [PATCH 2/3] portage/sync/syncbase.py: Change has_bin to an @property function Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox