diff options
| author | Graydon Hoare <[email protected]> | 2011-05-03 16:22:00 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-05-03 16:22:00 -0700 |
| commit | 1965a156f0fa0f3e1528af7deedd34c21dd5a1e8 (patch) | |
| tree | 6c3d04f3a2d651da695bf92f14bc416a3e8d3c61 /src/etc/get-snapshot.py | |
| parent | Remove everything to do with rustboot from makefiles. (diff) | |
| download | rust-1965a156f0fa0f3e1528af7deedd34c21dd5a1e8.tar.xz rust-1965a156f0fa0f3e1528af7deedd34c21dd5a1e8.zip | |
Attempt to use more portable python
Diffstat (limited to 'src/etc/get-snapshot.py')
| -rwxr-xr-x | src/etc/get-snapshot.py | 36 |
1 files changed, 18 insertions, 18 deletions
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") |