src/etc: Fix PEP8 issues in Python scripts
authorTobias Bieniek <tobias.bieniek@gmx.de>
Fri, 21 Aug 2015 15:32:36 +0000 (17:32 +0200)
committerTobias Bieniek <tobias.bieniek@gmx.de>
Fri, 21 Aug 2015 15:32:36 +0000 (17:32 +0200)
src/etc/dl-snapshot.py
src/etc/download.py
src/etc/install-deps.py
src/etc/print-new-snapshot.py

index 23f9c594929037c234c6a99b6a937d7bc95713f6..b279f536a89aeb6938693ee7c03790091bf06c84 100644 (file)
@@ -70,7 +70,7 @@ hash = snaps[date][platform]
 
 tarball = 'cargo-nightly-' + triple + '.tar.gz'
 url = 'https://static.rust-lang.org/cargo-dist/%s/%s' % \
-  (date.strip(), tarball)
+    (date.strip(), tarball)
 dl_path = "target/dl/" + tarball
 dst = "target/snapshot"
 
index 080fda9e29719e358209ab192b1975409706445b..8072737827bb6332bfee5890dba39ea8dd0c0eeb 100644 (file)
@@ -5,15 +5,17 @@ import subprocess
 import sys
 import tarfile
 
+
 def get(url, path, quiet=False):
     # see http://serverfault.com/questions/301128/how-to-download
     if sys.platform == 'win32':
         run(["PowerShell.exe", "/nologo", "-Command",
              "(New-Object System.Net.WebClient).DownloadFile('" + url +
-                "', '" + path + "')"], quiet=quiet)
+             "', '" + path + "')"], quiet=quiet)
     else:
         run(["curl", "-o", path, url], quiet=quiet)
 
+
 def unpack(tarball, dst, quiet=False):
     if quiet:
         print("extracting " + tarball)
@@ -31,6 +33,7 @@ def unpack(tarball, dst, quiet=False):
             shutil.move(tp, fp)
     shutil.rmtree(os.path.join(dst, fname))
 
+
 def run(args, quiet=False):
     if not quiet:
         print("running: " + ' '.join(args))
@@ -38,9 +41,9 @@ def run(args, quiet=False):
     # Use Popen here instead of call() as it apparently allows powershell on
     # Windows to not lock up waiting for input presumably.
     ret = subprocess.Popen(args,
-                           stdin = subprocess.PIPE,
-                           stdout = subprocess.PIPE,
-                           stderr = subprocess.PIPE)
+                           stdin=subprocess.PIPE,
+                           stdout=subprocess.PIPE,
+                           stderr=subprocess.PIPE)
     out, err = ret.communicate()
     code = ret.wait()
     if code != 0:
index 0886bb249cbd72562ff308d73424a00fcee20989..1d73f69cae9a3e0995ffd9d1991400a8de5b6cab 100644 (file)
@@ -37,6 +37,7 @@ else:
 rust_date = open('src/rustversion.txt').read().strip()
 url = 'https://static.rust-lang.org/dist/' + rust_date
 
+
 def install_via_tarballs():
     if os.path.isdir("rustc-install"):
         shutil.rmtree("rustc-install")
@@ -46,7 +47,7 @@ def install_via_tarballs():
     download.unpack(host_fname, "rustc-install", quiet=True)
     os.remove(host_fname)
 
-    if extra != None:
+    if extra is not None:
         extra_fname = 'rustc-nightly-' + extra + '.tar.gz'
         print("adding target libs for " + extra)
         download.get(url + '/' + extra_fname, extra_fname)
index 7f0aff538f3669eb9634d2c797db3b866152defe..ecfbda0337c59db96605a33753c93dcc079563b6 100644 (file)
@@ -1,6 +1,5 @@
 # When updating snapshots, run this file and pipe it into `src/snapshots.txt`
 import os
-import subprocess
 import sys
 import hashlib
 import download
@@ -27,6 +26,6 @@ for platform in sorted(snaps):
     tarball = 'cargo-nightly-' + triple + '.tar.gz'
     url = 'https://static.rust-lang.org/cargo-dist/' + date + '/' + tarball
     dl_path = "target/dl/" + tarball
-    download.get(url, dl_path, quiet = True)
+    download.get(url, dl_path, quiet=True)
     h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
     print('  ' + platform + ' ' + h)