[Numpy-svn] r6535 - in trunk/numpy: distutils distutils/command f2py lib linalg/lapack_lite

numpy-svn@scip... numpy-svn@scip...
Mon Mar 2 15:12:02 CST 2009


Author: stefan
Date: 2009-03-02 15:11:31 -0600 (Mon, 02 Mar 2009)
New Revision: 6535

Modified:
   trunk/numpy/distutils/command/build_src.py
   trunk/numpy/distutils/misc_util.py
   trunk/numpy/f2py/crackfortran.py
   trunk/numpy/lib/function_base.py
   trunk/numpy/linalg/lapack_lite/make_lite.py
Log:
Python 3000 fixes for 2to3 [patch by James Watson].

Modified: trunk/numpy/distutils/command/build_src.py
===================================================================
--- trunk/numpy/distutils/command/build_src.py	2009-03-02 20:05:32 UTC (rev 6534)
+++ trunk/numpy/distutils/command/build_src.py	2009-03-02 21:11:31 UTC (rev 6535)
@@ -465,7 +465,8 @@
         if not (f2py_sources or f_sources):
             return new_sources
 
-        map(self.mkpath, target_dirs)
+        for d in target_dirs:
+            self.mkpath(d)
 
         f2py_options = extension.f2py_options + self.f2py_opts
 
@@ -632,7 +633,9 @@
         if skip_swig:
             return new_sources + py_files
 
-        map(self.mkpath, target_dirs)
+        for d in target_dirs:
+            self.mkpath(d)
+
         swig = self.swig or self.find_swig()
         swig_cmd = [swig, "-python"]
         if is_cpp:

Modified: trunk/numpy/distutils/misc_util.py
===================================================================
--- trunk/numpy/distutils/misc_util.py	2009-03-02 20:05:32 UTC (rev 6534)
+++ trunk/numpy/distutils/misc_util.py	2009-03-02 21:11:31 UTC (rev 6535)
@@ -204,7 +204,7 @@
             new_paths.extend(_fix_paths(n,local_path,include_non_existing))
         else:
             new_paths.append(n)
-    return map(minrelpath,new_paths)
+    return [minrelpath(p) for p in new_paths]
 
 def gpaths(paths, local_path='', include_non_existing=True):
     """Apply glob to paths and prepend local_path if needed.
@@ -954,7 +954,8 @@
         for p,files in self.data_files:
             if p not in data_dict:
                 data_dict[p] = set()
-            map(data_dict[p].add,files)
+            for f in files:
+                data_dict[p].add(f)
         self.data_files[:] = [(p,list(files)) for p,files in data_dict.items()]
 
     def add_data_files(self,*files):
@@ -980,7 +981,8 @@
         """
 
         if len(files)>1:
-            map(self.add_data_files, files)
+            for f in files:
+                self.add_data_files(f)
             return
         assert len(files)==1
         if is_sequence(files[0]):

Modified: trunk/numpy/f2py/crackfortran.py
===================================================================
--- trunk/numpy/f2py/crackfortran.py	2009-03-02 20:05:32 UTC (rev 6534)
+++ trunk/numpy/f2py/crackfortran.py	2009-03-02 21:11:31 UTC (rev 6535)
@@ -341,7 +341,9 @@
             elif strictf77:
                 if len(l)>72: l=l[:72]
             if not (l[0] in spacedigits):
-                raise 'readfortrancode: Found non-(space,digit) char in the first column.\n\tAre you sure that this code is in fix form?\n\tline=%s'%`l`
+                raise Exception('readfortrancode: Found non-(space,digit) char '
+                                'in the first column.\n\tAre you sure that '
+                                'this code is in fix form?\n\tline=%s' % `l`)
 
             if (not cont or strictf77) and (len(l)>5 and not l[5]==' '):
                 # Continuation of a previous line
@@ -596,11 +598,16 @@
             groupcounter=groupcounter-1
             if skipblocksuntil<=groupcounter: return
         if groupcounter<=0:
-            raise 'crackline: groupcounter(=%s) is nonpositive. Check the blocks.'\
-                  % (groupcounter)
+            raise Exception('crackline: groupcounter(=%s) is nonpositive. '
+                            'Check the blocks.' \
+                            % (groupcounter))
         m1 = beginpattern[0].match((line))
         if (m1) and (not m1.group('this')==groupname[groupcounter]):
-            raise 'crackline: End group %s does not match with previous Begin group %s\n\t%s'%(`m1.group('this')`,`groupname[groupcounter]`,filepositiontext)
+            raise Exception('crackline: End group %s does not match with '
+                            'previous Begin group %s\n\t%s' % \
+                            (`m1.group('this')`, `groupname[groupcounter]`,
+                             filepositiontext)
+                            )
         if skipblocksuntil==groupcounter:
             skipblocksuntil=-1
         grouplist[groupcounter-1].append(groupcache[groupcounter])
@@ -683,7 +690,8 @@
         elif k in ['intent','check','dimension','optional','required']:
             errmess('appenddecl: "%s" not implemented.\n'%k)
         else:
-            raise 'appenddecl: Unknown variable definition key:', k
+            raise Exception('appenddecl: Unknown variable definition key:' + \
+                            str(k))
     return decl
 
 selectpattern=re.compile(r'\s*(?P<this>(@\(@.*?@\)@|[*][\d*]+|[*]\s*@\(@.*?@\)@|))(?P<after>.*)\Z',re.I)
@@ -1542,7 +1550,8 @@
         return uret+gret
     setmesstext(block)
     if (not type(block)==types.DictType) and 'block' not in block:
-        raise 'postcrack: Expected block dictionary instead of ',block
+        raise Exception('postcrack: Expected block dictionary instead of ' + \
+                        str(block))
     if 'name' in block and not block['name']=='unknown_interface':
         outmess('%sBlock: %s\n'%(tab,block['name']),0)
     blocktype=block['block']

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2009-03-02 20:05:32 UTC (rev 6534)
+++ trunk/numpy/lib/function_base.py	2009-03-02 21:11:31 UTC (rev 6535)
@@ -546,7 +546,7 @@
         hist /= s
 
     if (hist.shape != nbin-2).any():
-        raise 'Internal Shape Error'
+        raise RuntimeError('Internal Shape Error')
     return hist, edges
 
 

Modified: trunk/numpy/linalg/lapack_lite/make_lite.py
===================================================================
--- trunk/numpy/linalg/lapack_lite/make_lite.py	2009-03-02 20:05:32 UTC (rev 6534)
+++ trunk/numpy/linalg/lapack_lite/make_lite.py	2009-03-02 21:11:31 UTC (rev 6535)
@@ -141,7 +141,7 @@
 class LapackLibrary(FortranLibrary):
     def _newFortranRoutine(self, rname, filename):
         routine = FortranLibrary._newFortranRoutine(self, rname, filename)
-        if 'BLAS' in filename
+        if 'BLAS' in filename:
             routine.type = 'blas'
         elif rname.startswith('z'):
             routine.type = 'zlapack'



More information about the Numpy-svn mailing list