From d6313993a6559a752a13e8826fa95c1afb39b9cd Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Wed, 17 Feb 2010 21:53:06 +0100 Subject: pylint: Resolve method overriding with different arguments --- layman/overlays/bzr.py | 4 ++-- layman/overlays/cvs.py | 4 ++-- layman/overlays/darcs.py | 4 ++-- layman/overlays/git.py | 4 ++-- layman/overlays/mercurial.py | 4 ++-- layman/overlays/rsync.py | 4 ++-- layman/overlays/source.py | 44 +++++++++++++++++++++++--------------------- layman/overlays/svn.py | 4 ++-- layman/overlays/tar.py | 4 ++-- 9 files changed, 39 insertions(+), 37 deletions(-) diff --git a/layman/overlays/bzr.py b/layman/overlays/bzr.py index 346f1a0..8127fad 100644 --- a/layman/overlays/bzr.py +++ b/layman/overlays/bzr.py @@ -27,7 +27,7 @@ __version__ = "$Id: bzr.py 236 2006-09-05 20:39:37Z wrobel $" #------------------------------------------------------------------------------- from layman.utils import path -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -65,5 +65,5 @@ class BzrOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(BzrOverlay, self).supported([(self.command(), 'bzr', + return require_supported([(self.command(), 'bzr', 'dev-util/bzr'),]) diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py index 54aae5e..6fde19d 100644 --- a/layman/overlays/cvs.py +++ b/layman/overlays/cvs.py @@ -27,7 +27,7 @@ __version__ = "$Id$" import xml.etree.ElementTree as ET # Python 2.5 from layman.utils import path, ensure_unicode -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -99,5 +99,5 @@ class CvsOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(CvsOverlay, self).supported([(self.command(), 'cvs', + return require_supported([(self.command(), 'cvs', 'dev-util/cvs'),]) diff --git a/layman/overlays/darcs.py b/layman/overlays/darcs.py index 54a06aa..0b4f665 100644 --- a/layman/overlays/darcs.py +++ b/layman/overlays/darcs.py @@ -26,7 +26,7 @@ __version__ = "$Id: darcs.py 236 2006-09-05 20:39:37Z wrobel $" #------------------------------------------------------------------------------- from layman.utils import path -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -63,5 +63,5 @@ class DarcsOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(DarcsOverlay, self).supported([(self.command(), 'darcs', + return require_supported([(self.command(), 'darcs', 'dev-util/darcs'),]) diff --git a/layman/overlays/git.py b/layman/overlays/git.py index 174de18..3aab7d1 100644 --- a/layman/overlays/git.py +++ b/layman/overlays/git.py @@ -25,7 +25,7 @@ __version__ = "$Id: git.py 146 2006-05-27 09:52:36Z wrobel $" #------------------------------------------------------------------------------- from layman.utils import path -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -76,5 +76,5 @@ class GitOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(GitOverlay, self).supported([(self.command(), 'git', + return require_supported([(self.command(), 'git', 'dev-util/git'),]) diff --git a/layman/overlays/mercurial.py b/layman/overlays/mercurial.py index 2bda112..f1402fa 100644 --- a/layman/overlays/mercurial.py +++ b/layman/overlays/mercurial.py @@ -26,7 +26,7 @@ __version__ = "$Id: mercurial.py 236 2006-09-05 20:39:37Z wrobel $" #------------------------------------------------------------------------------- from layman.utils import path -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -63,5 +63,5 @@ class MercurialOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(MercurialOverlay, self).supported([(self.command(), 'mercurial', + return require_supported([(self.command(), 'mercurial', 'dev-util/mercurial'),]) diff --git a/layman/overlays/rsync.py b/layman/overlays/rsync.py index 9106403..495d2ba 100644 --- a/layman/overlays/rsync.py +++ b/layman/overlays/rsync.py @@ -25,7 +25,7 @@ __version__ = "$Id: rsync.py 236 2006-09-05 20:39:37Z wrobel $" #------------------------------------------------------------------------------- from layman.utils import path -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -73,5 +73,5 @@ class RsyncOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(RsyncOverlay, self).supported([(self.command(), 'rsync', + return require_supported([(self.command(), 'rsync', 'net-misc/rsync'),]) diff --git a/layman/overlays/source.py b/layman/overlays/source.py index 0dc1ba2..c004f3d 100644 --- a/layman/overlays/source.py +++ b/layman/overlays/source.py @@ -20,6 +20,28 @@ import subprocess from layman.debug import OUT from layman.utils import path + +def require_supported(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 + + class OverlaySource(object): def __init__(self, parent, xml, config, _location, ignore = 0, quiet = False): @@ -61,28 +83,8 @@ class OverlaySource(object): OUT.info('Deleting directory "%s"' % mdir, 2) shutil.rmtree(mdir) - def supported(self, binaries = []): + def supported(self): '''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): diff --git a/layman/overlays/svn.py b/layman/overlays/svn.py index 22b57e4..25392a8 100644 --- a/layman/overlays/svn.py +++ b/layman/overlays/svn.py @@ -25,7 +25,7 @@ __version__ = "$Id: svn.py 236 2006-09-05 20:39:37Z wrobel $" #------------------------------------------------------------------------------- from layman.utils import path -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -74,5 +74,5 @@ class SvnOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(SvnOverlay, self).supported([(self.command(), 'svn', + return require_supported([(self.command(), 'svn', 'dev-util/subversion'),]) diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py index 65fbc39..c994858 100644 --- a/layman/overlays/tar.py +++ b/layman/overlays/tar.py @@ -29,7 +29,7 @@ import xml.etree.ElementTree as ET # Python 2.5 from layman.utils import path, ensure_unicode from layman.debug import OUT -from layman.overlays.source import OverlaySource +from layman.overlays.source import OverlaySource, require_supported #=============================================================================== # @@ -197,7 +197,7 @@ class TarOverlay(OverlaySource): def supported(self): '''Overlay type supported?''' - return super(TarOverlay, self).supported([(self.command(), 'tar', 'app-arch/tar'), ]) + return require_supported([(self.command(), 'tar', 'app-arch/tar'), ]) if __name__ == '__main__': import doctest -- cgit v1.2.3-1-g7c22