initial commit
[ebuildfind.git] / commands / lib / layman / overlays / bzr.py
blob4c14278c83d179524b924abbf3cb2d9accc5377e
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #################################################################################
4 # LAYMAN BZR OVERLAY HANDLER
5 #################################################################################
6 # File: bzr.py
8 # Handles bzr overlays
10 # Copyright:
11 # (c) 2005 - 2008 Adrian Perez, Gunnar Wrobel
12 # Distributed under the terms of the GNU General Public License v2
14 # Author(s):
15 # Adrian Perez <moebius@connectical.net>
16 # Gunnar Wrobel <wrobel@gentoo.org>
18 '''Should work with any version of Bzr equal to or better than 0.7 --
19 caution: tested only with 0.8 and 0.8.2...'''
21 __version__ = "$Id: bzr.py 236 2006-09-05 20:39:37Z wrobel $"
23 #===============================================================================
25 # Dependencies
27 #-------------------------------------------------------------------------------
29 from layman.utils import path
30 from layman.overlays.overlay import Overlay
32 #===============================================================================
34 # Class BzrOverlay
36 #-------------------------------------------------------------------------------
38 class BzrOverlay(Overlay):
39 ''' Handles bzr overlays.'''
41 type = 'Bzr'
43 binary_command = '/usr/bin/bzr'
45 def add(self, base, quiet = False):
46 '''Add overlay.'''
48 self.supported()
50 return self.cmd(self.binary_command + ' get "' + self.src + '/" "' +\
51 path([base, self.name]) + '"')
53 def sync(self, base, quiet = False):
54 '''Sync overlay.'''
56 self.supported()
58 return self.cmd('cd "' + path([base, self.name]) + '" && ' + \
59 self.binary_command + ' pull --overwrite "' + self.src \
60 + '"')
62 def supported(self):
63 '''Overlay type supported?'''
65 return Overlay.supported(self, [(self.binary_command, 'bzr',
66 'dev-util/bzr'),])