Skip to content

Commit

Permalink
Fixup some python style which was previously reverted
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Feb 24, 2015
1 parent 922a83e commit 8c0525c
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/etc/dl-snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import tarfile
import shutil

f = open('src/snapshots.txt')
lines = f.readlines()
with open('src/snapshots.txt') as f:
lines = f.readlines()

date = lines[0]
linux32 = lines[1]
Expand Down Expand Up @@ -57,7 +57,7 @@

triple = new_triple

platform, hash = me.strip().split(' ')
platform, hash = me.strip().split()

tarball = 'cargo-nightly-' + triple + '.tar.gz'
url = 'https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/' + date.strip() + '/' + tarball
Expand All @@ -77,15 +77,14 @@
if h != hash:
raise Exception("failed to verify the checksum of the snapshot")

tar = tarfile.open(dl_path)
for p in tar.getnames():
name = p.replace("cargo-nightly-" + triple + "/", "", 1)
fp = os.path.join(dst, name)
print("extracting " + p)
tar.extract(p, dst)
tp = os.path.join(dst, p)
if os.path.isdir(tp) and os.path.exists(fp):
continue
shutil.move(tp, fp)
tar.close()
with tarfile.open(dl_path) as tar:
for p in tar.getnames():
name = p.replace("cargo-nightly-" + triple + "/", "", 1)
fp = os.path.join(dst, name)
print("extracting " + p)
tar.extract(p, dst)
tp = os.path.join(dst, p)
if os.path.isdir(tp) and os.path.exists(fp):
continue
shutil.move(tp, fp)
shutil.rmtree(os.path.join(dst, 'cargo-nightly-' + triple))

0 comments on commit 8c0525c

Please sign in to comment.