Files
tigerbrew/Library/Homebrew/requirements/python_dependency.rb
T
Mike McQuaid 9ead3a1b08 python_dependency: cleanup and fix build env.
* Only set PYTHONPATH for Python 2.
* Set the Python binary for superenv.

References #24842.
Closes #26197.
Closes #26216.
Closes #26218.
Closes #26228.
2014-01-29 17:49:57 +01:00

47 lines
804 B
Ruby

require 'requirement'
class PythonDependency < Requirement
fatal true
satisfy :build_env => false do
which_python
end
def which_python
@which_python ||= which python_binary
end
def modify_build_environment
if python_binary == 'python'
ENV['PYTHONPATH'] = "#{HOMEBREW_PREFIX}/lib/python2.7/site-packages"
end
if !system_python? && which_python
ENV.prepend_path 'PATH', which_python.dirname
end
end
def system_python?
which_python.to_s == "/usr/bin/#{python_binary}"
end
def python_binary
'python'
end
# Deprecated
alias_method :to_s, :python_binary
end
class Python3Dependency < PythonDependency
default_formula 'python3'
satisfy :build_env => false do
which_python
end
def python_binary
'python3'
end
end