Fix #104, #54: issues with overlong shebang in deep directories.#497
Fix #104, #54: issues with overlong shebang in deep directories.#497
Conversation
This does several things:
- Add `sbang`: a script to run scripts with long shebang lines.
- Documentation for `sbang` is in `bin/sbang`.
- Add an `sbang` hook that filters the `bin` directory after install
and modifies any scripts wtih shebangs that are too long to use
`sbang` instead.
- `sbang` is at the top level, so it should be runnable (not much we
can do if spack itself is too deep for shebang)
- `sbang`, when used as the interpreter, runs the *second* shebang
line it finds in a script.
- shoud fix issues with too long shebang paths.
|
Confirm this solve the issue I had with virtualenv. |
|
@luigi-calori: Great! I'm forgetting what your specific issue was. Is it pypa/virtualenv#596, or something else? I think the |
|
Verified to work for @KineticTheory and @luigi-calori so going to merge this. |
|
@tgamblin in the spack install environment, is there a way for me to explicitly sbang-ify a script? The auto hook works for a subset of what we want, but we do have scripts that won't appear in the bin dir. |
|
@tgamblin figured out how to use the shebang patch directly -- it was quite easy:
This solves a big torn in my side, thanks! |
|
@cyrush: would it help to make this more declarative, e.g. if packages had a property like this? shebang_scripts = ['libexec/some-other-script', 'share/pkg/some-additional-script']where those scripts would be automatically shebangified? |
|
@tgamblin I think I am happiest importing the shebang methods and calling them directly in the install environment. I am creating python modules that are installed directly into a spack built python -- not their spack sanctioned paths. That may be taboo, but I believe I have sane motivation for doing so. |
|
ok if you don't mind importing them, then that is fine. We could also move them to a more convenient place, or make them available in the build env by default. |
This does several things:
sbang: a script to run scripts with long shebang lines.sbangis inbin/sbang.sbanghook that filters thebindirectory after installand modifies any scripts wtih shebangs that are too long to use
sbanginstead.sbangis at the top level, so it should be runnable (not much wecan do if spack itself is too deep for shebang)
sbang, when used as the interpreter, runs the second shebangline it finds in a script.