diff options
| author | Mike McQuaid | 2018-03-03 18:17:04 +0000 | 
|---|---|---|
| committer | GitHub | 2018-03-03 18:17:04 +0000 | 
| commit | bc3389bdae5be31e5447802cb0eb8e1a967f5b4d (patch) | |
| tree | 2d61e66163e0fbf4650f38bb104374a32f53914c /Library/Homebrew/language | |
| parent | 5e3003688f801a49a46c1b24cb5e27d5c276af30 (diff) | |
| parent | 70253f0009ee8095a5d10ee7bdd891f1fe5cc35c (diff) | |
| download | brew-master.tar.bz2 | |
Adjust docs and more internal code for Python 3.
Diffstat (limited to 'Library/Homebrew/language')
| -rw-r--r-- | Library/Homebrew/language/python.rb | 24 | 
1 files changed, 12 insertions, 12 deletions
| diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index 64c57db72..c41e22b5c 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -89,7 +89,7 @@ module Language        # @param venv_root [Pathname, String] the path to the root of the virtualenv        #   (often `libexec/"venv"`)        # @param python [String] which interpreter to use (e.g. "python" -      #   or "python3") +      #   or "python2")        # @param formula [Formula] the active Formula        # @return [Virtualenv] a {Virtualenv} instance        def virtualenv_create(venv_root, python = "python", formula = self) @@ -115,8 +115,8 @@ module Language        # Returns true if a formula option for the specified python is currently        # active or if the specified python is required by the formula. Valid -      # inputs are "python", "python3", :python, and :python3. Note that -      # "with-python", "without-python", "with-python3", and "without-python3" +      # inputs are "python", "python2", :python, and :python2. Note that +      # "with-python", "without-python", "with-python@2", and "without-python@2"        # formula options are handled correctly even if not associated with any        # corresponding depends_on statement.        # @api private @@ -128,16 +128,16 @@ module Language        # Helper method for the common case of installing a Python application.        # Creates a virtualenv in `libexec`, installs all `resource`s defined        # on the formula, and then installs the formula. An options hash may be -      # passed (e.g., :using => "python3") to override the default, guessed -      # formula preference for python or python3, or to resolve an ambiguous -      # case where it's not clear whether python or python3 should be the +      # passed (e.g., :using => "python") to override the default, guessed +      # formula preference for python or python2, or to resolve an ambiguous +      # case where it's not clear whether python or python2 should be the        # default guess.        def virtualenv_install_with_resources(options = {})          python = options[:using]          if python.nil? -          wanted = %w[python python@2 python@3 python3].select { |py| needs_python?(py) } +          wanted = %w[python python@2 python2 python3].select { |py| needs_python?(py) }            raise FormulaAmbiguousPythonError, self if wanted.size > 1 -          python = wanted.first || "python2.7" +          python = wanted.first || "python"          end          venv = virtualenv_create(libexec, python.delete("@"))          venv.pip_install resources @@ -154,7 +154,7 @@ module Language          # @param venv_root [Pathname, String] the path to the root of the          #   virtualenv          # @param python [String] which interpreter to use; i.e. "python" or -        #   "python3" +        #   "python2"          def initialize(formula, venv_root, python)            @formula = formula            @venv_root = Pathname.new(venv_root) @@ -180,11 +180,11 @@ module Language              end            end -          # Robustify symlinks to survive python3 patch upgrades +          # Robustify symlinks to survive python patch upgrades            @venv_root.find do |f|              next unless f.symlink?              next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR -            python = rp.include?("python3") ? "python3" : "python" +            python = rp.include?("python2") ? "python2" : "python"              new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix              f.unlink              f.make_symlink new_target @@ -192,7 +192,7 @@ module Language            Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file|              prefix_path = prefix_file.read -            python = prefix_path.include?("python3") ? "python3" : "python" +            python = prefix_path.include?("python2") ? "python2" : "python"              prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix              prefix_file.atomic_write prefix_path            end | 
