diff options
| author | Tim D. Smith | 2014-11-06 22:25:11 -0800 |
|---|---|---|
| committer | Tim D. Smith | 2014-11-10 15:41:57 -0800 |
| commit | cb684f6c1ac9e7ce8460c686b0ce80fb93c27f4f (patch) | |
| tree | 621b8889bd1280d13ad4108dc27d7a1ff5014764 /Library/Homebrew/language/python.rb | |
| parent | 28d465fab1cd5091afbec20d23043f27c0561664 (diff) | |
| download | brew-cb684f6c1ac9e7ce8460c686b0ce80fb93c27f4f.tar.bz2 | |
language/python: new setup_install method
Closes Homebrew/homebrew#33988.
Diffstat (limited to 'Library/Homebrew/language/python.rb')
| -rw-r--r-- | Library/Homebrew/language/python.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index fad788dd7..303cb486e 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -48,5 +48,20 @@ module Language EOS quiet_system python, "-c", script end + + 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: + # https://github.com/pypa/pip/blob/043af83/pip/req/req_install.py#L743-L780 + shim = <<-EOS.undent + import setuptools, tokenize + __file__ = 'setup.py' + exec(compile(getattr(tokenize, 'open', open)(__file__).read() + .replace('\\r\\n', '\\n'), __file__, 'exec')) + EOS + args += %w[--single-version-externally-managed --record=installed.txt] + args << "--prefix=#{prefix}" + system python, "-c", shim, "install", *args + end end end |
