summaryrefslogtreecommitdiffstats
path: root/layman
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2009-12-29 13:35:33 +0100
committerSebastian Pipping <sebastian@pipping.org>2009-12-29 13:35:33 +0100
commit4e5db6241219e5daf79ac20967aef03097d70bb8 (patch)
treecd5cf3c0f849f273d4f5e923ece5205bb296ac58 /layman
parent3ef674c91931a22a51bcdeb840897147c35e1db5 (diff)
downloadlayman-4e5db6241219e5daf79ac20967aef03097d70bb8.tar.gz
layman-4e5db6241219e5daf79ac20967aef03097d70bb8.tar.bz2
layman-4e5db6241219e5daf79ac20967aef03097d70bb8.zip
Pass config down to Overlay instances
Diffstat (limited to 'layman')
-rw-r--r--layman/db.py11
-rw-r--r--layman/overlay.py16
-rw-r--r--layman/overlays/bzr.py4
-rw-r--r--layman/overlays/cvs.py4
-rw-r--r--layman/overlays/darcs.py4
-rw-r--r--layman/overlays/git.py4
-rw-r--r--layman/overlays/mercurial.py4
-rw-r--r--layman/overlays/overlay.py11
-rw-r--r--layman/overlays/rsync.py4
-rw-r--r--layman/overlays/svn.py4
-rw-r--r--layman/overlays/tar.py4
11 files changed, 49 insertions, 21 deletions
diff --git a/layman/db.py b/layman/db.py
index 61c0944..db4a4c5 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -54,7 +54,8 @@ class DB(Overlays):
quiet = int(config['quietness']) < 3
Overlays.__init__(self,
- [config['local_list'], ],
+ [config['local_list'], ],
+ config,
ignore,
quiet)
@@ -89,7 +90,7 @@ class DB(Overlays):
# >>> b.add(a.select('wrobel-stable')) #doctest: +ELLIPSIS
# * Running command "/usr/bin/rsync -rlptDvz --progress --delete --delete-after --timeout=180 --exclude="distfiles/*" --exclude="local/*" --exclude="packages/*" "rsync://gunnarwrobel.de/wrobel-stable/*" "/tmp/file.../wrobel-stable""...
- # >>> c = Overlays([write, ])
+ # >>> c = Overlays([write, ], dict())
# >>> c.overlays.keys()
# [u'wrobel-stable']
@@ -156,12 +157,12 @@ class DB(Overlays):
# * Running command "/usr/bin/rsync -rlptDvz --progress --delete --delete-after --timeout=180 --exclude="distfiles/*" --exclude="local/*" --exclude="packages/*" "rsync://gunnarwrobel.de/wrobel-stable/*" "/tmp/file.../wrobel-stable""...
# >>> b.add(a.select('wrobel')) #doctest: +ELLIPSIS
# * Running command "/usr/bin/svn co "https://overlays.gentoo.org/svn/dev/wrobel/" "/tmp/file.../wrobel""...
- # >>> c = Overlays([write, ])
+ # >>> c = Overlays([write, ], dict())
# >>> c.overlays.keys()
# [u'wrobel', u'wrobel-stable']
# >>> b.delete(b.select('wrobel'))
- # >>> c = Overlays([write, ])
+ # >>> c = Overlays([write, ], dict())
# >>> c.overlays.keys()
# [u'wrobel-stable']
@@ -234,7 +235,7 @@ class RemoteDB(Overlays):
quiet = int(config['quietness']) < 3
- Overlays.__init__(self, paths, ignore, quiet)
+ Overlays.__init__(self, paths, config, ignore, quiet)
def cache(self):
'''
diff --git a/layman/overlay.py b/layman/overlay.py
index 37e611c..d2126a8 100644
--- a/layman/overlay.py
+++ b/layman/overlay.py
@@ -69,8 +69,9 @@ OVERLAY_TYPES = dict((e.type_key, e) for e in (
class Overlays:
''' Handle a list of overlays.'''
- def __init__(self, paths, ignore = 0, quiet = False):
+ def __init__(self, paths, config, ignore = 0, quiet = False):
+ self.config = config
self.quiet = quiet
self.paths = paths
self.ignore = ignore
@@ -101,7 +102,7 @@ class Overlays:
>>> here = os.path.dirname(os.path.realpath(__file__))
- >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ])
+ >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ], dict())
>>> a.overlays.keys()
[u'wrobel', u'wrobel-stable']
@@ -127,6 +128,7 @@ class Overlays:
if overlay_type in OVERLAY_TYPES.keys():
try:
ovl = OVERLAY_TYPES[overlay_type](overlay,
+ self.config,
self.ignore,
self.quiet)
self.overlays[ovl.name] = ovl
@@ -144,11 +146,11 @@ class Overlays:
>>> write = os.tmpnam()
>>> here = os.path.dirname(os.path.realpath(__file__))
- >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ])
- >>> b = Overlays([write,])
+ >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ], dict())
+ >>> b = Overlays([write,], dict())
>>> b.overlays['wrobel-stable'] = a.overlays['wrobel-stable']
>>> b.write(write)
- >>> c = Overlays([write,])
+ >>> c = Overlays([write,], dict())
>>> c.overlays.keys()
[u'wrobel-stable']
@@ -175,7 +177,7 @@ class Overlays:
Select an overlay from the list.
>>> here = os.path.dirname(os.path.realpath(__file__))
- >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ])
+ >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ], dict())
>>> a.select('wrobel-stable').src
u'rsync://gunnarwrobel.de/wrobel-stable'
'''
@@ -187,7 +189,7 @@ class Overlays:
List all overlays.
>>> here = os.path.dirname(os.path.realpath(__file__))
- >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ])
+ >>> a = Overlays([here + '/tests/testfiles/global-overlays.xml', ], dict())
>>> for i in a.list(True):
... print i[0]
wrobel
diff --git a/layman/overlays/bzr.py b/layman/overlays/bzr.py
index 64fbbdd..047d944 100644
--- a/layman/overlays/bzr.py
+++ b/layman/overlays/bzr.py
@@ -43,6 +43,10 @@ class BzrOverlay(Overlay):
binary_command = '/usr/bin/bzr'
+ def __init__(self, xml, config, ignore = 0, quiet = False):
+
+ Overlay.__init__(self, xml, config, ignore)
+
def add(self, base, quiet = False):
'''Add overlay.'''
diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py
index a28889a..fa67871 100644
--- a/layman/overlays/cvs.py
+++ b/layman/overlays/cvs.py
@@ -41,9 +41,9 @@ class CvsOverlay(Overlay):
binary = '/usr/bin/cvs'
- def __init__(self, xml, ignore = 0, quiet = False):
+ def __init__(self, xml, config, ignore = 0, quiet = False):
- Overlay.__init__(self, xml, ignore, quiet)
+ Overlay.__init__(self, xml, config, ignore, quiet)
if 'subpath' in xml.attrib:
self.subpath = xml.attrib['subpath']
diff --git a/layman/overlays/darcs.py b/layman/overlays/darcs.py
index e066eee..de23248 100644
--- a/layman/overlays/darcs.py
+++ b/layman/overlays/darcs.py
@@ -42,6 +42,10 @@ class DarcsOverlay(Overlay):
binary_command = '/usr/bin/darcs'
+ def __init__(self, xml, config, ignore = 0, quiet = False):
+
+ Overlay.__init__(self, xml, config, ignore)
+
def add(self, base, quiet = False):
'''Add overlay.'''
diff --git a/layman/overlays/git.py b/layman/overlays/git.py
index 3bcb3e3..ece0de3 100644
--- a/layman/overlays/git.py
+++ b/layman/overlays/git.py
@@ -41,6 +41,10 @@ class GitOverlay(Overlay):
binary_command = '/usr/bin/git'
+ def __init__(self, xml, config, ignore = 0, quiet = False):
+
+ Overlay.__init__(self, xml, config, ignore)
+
def add(self, base, quiet = False):
'''Add overlay.'''
diff --git a/layman/overlays/mercurial.py b/layman/overlays/mercurial.py
index 03af63b..9e0c5e7 100644
--- a/layman/overlays/mercurial.py
+++ b/layman/overlays/mercurial.py
@@ -42,6 +42,10 @@ class MercurialOverlay(Overlay):
binary_command = '/usr/bin/hg'
+ def __init__(self, xml, config, ignore = 0, quiet = False):
+
+ Overlay.__init__(self, xml, config, ignore)
+
def add(self, base, quiet = False):
'''Add overlay.'''
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index aef4fe9..580ff47 100644
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -46,13 +46,13 @@ class Overlay:
type = 'None'
- def __init__(self, xml, ignore = 0, quiet = False):
+ def __init__(self, xml, config, ignore = 0, quiet = False):
'''
>>> here = os.path.dirname(os.path.realpath(__file__))
>>> import xml.etree.ElementTree as ET # Python 2.5
>>> document = ET.parse(here + '/../tests/testfiles/global-overlays.xml')
>>> overlays = document.findall('overlay') + document.findall('repo')
- >>> a = Overlay(overlays[0])
+ >>> a = Overlay(overlays[0], dict())
>>> a.name
u'wrobel'
>>> a.is_official()
@@ -65,10 +65,11 @@ class Overlay:
u'Test'
>>> a.priority
10
- >>> b = Overlay(overlays[1])
+ >>> b = Overlay(overlays[1], dict())
>>> b.is_official()
False
'''
+ self.config = config
self.quiet = quiet
_name = xml.find('name')
@@ -231,7 +232,7 @@ class Overlay:
>>> import xml.etree.ElementTree as ET # Python 2.5
>>> document = ET.parse(here + '/../tests/testfiles/global-overlays.xml')
>>> overlays = document.findall('overlay') + document.findall('repo')
- >>> a = Overlay(overlays[0])
+ >>> a = Overlay(overlays[0], dict())
>>> print str(a)
wrobel
~~~~~~
@@ -279,7 +280,7 @@ class Overlay:
>>> import xml.etree.ElementTree as ET # Python 2.5
>>> document = ET.parse(here + '/../tests/testfiles/global-overlays.xml')
>>> overlays = document.findall('repo') + document.findall('overlay')
- >>> a = Overlay(overlays[0])
+ >>> a = Overlay(overlays[0], dict())
>>> print a.short_list(80)
wrobel [None ] (https://o.g.o/svn/dev/wrobel )
'''
diff --git a/layman/overlays/rsync.py b/layman/overlays/rsync.py
index 1fc767f..936a15d 100644
--- a/layman/overlays/rsync.py
+++ b/layman/overlays/rsync.py
@@ -45,6 +45,10 @@ class RsyncOverlay(Overlay):
'--timeout=180 --exclude="distfiles/*" --exclude="local/*" ' + \
'--exclude="packages/*" '
+ def __init__(self, xml, config, ignore = 0, quiet = False):
+
+ Overlay.__init__(self, xml, config, ignore)
+
def add(self, base, quiet = False):
'''Add overlay.'''
diff --git a/layman/overlays/svn.py b/layman/overlays/svn.py
index 8fef998..6c41569 100644
--- a/layman/overlays/svn.py
+++ b/layman/overlays/svn.py
@@ -41,6 +41,10 @@ class SvnOverlay(Overlay):
binary = '/usr/bin/svn'
+ def __init__(self, xml, config, ignore = 0, quiet = False):
+
+ Overlay.__init__(self, xml, config, ignore)
+
def add(self, base, quiet = False):
'''Add overlay.'''
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index 4990b2b..26010e0 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -66,9 +66,9 @@ class TarOverlay(Overlay):
binary = u'/bin/tar'
- def __init__(self, xml, ignore = 0, quiet = False):
+ def __init__(self, xml, config, ignore = 0, quiet = False):
- Overlay.__init__(self, xml, ignore)
+ Overlay.__init__(self, xml, config, ignore)
if 'format' in xml.attrib:
self.format = xml.attrib['format']