1
Fork 0

Style fixups

This commit is contained in:
Andrew Cann 2017-02-17 14:00:58 +08:00
parent e0a5b9d746
commit 5e324bdc91

View file

@ -89,6 +89,7 @@ def verify(path, sha_path, verbose):
" expected: {}".format(found, expected)) " expected: {}".format(found, expected))
return verified return verified
def unpack(tarball, dst, verbose=False, match=None): def unpack(tarball, dst, verbose=False, match=None):
print("extracting " + tarball) print("extracting " + tarball)
fname = os.path.basename(tarball).replace(".tar.gz", "") fname = os.path.basename(tarball).replace(".tar.gz", "")
@ -208,13 +209,13 @@ class RustBuild(object):
return return
# At this point we're pretty sure the user is running NixOS # At this point we're pretty sure the user is running NixOS
print("Info: you seem to be running NixOS. Attempting to patch " + fname) print("info: you seem to be running NixOS. Attempting to patch " + fname)
try: try:
interpreter = subprocess.check_output(["patchelf", "--print-interpreter", fname]) interpreter = subprocess.check_output(["patchelf", "--print-interpreter", fname])
interpreter = interpreter.strip().decode(default_encoding) interpreter = interpreter.strip().decode(default_encoding)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print("Warning: failed to call patchelf: %s" % e) print("warning: failed to call patchelf: %s" % e)
return return
loader = interpreter.split("/")[-1] loader = interpreter.split("/")[-1]
@ -223,7 +224,7 @@ class RustBuild(object):
ldd_output = subprocess.check_output(['ldd', '/run/current-system/sw/bin/sh']) ldd_output = subprocess.check_output(['ldd', '/run/current-system/sw/bin/sh'])
ldd_output = ldd_output.strip().decode(default_encoding) ldd_output = ldd_output.strip().decode(default_encoding)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print("Warning: unable to call ldd: %s" % e) print("warning: unable to call ldd: %s" % e)
return return
for line in ldd_output.splitlines(): for line in ldd_output.splitlines():
@ -232,7 +233,7 @@ class RustBuild(object):
loader_path = libname[:len(libname) - len(loader)] loader_path = libname[:len(libname) - len(loader)]
break break
else: else:
print("Warning: unable to find the path to the dynamic linker") print("warning: unable to find the path to the dynamic linker")
return return
correct_interpreter = loader_path + loader correct_interpreter = loader_path + loader
@ -240,7 +241,7 @@ class RustBuild(object):
try: try:
subprocess.check_output(["patchelf", "--set-interpreter", correct_interpreter, fname]) subprocess.check_output(["patchelf", "--set-interpreter", correct_interpreter, fname])
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print("Warning: failed to call patchelf: %s" % e) print("warning: failed to call patchelf: %s" % e)
return return
def stage0_cargo_rev(self): def stage0_cargo_rev(self):