[python-astropy] 01/04: Remove ply patch: we need a patched version. See https://github.com/astropy/astropy/issues/3405

Ole Streicher olebole-guest at moszumanska.debian.org
Sat Jan 31 16:25:19 UTC 2015


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

olebole-guest pushed a commit to branch debian
in repository python-astropy.

commit 5774867bd56c363f70d30d28db1be4dbfc9593d4
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Sat Jan 31 16:18:53 2015 +0100

    Remove ply patch: we need a patched version. See https://github.com/astropy/astropy/issues/3405
---
 debian/patches/series               |   1 -
 debian/patches/use_extern_ply.patch | 214 ------------------------------------
 2 files changed, 215 deletions(-)

diff --git a/debian/patches/series b/debian/patches/series
index d608d33..42284d9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
 mark_known_failures.patch
-use_extern_ply.patch
 disable_helper.patch
 helper_compatibility.patch
diff --git a/debian/patches/use_extern_ply.patch b/debian/patches/use_extern_ply.patch
deleted file mode 100644
index 5124485..0000000
--- a/debian/patches/use_extern_ply.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From 3ac3b5e3522a270ef88f46aae5474bc201549b54 Mon Sep 17 00:00:00 2001
-From: Sergio Pascual <sergiopr at fis.ucm.es>
-Date: Thu, 22 May 2014 14:37:05 +0200
-Subject: [PATCH] Bring an unmodified copy of ply
---- a/astropy/extern/ply/lex.py
-+++ b/astropy/extern/ply/lex.py
-@@ -34,7 +34,7 @@
- __version__    = "3.4"
- __tabversion__ = "3.2"       # Version of table file used
- 
--import re, sys, types, copy, os, inspect
-+import re, sys, types, copy, os
- 
- # This tuple contains known string types
- try:
-@@ -548,7 +548,7 @@
-         self.tokens     = []
-         self.reflags    = reflags
-         self.stateinfo  = { 'INITIAL' : 'inclusive'}
--        self.modules    = {}
-+        self.files      = {}
-         self.error      = 0
- 
-         if log is None:
-@@ -729,8 +729,7 @@
-             for fname, f in self.funcsym[state]:
-                 line = func_code(f).co_firstlineno
-                 file = func_code(f).co_filename
--                module = inspect.getmodule(f)
--                self.modules[module] = 1
-+                self.files[file] = 1
- 
-                 tokname = self.toknames[fname]
-                 if isinstance(f, types.MethodType):
-@@ -800,8 +799,7 @@
-                 f = efunc
-                 line = func_code(f).co_firstlineno
-                 file = func_code(f).co_filename
--                module = inspect.getmodule(f)
--                self.modules[module] = 1
-+                self.files[file] = 1
- 
-                 if isinstance(f, types.MethodType):
-                     reqargs = 2
-@@ -816,26 +814,35 @@
-                     self.log.error("%s:%d: Rule '%s' requires an argument", file,line,f.__name__)
-                     self.error = 1
- 
--        for module in self.modules:
--            self.validate_module(module)
-+        for f in self.files:
-+            self.validate_file(f)
- 
- 
-     # -----------------------------------------------------------------------------
--    # validate_module()
-+    # validate_file()
-     #
-     # This checks to see if there are duplicated t_rulename() functions or strings
-     # in the parser input file.  This is done using a simple regular expression
--    # match on each line in the source code of the given module.
-+    # match on each line in the given file.
-     # -----------------------------------------------------------------------------
- 
--    def validate_module(self, module):
--        lines, linen = inspect.getsourcelines(module)
-+    def validate_file(self,filename):
-+        import os.path
-+        base,ext = os.path.splitext(filename)
-+        if ext != '.py': return         # No idea what the file is. Return OK
-+
-+        try:
-+            f = open(filename)
-+            lines = f.readlines()
-+            f.close()
-+        except IOError:
-+            return                      # Couldn't find the file.  Don't worry about it
- 
-         fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(')
-         sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=')
- 
-         counthash = { }
--        linen += 1
-+        linen = 1
-         for l in lines:
-             m = fre.match(l)
-             if not m:
-@@ -846,7 +853,6 @@
-                 if not prev:
-                     counthash[name] = linen
-                 else:
--                    filename = inspect.getsourcefile(module)
-                     self.log.error("%s:%d: Rule %s redefined. Previously defined on line %d",filename,linen,name,prev)
-                     self.error = 1
-             linen += 1
---- a/astropy/extern/ply/yacc.py
-+++ b/astropy/extern/ply/yacc.py
-@@ -84,7 +84,7 @@
- 
- pickle_protocol = 0            # Protocol to use when writing pickle files
- 
--import re, types, sys, os.path, inspect
-+import re, types, sys, os.path
- 
- # Compatibility function for python 2.6/3.0
- if sys.version_info[0] < 3:
-@@ -1191,7 +1191,7 @@
-         return len(self.prod)
- 
-     def __nonzero__(self):
--        return True
-+        return 1
- 
-     def __getitem__(self,index):
-         return self.prod[index]
-@@ -2765,7 +2765,7 @@
-         self.start      = None
-         self.error_func = None
-         self.tokens     = None
--        self.modules    = {}
-+        self.files      = {}
-         self.grammar    = []
-         self.error      = 0
- 
-@@ -2789,7 +2789,7 @@
-         self.validate_tokens()
-         self.validate_precedence()
-         self.validate_pfunctions()
--        self.validate_modules()
-+        self.validate_files()
-         return self.error
- 
-     # Compute a signature over the grammar
-@@ -2814,7 +2814,7 @@
-         return sig.digest()
- 
-     # -----------------------------------------------------------------------------
--    # validate_modules()
-+    # validate_file()
-     #
-     # This method checks to see if there are duplicated p_rulename() functions
-     # in the parser module file.  Without this function, it is really easy for
-@@ -2824,12 +2824,20 @@
-     # to try and detect duplicates.
-     # -----------------------------------------------------------------------------
- 
--    def validate_modules(self):
-+    def validate_files(self):
-         # Match def p_funcname(
-         fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(')
- 
--        for module in self.modules.keys():
--            lines, linen = inspect.getsourcelines(module)
-+        for filename in self.files.keys():
-+            base,ext = os.path.splitext(filename)
-+            if ext != '.py': return 1          # No idea. Assume it's okay.
-+
-+            try:
-+                f = open(filename)
-+                lines = f.readlines()
-+                f.close()
-+            except IOError:
-+                continue
- 
-             counthash = { }
-             for linen,l in enumerate(lines):
-@@ -2841,7 +2849,6 @@
-                     if not prev:
-                         counthash[name] = linen
-                     else:
--                        filename = inspect.getsourcefile(module)
-                         self.log.warning("%s:%d: Function %s redefined. Previously defined on line %d", filename,linen,name,prev)
- 
-     # Get the start symbol
-@@ -2872,8 +2879,7 @@
- 
-             eline = func_code(self.error_func).co_firstlineno
-             efile = func_code(self.error_func).co_filename
--            module = inspect.getmodule(self.error_func)
--            self.modules[module] = 1
-+            self.files[efile] = 1
- 
-             if (func_code(self.error_func).co_argcount != 1+ismethod):
-                 self.log.error("%s:%d: p_error() requires 1 argument",efile,eline)
-@@ -2956,8 +2962,8 @@
-             if name == 'p_error': continue
-             if isinstance(item,(types.FunctionType,types.MethodType)):
-                 line = func_code(item).co_firstlineno
--                module = inspect.getmodule(item)
--                p_functions.append((line,module,name,item.__doc__))
-+                file = func_code(item).co_filename
-+                p_functions.append((line,file,name,item.__doc__))
- 
-         # Sort all of the actions by line number
-         p_functions.sort()
-@@ -2973,8 +2979,7 @@
-             self.error = 1
-             return
- 
--        for line, module, name, doc in self.pfuncs:
--            file = inspect.getsourcefile(module)
-+        for line, file, name, doc in self.pfuncs:
-             func = self.pdict[name]
-             if isinstance(func, types.MethodType):
-                 reqargs = 2
-@@ -3000,7 +3005,7 @@
- 
-                 # Looks like a valid grammar rule
-                 # Mark the file in which defined.
--                self.modules[module] = 1
-+                self.files[file] = 1
- 
-         # Secondary validation step that looks for p_ definitions that are not functions
-         # or functions that look like they might be grammar rules.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/python-astropy.git



More information about the debian-science-commits mailing list