[PATCH] D65983: Autogenerate the shebang lines for tools/opt-viewer

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 15:23:14 PDT 2019


beanz added a comment.

In D65983#1633766 <https://reviews.llvm.org/D65983#1633766>, @cbiesinger wrote:

> It actually worked with the env for me.


It will always work locally, it just may not work in a binary distribution (i.e. take your built binaries and move them somewhere else with a different path to python).

> Anyway, beanz, does this address your concern? It uses #!/usr/bin/env python at PYTHON_VERSION_MAJOR@

Is there any situation where the python tool isn't named that way? What happens if `PYTHON_EXECUTABLE` points to a Python 3.2 install, but my system default is Python 3.5? Doesn't that make the `python3` link point to `python35`?

What about using CMake's `get_filename_component` (https://cmake.org/cmake/help/v3.0/command/get_filename_component.html) function to find the name of the executable? That seems more robust.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65983/new/

https://reviews.llvm.org/D65983





More information about the llvm-commits mailing list