[Python-modules-commits] r17023 - in packages/pyke/trunk/debian (2 files)

eriol-guest at users.alioth.debian.org eriol-guest at users.alioth.debian.org
Mon May 16 21:33:54 UTC 2011


    Date: Monday, May 16, 2011 @ 21:33:41
  Author: eriol-guest
Revision: 17023

Added patch by Jakub Wilk using docstring substitution

Modified:
  packages/pyke/trunk/debian/changelog
  packages/pyke/trunk/debian/patches/04_fix-shorter-float-repr.patch

Modified: packages/pyke/trunk/debian/changelog
===================================================================
--- packages/pyke/trunk/debian/changelog	2011-05-16 20:44:26 UTC (rev 17022)
+++ packages/pyke/trunk/debian/changelog	2011-05-16 21:33:41 UTC (rev 17023)
@@ -29,10 +29,9 @@
   * debian/patches/03_use-sed-instead-of-ed.patch
     - Use sed instead of ed to strip target links
   * debian/patches/04_fix-shorter-float-repr.patch
-    - Use string representation of float to fix doctest failure
-      in python2.7
+    - Added patch by Jakub Wilk using docstring substitution
 
- -- Daniele Tricoli <eriol at mornie.org>  Mon, 16 May 2011 20:35:22 +0200
+ -- Daniele Tricoli <eriol at mornie.org>  Mon, 16 May 2011 23:27:20 +0200
 
 pyke (1.1.1-1) unstable; urgency=low
 

Modified: packages/pyke/trunk/debian/patches/04_fix-shorter-float-repr.patch
===================================================================
--- packages/pyke/trunk/debian/patches/04_fix-shorter-float-repr.patch	2011-05-16 20:44:26 UTC (rev 17022)
+++ packages/pyke/trunk/debian/patches/04_fix-shorter-float-repr.patch	2011-05-16 21:33:41 UTC (rev 17023)
@@ -1,34 +1,23 @@
-Use string representation of float to fix doctest failure in python2.7. str() is used instead of format() to support python2.5
 --- a/pyke/krb_compiler/scanner.py
 +++ b/pyke/krb_compiler/scanner.py
-@@ -546,7 +546,10 @@
-     def __iter__(self): return self
-     def next(self):
-         t = lex.token()
--        if t: return t
-+        if t:
-+            if t.type == 'NUMBER_TOK' and isinstance(t.value, float):
-+                t.value = str(t.value)
-+            return t
-         raise StopIteration
+@@ -27,6 +27,8 @@
+ from __future__ import with_statement
+ import string
+ import os, os.path
++import sys
++import re
+ from pyke.krb_compiler.ply import lex
  
- def tokenize(s):
-@@ -594,12 +597,12 @@
-         LexToken(NUMBER_TOK,0,8,124)
-         LexToken(RP_TOK,')',8,125)
-         LexToken(NL_TOK,'\n',8,126)
--        LexToken(NUMBER_TOK,3.1400000000000001,9,129)
--        LexToken(NUMBER_TOK,0.98999999999999999,9,134)
--        LexToken(NUMBER_TOK,3.0,10,143)
--        LexToken(NUMBER_TOK,0.29999999999999999,10,146)
--        LexToken(NUMBER_TOK,3000000.0,10,149)
--        LexToken(NUMBER_TOK,3.0000000000000001e-06,10,153)
-+        LexToken(NUMBER_TOK,'3.14',9,129)
-+        LexToken(NUMBER_TOK,'0.99',9,134)
-+        LexToken(NUMBER_TOK,'3.0',10,143)
-+        LexToken(NUMBER_TOK,'0.3',10,146)
-+        LexToken(NUMBER_TOK,'3000000.0',10,149)
-+        LexToken(NUMBER_TOK,'3e-06',10,153)
-         LexToken(NL_TOK,'\n',10,158)
-         LexToken(DEINDENT_TOK,'\n    ',11,158)
-         LexToken(ASSERT_TOK,'assert',11,163)
+ debug=0
+@@ -625,6 +627,11 @@
+     with open(filename) as f:
+         tokenize(f.read())
+ 
++if sys.version_info >= (2, 7):
++    tokenize_file.__doc__ = re.sub('[0-9]+[.][0-9]+(e-?[0-9]+)?',
++                                   lambda m: repr(float(m.group())),
++                                   tokenize_file.__doc__)
++
+ def syntaxerror_params(pos = None, lineno = None):
+     '''
+         Returns (filename, lineno, column, line) for use in as the second




More information about the Python-modules-commits mailing list