Package: ply / 3.9-1

relax-lex-tabversion-check.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 30bd4b7bbcf989ec11b211e8bc7a6842889db196 Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@debian.org>
Date: Thu, 8 Oct 2015 10:15:00 -0700
Subject: Don't break already built packages with wrong _tabversion

Forwarded: not-needed
Patch-Name: relax-lex-tabversion-check.patch
---
 ply/lex.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ply/lex.py b/ply/lex.py
index 0f3e464..0b44a75 100644
--- a/ply/lex.py
+++ b/ply/lex.py
@@ -215,7 +215,14 @@ class Lexer:
             exec('import %s' % tabfile)
             lextab = sys.modules[tabfile]
 
-        if getattr(lextab, '_tabversion', '0.0') != __tabversion__:
+        # python-ply 3.3-1 is shipped by Debian since Squeeze, so
+        # to not break packages that were built with wrong
+        # _tabversion we need to explicitly fix it.
+        actual_tabversion = getattr(lextab, '_tabversion', '0.0')
+        if actual_tabversion in ('3.3', '3.4'):
+            actual_tabversion = '3.2'
+
+        if actual_tabversion != __tabversion__:
             raise ImportError('Inconsistent PLY version')
 
         self.lextokens      = lextab._lextokens