Skip to content

Commit

Permalink
Ignore UnicodeDecodeError in shebang-fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
berland committed Feb 10, 2023
1 parent d30f209 commit 7acc2c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion komodo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def _main(args):
# cases falling back to /tmp, which is undesired when building on nfs.
os.environ["TMPDIR"] = args.tmp

print("Fixup #! in pip-provided packages if bin exist")
release_path = Path(args.prefix) / Path(args.release)
release_root = release_path / "root"
for pkg, ver in args.pkgs.items():
Expand Down
7 changes: 4 additions & 3 deletions komodo/shebang.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def fixup_python_shebangs(prefix, release):
"""Fix shebang to $PREFIX/bin/python.
Some packages installed with pip do not respect target executable, that is,
they set as their shebang executable the Python executabl used to build the
they set as their shebang executable the Python executable used to build the
komodo distribution with instead of the Python executable that komodo
deploys. This breaks the application since the corresponding Python modules
won't be picked up correctly.
Expand All @@ -36,8 +36,9 @@ def fixup_python_shebangs(prefix, release):
shebang = f.readline().strip()
if _is_shebang(shebang):
bins_.append(bin_)
except Exception as err: # pylint: disable=broad-except
print(f"Exception in reading bin {bin_}: {err}")
except UnicodeDecodeError:
# Whenever the executables are compiled binaries, we end here.
pass

for bin_ in bins_:
binpath_ = os.path.join(prefix, release, "root", "bin", bin_)
Expand Down

0 comments on commit 7acc2c3

Please sign in to comment.