summaryrefslogtreecommitdiffstats
path: root/layman/overlays
diff options
context:
space:
mode:
authorBrian Dolbec <brian.dolbec@gmail.com>2010-07-06 18:08:46 -0700
committerBrian Dolbec <brian.dolbec@gmail.com>2011-02-11 02:48:36 -0800
commit3731e182e0577165ede11e95d4bd447354ce3786 (patch)
tree177ece7e571a67d95ec064852e5af4c31f1a4006 /layman/overlays
parentc387c4eff9eb13ece3108cf1b5818d0ba6551f1f (diff)
downloadlayman-3731e182e0577165ede11e95d4bd447354ce3786.tar.gz
layman-3731e182e0577165ede11e95d4bd447354ce3786.tar.bz2
layman-3731e182e0577165ede11e95d4bd447354ce3786.zip
Change the remaining modules to use the config['output'] variable so re-direction is possible for all output.
Diffstat (limited to 'layman/overlays')
-rw-r--r--layman/overlays/overlay.py10
-rw-r--r--layman/overlays/source.py13
-rw-r--r--layman/overlays/tar.py6
3 files changed, 17 insertions, 12 deletions
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 2333d72..4036458 100644
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -35,7 +35,7 @@ import xml.etree.ElementTree as ET # Python 2.5
from layman.utils import ensure_unicode
-from layman.debug import OUT
+#from layman.debug import OUT
from layman.overlays.bzr import BzrOverlay
from layman.overlays.darcs import DarcsOverlay
@@ -100,6 +100,8 @@ class Overlay(object):
False
'''
+ self.output = config['output']
+
def strip_text(node):
res = node.text
if res is None:
@@ -161,7 +163,7 @@ class Overlay(object):
raise Exception('Overlay "' + self.name + '" is missing a '
'"owner.email" entry!')
elif ignore == 1:
- OUT.warn('Overlay "' + self.name + '" is missing a '
+ self.output.warn('Overlay "' + self.name + '" is missing a '
'"owner.email" entry!', 4)
@@ -176,7 +178,7 @@ class Overlay(object):
raise Exception('Overlay "' + self.name + '" is missing a '
'"description" entry!')
elif ignore == 1:
- OUT.warn('Overlay "' + self.name + '" is missing a '
+ self.output.warn('Overlay "' + self.name + '" is missing a '
'"description" entry!', 4)
if 'status' in xml.attrib:
@@ -279,7 +281,7 @@ class Overlay(object):
self.sources = [s]
break
except Exception, error:
- OUT.warn(str(error), 4)
+ self.output.warn(str(error), 4)
return res
def sync(self, base, quiet = False):
diff --git a/layman/overlays/source.py b/layman/overlays/source.py
index 2c039c9..9f7eaef 100644
--- a/layman/overlays/source.py
+++ b/layman/overlays/source.py
@@ -18,7 +18,7 @@ import copy
import sys
import shutil
import subprocess
-from layman.debug import OUT
+#from layman.debug import OUT
from layman.utils import path
@@ -58,6 +58,7 @@ class OverlaySource(object):
self.config = config
self.ignore = ignore
self.quiet = quiet
+ self.output = config['output']
def __eq__(self, other):
return self.src == other.src
@@ -85,10 +86,10 @@ class OverlaySource(object):
mdir = path([base, self.parent.name])
if not os.path.exists(mdir):
- OUT.warn('Directory ' + mdir + ' did not exist, no files deleted.')
+ self.output.warn('Directory ' + mdir + ' did not exist, no files deleted.')
return
- OUT.info('Deleting directory "%s"' % mdir, 2)
+ self.output.info('Deleting directory "%s"' % mdir, 2)
shutil.rmtree(mdir)
def supported(self):
@@ -127,7 +128,7 @@ class OverlaySource(object):
if cwd:
command_repr = '( cd %s && %s )' % (cwd, command_repr)
- OUT.info('Running... # %s' % command_repr, 2)
+ self.output.info('Running... # %s' % command_repr, 2)
if self.quiet:
input_source = subprocess.PIPE
@@ -140,7 +141,7 @@ class OverlaySource(object):
proc = subprocess.Popen(args,
stdin=input_source,
stdout=output_target,
- stderr=output_target,
+ stderr=self.config['stderr'],
cwd=cwd,
env=env)
@@ -151,7 +152,7 @@ class OverlaySource(object):
try:
result = proc.wait()
except KeyboardInterrupt:
- OUT.info('Interrupted manually', 2)
+ self.output.info('Interrupted manually', 2)
result = 1
if self.quiet:
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index 919f4df..4916b77 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -28,7 +28,7 @@ import os, os.path, sys, urllib2, shutil, tempfile
import xml.etree.ElementTree as ET # Python 2.5
from layman.utils import path, ensure_unicode
-from layman.debug import OUT
+#from layman.debug import OUT
from layman.overlays.source import OverlaySource, require_supported
#===============================================================================
@@ -85,6 +85,8 @@ class TarOverlay(OverlaySource):
else:
self.subpath = ''
+ self.output = config['output']
+
def __eq__(self, other):
res = super(TarOverlay, self).__eq__(other) \
and self.subpath == other.subpath
@@ -139,7 +141,7 @@ class TarOverlay(OverlaySource):
return
try:
- OUT.info('Deleting directory "%s"' % folder, 2)
+ self.output.info('Deleting directory "%s"' % folder, 2)
shutil.rmtree(folder)
except Exception, error:
raise Exception('Failed to remove unnecessary tar structure "'