1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 08_516143_xml_is_text.dpatch by Y Giridhar Appaji Nag <appaji@debian.org>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Don't classify XML files as non-text, thanks "J.P. Delport"
6
## DP: <jpdelport@csir.co.za> for the bug report #516143 and the patch.
9
diff -urNad xxdiff-3.2~/lib/python/xxdiff/utils.py xxdiff-3.2/lib/python/xxdiff/utils.py
10
--- xxdiff-3.2~/lib/python/xxdiff/utils.py 2008-09-30 18:03:57.000000000 +0530
11
+++ xxdiff-3.2/lib/python/xxdiff/utils.py 2009-02-24 14:48:08.000000000 +0530
13
# options were taken from Ian F. Darwin's file implementation.
14
guesscmd = ['file', '-b', '-L']
15
text_re = re.compile('\\btext\\b')
16
+xml_re = re.compile('\\bXML\\b')
17
empty_re = re.compile('^empty$')
21
if p.returncode != 0 or stderr or stdout.startswith('cannot open'):
22
raise RuntimeError("Error: Running 'file' on '%s'." % fn)
24
- return bool(text_re.search(stdout) or empty_re.match(stdout))
25
+ return bool(text_re.search(stdout) or xml_re.search(stdout) or empty_re.match(stdout))
28
#-------------------------------------------------------------------------------