summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-03-08 16:47:16 -0500
committerMike Frysinger <vapier@gentoo.org>2012-03-10 20:40:29 -0500
commit3467a10ba5eb37f67899e772c2951992dc28f46c (patch)
tree263f9f4e14022b0d9ece223f22d6d273febc4681 /pym
parent20403c15331c63f5bbdc6dabbd8c9b3ad291aaca (diff)
downloadportage-3467a10ba5eb37f67899e772c2951992dc28f46c.tar.gz
portage-3467a10ba5eb37f67899e772c2951992dc28f46c.tar.bz2
portage-3467a10ba5eb37f67899e772c2951992dc28f46c.zip
dispatch-conf: do regex matching ourselves
This avoids having to pipe through multiple greps, as well as running diff multiple times on the same set of files. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dispatch_conf.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
index 7f407fffe..6e8de0f43 100644
--- a/pym/portage/dispatch_conf.py
+++ b/pym/portage/dispatch_conf.py
@@ -23,18 +23,18 @@ RCS_MERGE = "rcsmerge -p -r" + RCS_BRANCH + " '%s' > '%s'"
DIFF3_MERGE = "diff3 -mE '%s' '%s' '%s' > '%s'"
-def diffstatusoutput_len(cmd):
+def diffstatusoutput(cmd, file1, file2):
"""
Execute the string cmd in a shell with getstatusoutput() and return a
- 2-tuple (status, output_length). If getstatusoutput() raises
+ 2-tuple (status, output). If getstatusoutput() raises
UnicodeDecodeError (known to happen with python3.1), return a
2-tuple (1, 1). This provides a simple way to check for non-zero
output length of diff commands, while providing simple handling of
UnicodeDecodeError when necessary.
"""
try:
- status, output = portage.subprocess_getstatusoutput(cmd)
- return (status, len(output))
+ status, output = portage.subprocess_getstatusoutput(cmd % (file1, file2))
+ return (status, output)
except UnicodeDecodeError:
return (1, 1)