[Python-modules-commits] r28280 - in packages/pydot/trunk/debian/patches (support-py3k.patch)

morph at users.alioth.debian.org morph at users.alioth.debian.org
Sat Mar 22 14:27:49 UTC 2014


    Date: Saturday, March 22, 2014 @ 14:27:48
  Author: morph
Revision: 28280

improved patch to replace file() with open()

Modified:
  packages/pydot/trunk/debian/patches/support-py3k.patch

Modified: packages/pydot/trunk/debian/patches/support-py3k.patch
===================================================================
--- packages/pydot/trunk/debian/patches/support-py3k.patch	2014-03-22 12:35:39 UTC (rev 28279)
+++ packages/pydot/trunk/debian/patches/support-py3k.patch	2014-03-22 14:27:48 UTC (rev 28280)
@@ -124,8 +124,9 @@
      representing the graph.
      """
 -    
+-    fd = file(path, 'rb')
 +
-     fd = file(path, 'rb')
++    fd = open(path, 'rb')
      data = fd.read()
      fd.close()
 -    
@@ -2051,7 +2052,7 @@
          self.progs = paths
  
  
-@@ -1880,18 +1880,18 @@ class Dot(Graph):
+@@ -1880,19 +1880,19 @@ class Dot(Graph):
          in 'prog', which defaults to 'dot'
          Returns True or False according to the success of the write
          operation.
@@ -2070,10 +2071,12 @@
          if prog is None:
              prog = self.prog
 -        
+-        dot_fd = file(path, "w+b")
 +
-         dot_fd = file(path, "w+b")
++        dot_fd = open(path, "w+b")
          if format == 'raw':
              data = self.to_string()
+             if isinstance(data, basestring):
 @@ -1901,7 +1901,7 @@ class Dot(Graph):
                          data = unicode(data, 'utf-8')
                      except:
@@ -2159,14 +2162,16 @@
 +
              # Get its data
              #
-             f = file(img, 'rb')
+-            f = file(img, 'rb')
++            f = open(img, 'rb')
              f_data = f.read()
              f.close()
 -            
 +
              # And copy it under a file with the same name in the temporary directory
              #
-             f = file( os.path.join( tmp_dir, os.path.basename(img) ), 'wb' )
+-            f = file( os.path.join( tmp_dir, os.path.basename(img) ), 'wb' )
++            f = open( os.path.join( tmp_dir, os.path.basename(img) ), 'wb' )
              f.write(f_data)
              f.close()
 -        




More information about the Python-modules-commits mailing list