aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/language/python.rb
diff options
context:
space:
mode:
authorTim D. Smith2014-12-09 23:17:11 -0800
committerTim D. Smith2014-12-10 14:18:23 -0800
commit75535395acb996b41e407a370709af6cef3123f1 (patch)
tree425e276e862cc11b70bd050e10d01f11aaef73e5 /Library/Homebrew/language/python.rb
parent720f13d8d588156dc85229af3c3820c5bf0f1362 (diff)
downloadbrew-75535395acb996b41e407a370709af6cef3123f1.tar.bz2
language/python: setup_install_args
Add a helper like std_cmake_args that returns the correct incantation for invoking setup.py in a consistent way and with our preferred arguments. Replaces setup_install.
Diffstat (limited to 'Library/Homebrew/language/python.rb')
-rw-r--r--Library/Homebrew/language/python.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb
index f4653be1e..83670dba7 100644
--- a/Library/Homebrew/language/python.rb
+++ b/Library/Homebrew/language/python.rb
@@ -52,6 +52,7 @@ module Language
quiet_system python, "-c", script
end
+ # deprecated; use system "python", *setup_install_args(prefix) instead
def self.setup_install python, prefix, *args
# force-import setuptools, which monkey-patches distutils, to make
# sure that we always call a setuptools setup.py. trick borrowed from pip:
@@ -66,5 +67,22 @@ module Language
args << "--prefix=#{prefix}"
system python, "-c", shim, "install", *args
end
+
+ def self.setup_install_args prefix
+ shim = <<-EOS.undent
+ import setuptools, tokenize
+ __file__ = 'setup.py'
+ exec(compile(getattr(tokenize, 'open', open)(__file__).read()
+ .replace('\\r\\n', '\\n'), __file__, 'exec'))
+ EOS
+ %W[
+ -c
+ #{shim}
+ install
+ --prefix=#{prefix}
+ --single-version-externally-managed
+ --record=installed.txt
+ ]
+ end
end
end