Bug 926418 - Prevent spurious newlines being added to packages.txt when running generate_diff.py on Windows; r=jhammel
authorEd Morley <emorley@mozilla.com>
Wed, 16 Oct 2013 16:18:27 +0100
changeset 164782 173a666f3b70b116c3ee774ac19a064d716688c1
parent 164781 6233dd77e3f82c05eff3cb01eac00df8d3a44c05
child 164783 7652896ed115b66594fa131a969475ca326107c0
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhammel
bugs926418
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 926418 - Prevent spurious newlines being added to packages.txt when running generate_diff.py on Windows; r=jhammel
testing/mozbase/generate_diff.py
--- a/testing/mozbase/generate_diff.py
+++ b/testing/mozbase/generate_diff.py
@@ -115,26 +115,28 @@ def generate_packages_txt():
     """
     generate a packages.txt file appropriate for
     http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/populate_virtualenv.py
 
     See also:
     http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/packages.txt
     """
 
-    prefix = 'testing/mozbase/' # relative path from topsrcdir
+    # relative path from topsrcdir
+    prefix = 'testing/mozbase/'
 
     # gather the packages
     packages = setup_development.mozbase_packages
 
     # write them in the appropriate format
     path = os.path.join(here, 'packages.txt')
-    with file(path, 'w') as f:
-        for package in sorted(packages):
-            f.write("%s.pth:%s%s\n" % (package, prefix, package))
+    packages_manifest = [("%s.pth:%s%s\n" % (package, prefix, package))
+                         for package in sorted(packages)]
+    with open(path, 'wb') as f:
+        f.writelines(packages_manifest)
 
 ### version-related functions
 
 def parse_versions(*args):
     """return a list of 2-tuples of (directory, version)"""
 
     retval = []
     for arg in args: