aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2013-07-02 10:21:45 -0700
committerAdam Vandenberg2013-07-02 10:21:45 -0700
commit53c97c3c96620734cbf55a487d9529f03568577e (patch)
tree823d9b757b76338a2303f2c08a8b063871eb9719 /Library
parenteafa7a141d50ca0cdba02e0d3effabe61d73f63d (diff)
downloadbrew-53c97c3c96620734cbf55a487d9529f03568577e.tar.bz2
Remove more nesting in python_helper
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/python_helper.rb56
1 files changed, 27 insertions, 29 deletions
diff --git a/Library/Homebrew/python_helper.rb b/Library/Homebrew/python_helper.rb
index 5fc66c112..13ff28348 100644
--- a/Library/Homebrew/python_helper.rb
+++ b/Library/Homebrew/python_helper.rb
@@ -55,36 +55,34 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)
filtered_python_reqs.sort_by{ |py| py.version }.map do |py|
# Now is the time to set the site_packages to the correct value
py.site_packages = lib/py.xy/'site-packages'
- if !block_given?
- return py
- else
- puts "brew: Python block (#{py.binary})..." if ARGV.verbose? && ARGV.debug?
- # Ensure env changes are only temporary
- begin
- old_env = ENV.to_hash
- # In order to install into the Cellar, the dir must exist and be in the
- # PYTHONPATH. This will be executed in the context of the formula
- # so that lib points to the HOMEBREW_PREFIX/Cellar/<formula>/<version>/lib
- puts "brew: Appending to PYTHONPATH: #{py.site_packages}" if ARGV.verbose?
- mkdir_p py.site_packages
- ENV.append 'PYTHONPATH', py.site_packages, ':'
- ENV['PYTHON'] = py.binary
- ENV.prepend 'CMAKE_INCLUDE_PATH', py.incdir, ':'
- ENV.prepend 'PKG_CONFIG_PATH', py.pkg_config_path, ':' if py.pkg_config_path
- ENV.prepend 'PATH', py.binary.dirname, ':' unless py.from_osx?
- #Note: Don't set LDFLAGS to point to the Python.framework, because
- # it breaks builds (for example scipy.)
+ return py if !block_given?
+
+ puts "brew: Python block (#{py.binary})..." if ARGV.verbose? && ARGV.debug?
+ # Ensure env changes are only temporary
+ begin
+ old_env = ENV.to_hash
+ # In order to install into the Cellar, the dir must exist and be in the
+ # PYTHONPATH. This will be executed in the context of the formula
+ # so that lib points to the HOMEBREW_PREFIX/Cellar/<formula>/<version>/lib
+ puts "brew: Appending to PYTHONPATH: #{py.site_packages}" if ARGV.verbose?
+ mkdir_p py.site_packages
+ ENV.append 'PYTHONPATH', py.site_packages, ':'
+ ENV['PYTHON'] = py.binary
+ ENV.prepend 'CMAKE_INCLUDE_PATH', py.incdir, ':'
+ ENV.prepend 'PKG_CONFIG_PATH', py.pkg_config_path, ':' if py.pkg_config_path
+ ENV.prepend 'PATH', py.binary.dirname, ':' unless py.from_osx?
+ #Note: Don't set LDFLAGS to point to the Python.framework, because
+ # it breaks builds (for example scipy.)
- # 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):
- @current_python = py
- res = instance_eval(&block)
- @current_python = nil
- res
- ensure
- ENV.replace(old_env)
- end
+ # 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):
+ @current_python = py
+ res = instance_eval(&block)
+ @current_python = nil
+ res
+ ensure
+ ENV.replace(old_env)
end
end
end