Navigation Menu

Skip to content

Commit

Permalink
Style fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
canndrew committed Feb 17, 2017
1 parent e0a5b9d commit 5e324bd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/bootstrap/bootstrap.py
Expand Up @@ -89,6 +89,7 @@ def verify(path, sha_path, verbose):
" expected: {}".format(found, expected))
return verified


def unpack(tarball, dst, verbose=False, match=None):
print("extracting " + tarball)
fname = os.path.basename(tarball).replace(".tar.gz", "")
Expand Down Expand Up @@ -208,13 +209,13 @@ def fix_executable(self, fname):
return

# 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:
interpreter = subprocess.check_output(["patchelf", "--print-interpreter", fname])
interpreter = interpreter.strip().decode(default_encoding)
except subprocess.CalledProcessError as e:
print("Warning: failed to call patchelf: %s" % e)
print("warning: failed to call patchelf: %s" % e)
return

loader = interpreter.split("/")[-1]
Expand All @@ -223,7 +224,7 @@ def fix_executable(self, fname):
ldd_output = subprocess.check_output(['ldd', '/run/current-system/sw/bin/sh'])
ldd_output = ldd_output.strip().decode(default_encoding)
except subprocess.CalledProcessError as e:
print("Warning: unable to call ldd: %s" % e)
print("warning: unable to call ldd: %s" % e)
return

for line in ldd_output.splitlines():
Expand All @@ -232,15 +233,15 @@ def fix_executable(self, fname):
loader_path = libname[:len(libname) - len(loader)]
break
else:
print("Warning: unable to find the path to the dynamic linker")
print("warning: unable to find the path to the dynamic linker")
return

correct_interpreter = loader_path + loader

try:
subprocess.check_output(["patchelf", "--set-interpreter", correct_interpreter, fname])
except subprocess.CalledProcessError as e:
print("Warning: failed to call patchelf: %s" % e)
print("warning: failed to call patchelf: %s" % e)
return

def stage0_cargo_rev(self):
Expand Down

0 comments on commit 5e324bd

Please sign in to comment.