diff options
| author | Samuel John | 2013-09-03 10:41:54 +0200 | 
|---|---|---|
| committer | Samuel John | 2013-09-03 10:41:54 +0200 | 
| commit | 9f7c616c1cb7b2301e790dde56fc2ce0107c39de (patch) | |
| tree | d0afbd7437178c98367a066e8454902aceec974a /Library/Homebrew/python_helper.rb | |
| parent | 36ff1191ae2f2f86659ea5bbbaf028b5dbaf710a (diff) | |
| download | homebrew-9f7c616c1cb7b2301e790dde56fc2ce0107c39de.tar.bz2 | |
PythonInstalled: Adding a private_site_packages
that live in the `libexec` dir of a `Cellar`.
Diffstat (limited to 'Library/Homebrew/python_helper.rb')
| -rw-r--r-- | Library/Homebrew/python_helper.rb | 15 | 
1 files changed, 8 insertions, 7 deletions
diff --git a/Library/Homebrew/python_helper.rb b/Library/Homebrew/python_helper.rb index bccdb7a4e..8ebf0b794 100644 --- a/Library/Homebrew/python_helper.rb +++ b/Library/Homebrew/python_helper.rb @@ -51,22 +51,22 @@ 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 `site_packages` to the correct value in the Cellar.      py.site_packages = lib/py.xy/'site-packages' +    py.private_site_packages = libexec/"lib"/py.xy/"site-packages"      return py if !block_given?      puts "brew: Python block (#{py.binary})..." if ARGV.verbose? && ARGV.debug? -    # Ensure env changes are only temporary      # 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: setting PYTHONPATH to: #{py.site_packages}" if ARGV.verbose?        # 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 and        # lib points to the `HOMEBREW_PREFIX/Cellar/<formula>/<version>/lib`.        mkdir_p py.site_packages -      ENV['PYTHONPATH'] = py.site_packages +      ENV.append_path 'PYTHONPATH', py.site_packages +      # Allow to --prefix=libexec if a private site-packages is needed. +      mkdir_p py.private_site_packages +      ENV.append_path 'PYTHONPATH', py.private_site_packages +      puts "brew: PYTHONPATH=#{ENV['PYTHONPATH']}" if ARGV.verbose?        ENV['PYTHON'] = py.binary        ENV.prepend_path 'CMAKE_INCLUDE_PATH', py.incdir        ENV.prepend_path 'PKG_CONFIG_PATH', py.pkg_config_path if py.pkg_config_path @@ -76,13 +76,14 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block)        # 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        # we can just return the right python.        @current_python = py        res = instance_eval(&block)        @current_python = nil        res      ensure +      # Clean up if the private_site_packages has not been used. +      py.private_site_packages.rmdir if py.private_site_packages.children.empty?        ENV.replace(old_env)      end    end  | 
