Module: Language::Python::Shebang

Defined in:
brew/Library/Homebrew/language/python.rb

Overview

Mixin module for Formula adding shebang rewrite features.

Class Method Summary collapse

Class Method Details

.detected_python_shebang(formula = self) ⇒ Object



103
104
105
106
107
108
109
110
# File 'brew/Library/Homebrew/language/python.rb', line 103

def detected_python_shebang(formula = self)
  python_deps = formula.deps.map(&:name).grep(/^python(@.*)?$/)

  raise "Cannot detect Python shebang: formula does not depend on Python." if python_deps.empty?
  raise "Cannot detect Python shebang: formula has multiple Python dependencies." if python_deps.length > 1

  python_shebang_rewrite_info(Formula[python_deps.first].opt_bin/"python3")
end