language/python: build python binary names dynamically.

Co-authored-by: Alexander Bayandin <a.bayandin@gmail.com>
This commit is contained in:
Mike McQuaid 2020-09-16 12:47:20 +01:00 committed by GitHub
parent 57c136e848
commit f04b014210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,7 +177,7 @@ module Language
def virtualenv_install_with_resources(options = {}) def virtualenv_install_with_resources(options = {})
python = options[:using] python = options[:using]
if python.nil? if python.nil?
pythons = %w[python python3 python@3 python@3.7 python@3.8 python@3.9 pypy pypy3] pythons = %w[python python3 pypy pypy3] + Formula.names.select { |name| name.start_with? "python@" }
wanted = pythons.select { |py| needs_python?(py) } wanted = pythons.select { |py| needs_python?(py) }
raise FormulaUnknownPythonError, self if wanted.empty? raise FormulaUnknownPythonError, self if wanted.empty?
raise FormulaAmbiguousPythonError, self if wanted.size > 1 raise FormulaAmbiguousPythonError, self if wanted.size > 1