[125610] users/g5pw/pypi2port/pypi2port.py

g5pw at macports.org g5pw at macports.org
Mon Sep 22 12:53:22 PDT 2014


Revision: 125610
          https://trac.macports.org/changeset/125610
Author:   g5pw at macports.org
Date:     2014-09-22 12:53:22 -0700 (Mon, 22 Sep 2014)
Log Message:
-----------
Use writelines instead of while loop

The writelines method accepts an iterable, so an iterator will work just fine.

Modified Paths:
--------------
    users/g5pw/pypi2port/pypi2port.py

Modified: users/g5pw/pypi2port/pypi2port.py
===================================================================
--- users/g5pw/pypi2port/pypi2port.py	2014-09-22 19:53:16 UTC (rev 125609)
+++ users/g5pw/pypi2port/pypi2port.py	2014-09-22 19:53:22 UTC (rev 125610)
@@ -193,11 +193,7 @@
 #    b = open(new_file).readlines()
     diff_string = difflib.unified_diff(a, b, "Portfile.orig", "Portfile")
     with open(diff_file, 'w') as d:
-        try:
-            while 1:
-                d.write(diff_string.next())
-        except:
-            pass
+        d.writelines(diff_string)
 
 
 def search_port(name):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140922/57fc007b/attachment-0001.html>


More information about the macports-changes mailing list