Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

language/python: allow python@3.7 to be used for virtualenvs #7959

Merged
merged 2 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions Library/Homebrew/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,18 @@ def message
end
end

class FormulaUnknownPythonError < RuntimeError
def initialize(formula)
super <<~EOS
The version of Python to use with the virtualenv in the `#{formula.full_name}` formula
cannot be guessed automatically because a recognised Python dependency could not be found.

If you are using a non-standard Python depedency, please add `:using => "python@x.y"` to
`virtualenv_install_with_resources` to resolve the issue manually.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

EOS
end
end

class FormulaAmbiguousPythonError < RuntimeError
def initialize(formula)
super <<~EOS
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/language/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ def needs_python?(python)
def virtualenv_install_with_resources(options = {})
python = options[:using]
if python.nil?
pythons = %w[python python3 python@3 python@3.8 pypy pypy3]
pythons = %w[python python3 python@3 python@3.7 python@3.8 pypy pypy3]
wanted = pythons.select { |py| needs_python?(py) }
raise FormulaUnknownPythonError, self if wanted.empty?
raise FormulaAmbiguousPythonError, self if wanted.size > 1

python = wanted.first
Expand Down