summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2010-01-13 00:29:03 +0100
committerSebastian Pipping <sebastian@pipping.org>2010-01-13 02:39:59 +0100
commit82643d91c7814033626885285ee51ac06e66cbe9 (patch)
tree60bdb151429691a7068be549af7513b9620a06bc
parent3f95bfa1f070876ee9f355c7a31d2cd03b089977 (diff)
downloadlayman-82643d91c7814033626885285ee51ac06e66cbe9.tar.gz
layman-82643d91c7814033626885285ee51ac06e66cbe9.tar.bz2
layman-82643d91c7814033626885285ee51ac06e66cbe9.zip
Move a few methods down from Overlay to OverlaySource
-rw-r--r--layman/overlays/overlay.py36
-rw-r--r--layman/overlays/source.py37
2 files changed, 37 insertions, 36 deletions
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index a1e6d0a..1356d28 100644
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -347,47 +347,11 @@ class Overlay(object):
return self._encode(name + mtype + source)
- def supported(self, binaries = []):
- '''Is the overlay type supported?'''
-
- if binaries:
- for command, mtype, package in binaries:
- found = False
- if os.path.isabs(command):
- kind = 'Binary'
- found = os.path.exists(command)
- else:
- kind = 'Command'
- for d in os.environ['PATH'].split(os.pathsep):
- f = os.path.join(d, command)
- if os.path.exists(f):
- found = True
- break
-
- if not found:
- raise Exception(kind + ' ' + command + ' seems to be missing!'
- ' Overlay type "' + mtype + '" not support'
- 'ed. Did you emerge ' + package + '?')
-
- return True
-
- def is_supported(self):
- '''Is the overlay type supported?'''
-
- try:
- self.supported()
- return True
- except Exception, error:
- return False
-
def is_official(self):
'''Is the overlay official?'''
return self.status == 'official'
- def command(self):
- return self.config['%s_command' % self.__class__.type_key]
-
#================================================================================
#
# Testing
diff --git a/layman/overlays/source.py b/layman/overlays/source.py
index 8ed9d31..1cd6b5b 100644
--- a/layman/overlays/source.py
+++ b/layman/overlays/source.py
@@ -13,8 +13,45 @@
# Author(s):
# Sebastian Pipping <sebastian@pipping.org>
+import os
from layman.overlays.overlay import Overlay
class OverlaySource(Overlay):
def __init__(self, xml, config, ignore = 0, quiet = False):
super(OverlaySource, self).__init__(xml, config, ignore, quiet)
+
+ def supported(self, binaries = []):
+ '''Is the overlay type supported?'''
+
+ if binaries:
+ for command, mtype, package in binaries:
+ found = False
+ if os.path.isabs(command):
+ kind = 'Binary'
+ found = os.path.exists(command)
+ else:
+ kind = 'Command'
+ for d in os.environ['PATH'].split(os.pathsep):
+ f = os.path.join(d, command)
+ if os.path.exists(f):
+ found = True
+ break
+
+ if not found:
+ raise Exception(kind + ' ' + command + ' seems to be missing!'
+ ' Overlay type "' + mtype + '" not support'
+ 'ed. Did you emerge ' + package + '?')
+
+ return True
+
+ def is_supported(self):
+ '''Is the overlay type supported?'''
+
+ try:
+ self.supported()
+ return True
+ except Exception, error:
+ return False
+
+ def command(self):
+ return self.config['%s_command' % self.__class__.type_key]