Module: Language::Python::Shebang

Defined in:
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



105
106
107
108
109
110
111
112
113
114
# File 'language/python.rb', line 105

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

  raise ShebangDetectionError.new("Python", "formula does not depend on Python") if python_deps.empty?
  if python_deps.length > 1
    raise ShebangDetectionError.new("Python", "formula has multiple Python dependencies")
  end

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