Skip to content

Fix #104, #54: issues with overlong shebang in deep directories.#497

Merged
tgamblin merged 2 commits intodevelopfrom
features/sbang
Mar 7, 2016
Merged

Fix #104, #54: issues with overlong shebang in deep directories.#497
tgamblin merged 2 commits intodevelopfrom
features/sbang

Conversation

@tgamblin
Copy link
Member

@tgamblin tgamblin commented Mar 5, 2016

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.

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.
@tgamblin
Copy link
Member Author

tgamblin commented Mar 5, 2016

@luigi-calori
Copy link
Contributor

Confirm this solve the issue I had with virtualenv.
Thanks a lot

@tgamblin
Copy link
Member Author

tgamblin commented Mar 7, 2016

@luigi-calori: Great! I'm forgetting what your specific issue was. Is it pypa/virtualenv#596, or something else?

I think the sbang script in this PR could be useful for these:

@tgamblin
Copy link
Member Author

tgamblin commented Mar 7, 2016

Verified to work for @KineticTheory and @luigi-calori so going to merge this.

@tgamblin tgamblin merged commit bfce2c7 into develop Mar 7, 2016
@alalazo alalazo mentioned this pull request Mar 9, 2016
2 tasks
@cyrush
Copy link
Member

cyrush commented Mar 11, 2016

@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.

@cyrush
Copy link
Member

cyrush commented Mar 12, 2016

@tgamblin figured out how to use the shebang patch directly -- it was quite easy:

from spack.hooks.sbang import *
filter_shebang(my_script)

This solves a big torn in my side, thanks!

@tgamblin
Copy link
Member Author

@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?

@cyrush
Copy link
Member

cyrush commented Mar 15, 2016

@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.

@tgamblin
Copy link
Member Author

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.

@tgamblin tgamblin deleted the features/sbang branch July 4, 2016 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants