aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/requirements/python_requirement.rb
diff options
context:
space:
mode:
authorMike McQuaid2017-12-31 16:11:21 +0000
committerGitHub2017-12-31 16:11:21 +0000
commit93a2e9fc25407b049d594ad2da112a5cb8bdf5c3 (patch)
tree33052267149fb3cff2562986a30a7249fa28d1b3 /Library/Homebrew/requirements/python_requirement.rb
parentc449bdb92c89c8e41682750003999664d0e5808d (diff)
parentf9b6407110d7fb98a65b470d166fc5b7be6052ee (diff)
downloadbrew-93a2e9fc25407b049d594ad2da112a5cb8bdf5c3.tar.bz2
Merge pull request #3612 from MikeMcQuaid/more-deprecations
requirements: move more to compat.
Diffstat (limited to 'Library/Homebrew/requirements/python_requirement.rb')
-rw-r--r--Library/Homebrew/requirements/python_requirement.rb68
1 files changed, 0 insertions, 68 deletions
diff --git a/Library/Homebrew/requirements/python_requirement.rb b/Library/Homebrew/requirements/python_requirement.rb
deleted file mode 100644
index 3215d0a6c..000000000
--- a/Library/Homebrew/requirements/python_requirement.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-require "language/python"
-
-class PythonRequirement < Requirement
- fatal true
- default_formula "python"
-
- satisfy build_env: false do
- python = which_python
- next unless python
- next unless short_version
- # Always use Python 2.7 for consistency on older versions of Mac OS X.
- short_version == Version.create("2.7")
- end
-
- env do
- if !system_python? && short_version == Version.create("2.7")
- ENV.prepend_path "PATH", which_python.dirname
- end
-
- # Homebrew Python should take precedence over other Pythons in the PATH
- ENV.prepend_path "PATH", Formula["python"].opt_bin
- ENV.prepend_path "PATH", Formula["python"].opt_libexec/"bin"
-
- if system_python?
- ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages"
- end
- end
-
- private
-
- def short_version
- @short_version ||= Language::Python.major_minor_version which_python
- end
-
- def which_python
- python = which python_binary
- return unless python
- Pathname.new Utils.popen_read(python, "-c", "import sys; print(sys.executable)").strip
- end
-
- def system_python
- "/usr/bin/#{python_binary}"
- end
-
- def system_python?
- system_python == which_python.to_s
- end
-
- def python_binary
- "python2.7"
- end
-
- # Deprecated
- alias to_s python_binary
-end
-
-class Python3Requirement < PythonRequirement
- fatal true
- default_formula "python3"
-
- satisfy(build_env: false) { which_python }
-
- private
-
- def python_binary
- "python3"
- end
-end