Hotfix: Revert Python module
This commit is contained in:
parent
4e8aa8637f
commit
1c95045033
@ -307,7 +307,7 @@ class Formula
|
||||
|
||||
def python(options={:allowed_major_versions => [2, 3]}, &block)
|
||||
require 'python_helper'
|
||||
Python::python_helper(options, &block)
|
||||
python_helper(options, &block)
|
||||
end
|
||||
|
||||
# Explicitly only execute the block for 2.x (if a python 2.x is available)
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
|
||||
# The python_helper is used in the Formula class when the user calls
|
||||
# This is used in the Formula class when the user calls
|
||||
# `python`, `python2` or `python3`.
|
||||
|
||||
module Python
|
||||
# This method has a dual nature. For one, it takes a &block and sets up
|
||||
# the ENV such that a Python, as defined in the requirements, is the default.
|
||||
# If there are multiple `PythonInstalled` requirements, the block is evaluated
|
||||
# once for each Python. This makes it possible to easily support 2.x and
|
||||
# 3.x Python bindings without code duplication in formulae.
|
||||
# If you need to special case stuff, set :allowed_major_versions.
|
||||
# Second, inside the block, a formula author may call this method to access
|
||||
# certain convienience methods for the currently selected Python, e.g.
|
||||
# `python.site_packages`.
|
||||
def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
|
||||
# This method has a dual nature. For one, it takes a &block and sets up
|
||||
# the ENV such that a Python, as defined in the requirements, is the default.
|
||||
# If there are multiple `PythonInstalled` requirements, the block is evaluated
|
||||
# once for each Python. This makes it possible to easily support 2.x and
|
||||
# 3.x Python bindings without code duplication in formulae.
|
||||
# If you need to special case stuff, set :allowed_major_versions.
|
||||
# Second, inside the block, a formula author may call this method to access
|
||||
# certain convienience methods for the currently selected Python, e.g.
|
||||
# `python.site_packages`.
|
||||
def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
|
||||
if !block_given? and !@current_python.nil?
|
||||
# We are already inside of a `python do ... end` block, so just return
|
||||
# the current_python or false if the version.major is not allowed.
|
||||
@ -67,8 +66,8 @@ module Python
|
||||
ENV.prepend 'PATH', py.binary.dirname, ':' unless py.from_osx?
|
||||
ENV.prepend 'LDFLAGS', "-F#{py.framework}" if py.brewed?
|
||||
# Track the state of the currently selected python for this block,
|
||||
# so if this python_helper is called again _inside_ the block, we can
|
||||
# just return the right python (see `else`-branch a few lines down):
|
||||
# so if this python_helper is called again _inside_ the block,
|
||||
# we can just return the right python (see `else`-branch a few lines down):
|
||||
@current_python = py
|
||||
res = instance_eval(&block)
|
||||
@current_python = nil
|
||||
@ -79,6 +78,4 @@ module Python
|
||||
end
|
||||
end
|
||||
end
|
||||
end # enf of python_helper method
|
||||
|
||||
end
|
||||
end # enf of python_helper method
|
||||
|
||||
@ -129,7 +129,7 @@ class PythonInstalled < Requirement
|
||||
end
|
||||
|
||||
# Homebrew's global site-packages. The local ones (just `site_packages`) are
|
||||
# populated by the python_helper method when the `prefix` of a formula is known.
|
||||
# populated by the python_helperg method when the `prefix` of a formula is known.
|
||||
def global_site_packages
|
||||
HOMEBREW_PREFIX/"lib/#{xy}/site-packages"
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user