[xmds2] 10/12: d/p/pyparsing-dict.patch: New patch

Rafael Laboissiere rafael at debian.org
Sun Jan 15 20:49:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

rafael pushed a commit to branch master
in repository xmds2.

commit 7cb29a3babda0671e664384010432689a2a4638e
Author: Rafael Laboissiere <rafael at debian.org>
Date:   Sun Jan 15 16:40:19 2017 -0200

    d/p/pyparsing-dict.patch: New patch
---
 debian/patches/pyparsing-dict.patch | 56 +++++++++++++++++++++++++++++++++++++
 debian/patches/series               |  1 +
 2 files changed, 57 insertions(+)

diff --git a/debian/patches/pyparsing-dict.patch b/debian/patches/pyparsing-dict.patch
new file mode 100644
index 0000000..62a5b2d
--- /dev/null
+++ b/debian/patches/pyparsing-dict.patch
@@ -0,0 +1,56 @@
+Description: Fix breakage arising from newer versions of pyparsing
+ The original implementation of the following code was
+ .
+ tokenDict = tokens.access[0].asDict()
+ .
+ The problem is that later versions of pyparsing return different
+ result strings for the asDict() method compared to earlier ones.
+ The specific breakage that occurred was between Ubuntu 16.04 (pyparsing 2.0.3)
+ and Ubuntu 16.10 (pyparsing 2.1.8). The dictionary returned by
+ pyparsing 2.1.8 has elements laid out in a different form, which then
+ breaks later code in this function (specifically
+ accessDict[key] = (' '.join(value[0].asList()), value.slice.start) )
+ .
+ To fix this, I skip the call to .asDict() and replace it with a simpler
+ version of what pyparsing 2.0.3 was doing internally.
+ This is backwards and forwards compatible for our purposes.
+ It's not Python 3 safe, though; also the pyparsing people may have changed
+ their code for good reason. Beware.
+Author: Mattias Johnsson <mattias.johnsson at mq.edu.au>
+Origin: https://sourceforge.net/p/xmds/code/2973
+Reviewed-by: Rafael Laboissière <rafael at debian.org>
+Last-Update: 2017-01-15
+
+--- a/xpdeint/CodeParser.py
++++ b/xpdeint/CodeParser.py
+@@ -151,7 +151,29 @@
+     for tokens, start, end in parser.scanString(codeBlock.codeString):
+         if tokens.name not in components: continue
+         accessDict = {}
+-        tokenDict = tokens.access[0].asDict()
++
++        # Note by MTJ:
++        #
++        # The original implementation of the following code was 
++        #
++        # tokenDict = tokens.access[0].asDict()
++        #
++        # The problem is that later versions of pyparsing return different
++        # result strings for the asDict() method compared to earlier ones.
++        # The specific breakage that occurred was between Ubuntu 16.04 (pyparsing 2.0.3)
++        # and Ubuntu 16.10 (pyparsing 2.1.8). The dictionary returned by 
++        # pyparsing 2.1.8 has elements laid out in a different form, which then
++        # breaks later code in this function (specifically 
++        # accessDict[key] = (' '.join(value[0].asList()), value.slice.start) )
++        # 
++        # To fix this, I skip the call to .asDict() and replace it with a simpler 
++        # version of what pyparsing 2.0.3 was doing internally.
++        # This is backwards and forwards compatible for our purposes.
++        # It's not Python 3 safe, though; also the pyparsing people may have changed
++        # their code for good reason. Beware.
++
++        tokenDict = dict(tokens.access[0].iteritems())
++
+         for key, value in tokenDict.items():
+             accessDict[key] = (' '.join(value[0].asList()), value.slice.start)
+         results.append((tokens.name, accessDict, slice(start, end)))
diff --git a/debian/patches/series b/debian/patches/series
index 3948d92..3cc1361 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 revision-number-as-deb-pkg.patch
 spelling-fix-in-manpage.patch
+pyparsing-dict.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/xmds2.git



More information about the debian-science-commits mailing list