Drop colordiff, implement it in PgDiff directly.
--- a/pgtoolkit/colordiff.py Thu Jan 31 13:24:57 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-from subprocess import Popen, PIPE
-
-
-def colordiff(diff):
- """Colorize diff output using external program colordiff"""
- try:
- p = Popen(["colordiff"], stdin=PIPE, stdout=PIPE, close_fds=True)
- outs, _errs = p.communicate(diff.encode('utf8'))
- return outs.decode('utf8')
- except OSError:
- return diff
-
--- a/pgtoolkit/pgdiff.py Thu Jan 31 13:24:57 2013 +0100
+++ b/pgtoolkit/pgdiff.py Thu Jan 31 13:41:48 2013 +0100
@@ -26,7 +26,6 @@
from pgtoolkit.highlight import *
-from pgtoolkit.colordiff import colordiff
import re
import difflib
@@ -158,10 +157,9 @@
for line in difflib.unified_diff(a, b, lineterm=''):
if line[:3] in ('---', '+++'):
continue
- lines.append(line + '\n')
- diff = ''.join(lines)
- diff = colordiff(diff)
- res.append(diff)
+ color = {' ': WHITE, '-': YELLOW, '+': GREEN, '@': WHITE|BOLD}[line[0]]
+ lines.append(highlight(1, color) + line + highlight(0) + '\n')
+ res.append(''.join(lines))
else:
res.append('Source differs.')
else: