From 1965a156f0fa0f3e1528af7deedd34c21dd5a1e8 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 3 May 2011 16:22:00 -0700 Subject: Attempt to use more portable python --- src/etc/get-snapshot.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py index 9a076af0..f1a85189 100755 --- a/src/etc/get-snapshot.py +++ b/src/etc/get-snapshot.py @@ -35,24 +35,24 @@ def determine_curr_snapshot_for_platform(): date = None rev = None - with open(snapshotfile) as f: - for line in f.xreadlines(): - i += 1 - parsed = parse_line(i, line) - if (not parsed): continue - - if parsed["type"] == "transition": - raise Exception("working on a transition, not updating stage0") - - if found_snap and parsed["type"] == "file": - if parsed["platform"] == platform: - hsh = parsed["hash"] - found_file = True - break; - elif parsed["type"] == "snapshot": - date = parsed["date"] - rev = parsed["rev"] - found_snap = True + f = open(snapshotfile) + for line in f.readlines(): + i += 1 + parsed = parse_line(i, line) + if (not parsed): continue + + if parsed["type"] == "transition": + raise Exception("working on a transition, not updating stage0") + + if found_snap and parsed["type"] == "file": + if parsed["platform"] == platform: + hsh = parsed["hash"] + found_file = True + break; + elif parsed["type"] == "snapshot": + date = parsed["date"] + rev = parsed["rev"] + found_snap = True if not found_snap: raise Exception("no snapshot entries in file") -- cgit v1.2.3