2009-10-20 19:26:13 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Pip <Formula
|
2010-12-07 00:17:33 +00:00
|
|
|
url 'http://pypi.python.org/packages/source/p/pip/pip-0.8.2.tar.gz'
|
2009-10-20 19:26:13 +00:00
|
|
|
homepage 'http://pip.openplans.org/'
|
2010-12-07 00:17:33 +00:00
|
|
|
md5 'df1eca0abe7643d92b5222240bed15f6'
|
2009-10-20 19:26:13 +00:00
|
|
|
|
2010-06-30 00:24:57 +00:00
|
|
|
depends_on 'distribute'
|
2010-02-20 13:17:31 +00:00
|
|
|
|
|
|
|
def patches
|
2010-06-30 00:24:57 +00:00
|
|
|
# Create a locations branch for darwin with placeholders
|
2010-02-20 13:17:31 +00:00
|
|
|
DATA
|
|
|
|
end
|
|
|
|
|
2009-10-20 19:26:13 +00:00
|
|
|
def install
|
2010-06-30 00:24:57 +00:00
|
|
|
python = Formula.factory("python")
|
|
|
|
unless python.installed?
|
|
|
|
onoe "The \"pip\" brew is only meant to be used against a Homebrew-built Python."
|
|
|
|
puts <<-EOS
|
|
|
|
Homebrew's "pip" formula is only meant to be installed against a Homebrew-
|
|
|
|
built version of Python, but we couldn't find such a version.
|
2010-02-14 12:51:25 +00:00
|
|
|
|
2010-06-30 00:24:57 +00:00
|
|
|
The system-provided Python comes with "easy_install" already installed, with the
|
|
|
|
caveat that some Python packages don't install cleanly against Apple's customized
|
|
|
|
versions of Python.
|
2010-02-14 12:51:25 +00:00
|
|
|
|
2010-06-30 00:24:57 +00:00
|
|
|
To install pip against a custom Python:
|
|
|
|
First download distribute from:
|
|
|
|
http://pypi.python.org/pypi/distribute
|
|
|
|
unzip, and run:
|
|
|
|
/path/to/custom/python setup.py install
|
2010-02-14 12:51:25 +00:00
|
|
|
|
2010-06-30 00:24:57 +00:00
|
|
|
Then download pip from:
|
|
|
|
http://pypi.python.org/pypi/pip
|
|
|
|
unzip, and run:
|
|
|
|
/path/to/custom/python setup.py install
|
|
|
|
EOS
|
|
|
|
exit 99
|
|
|
|
end
|
|
|
|
|
|
|
|
inreplace 'pip/locations.py' do |s|
|
|
|
|
# Replace placeholders with HOMEBREW paths
|
|
|
|
s.gsub! '#BUILD_PREFIX#', "'#{var}/pip/build'"
|
|
|
|
s.gsub! '#SRC_PREFIX#', "'#{var}/pip/src'"
|
2010-07-15 08:40:32 +00:00
|
|
|
s.gsub! '#STORAGE_DIR#', "'#{var}/pip'"
|
2010-07-04 14:58:37 +00:00
|
|
|
s.gsub! '#CONFIG_FILE#', "'#{etc}/pip.conf'"
|
2010-06-30 00:24:57 +00:00
|
|
|
s.gsub! '#LOG_FILE#', "'#{var}/pip/pip.log'"
|
|
|
|
end
|
|
|
|
|
|
|
|
system "#{python.bin}/python", "setup.py", "install",
|
|
|
|
"--install-scripts", bin,
|
|
|
|
"--install-purelib", python.site_packages,
|
|
|
|
"--install-platlib", python.site_packages
|
2009-10-20 19:26:13 +00:00
|
|
|
|
2010-06-30 00:24:57 +00:00
|
|
|
(prefix+"README.homebrew").write <<-EOF
|
|
|
|
pip's libraries were installed directly into:
|
|
|
|
#{python.site_packages}
|
|
|
|
EOF
|
2009-10-20 19:26:13 +00:00
|
|
|
end
|
2010-02-13 11:41:21 +00:00
|
|
|
|
|
|
|
def caveats
|
2010-06-30 00:24:57 +00:00
|
|
|
<<-EOS.undent
|
|
|
|
This formula is only meant to be used against a Homebrew-built Python.
|
|
|
|
It will install itself directly into Python's location in the Cellar.
|
|
|
|
|
|
|
|
Pip's configuration file lives at:
|
2010-07-04 14:58:37 +00:00
|
|
|
#{etc}/pip.conf
|
2010-06-30 00:24:57 +00:00
|
|
|
EOS
|
2010-02-13 11:41:21 +00:00
|
|
|
end
|
2009-10-20 19:26:13 +00:00
|
|
|
end
|
|
|
|
|
2010-06-30 00:24:57 +00:00
|
|
|
|
2009-10-20 19:26:13 +00:00
|
|
|
__END__
|
2010-02-20 13:17:31 +00:00
|
|
|
diff --git a/pip/locations.py b/pip/locations.py
|
2010-09-18 05:40:15 +00:00
|
|
|
index 4254ef2..0a31cc2 100644
|
2010-02-20 13:17:31 +00:00
|
|
|
--- a/pip/locations.py
|
|
|
|
+++ b/pip/locations.py
|
2010-09-18 05:40:15 +00:00
|
|
|
@@ -19,8 +19,8 @@ if running_under_virtualenv():
|
2010-02-20 13:17:31 +00:00
|
|
|
src_prefix = os.path.join(sys.prefix, 'src')
|
|
|
|
else:
|
2010-06-30 00:24:57 +00:00
|
|
|
## FIXME: this isn't a very good default
|
2010-02-20 13:17:31 +00:00
|
|
|
- build_prefix = os.path.join(os.getcwd(), 'build')
|
|
|
|
- src_prefix = os.path.join(os.getcwd(), 'src')
|
2010-06-30 00:24:57 +00:00
|
|
|
+ build_prefix = #BUILD_PREFIX#
|
|
|
|
+ src_prefix = #SRC_PREFIX#
|
2010-02-20 13:17:31 +00:00
|
|
|
|
|
|
|
# FIXME doesn't account for venv linked to global site-packages
|
|
|
|
|
2010-09-18 05:40:15 +00:00
|
|
|
@@ -35,11 +35,16 @@ if sys.platform == 'win32':
|
2010-06-30 00:24:57 +00:00
|
|
|
default_storage_dir = os.path.join(user_dir, 'pip')
|
|
|
|
default_config_file = os.path.join(default_storage_dir, 'pip.ini')
|
|
|
|
default_log_file = os.path.join(default_storage_dir, 'pip.log')
|
|
|
|
+elif sys.platform[:6] == 'darwin':
|
|
|
|
+ bin_py = os.path.join(sys.prefix, 'bin')
|
|
|
|
+ default_storage_dir = #STORAGE_DIR#
|
|
|
|
+ default_config_file = #CONFIG_FILE#
|
|
|
|
+ default_log_file = #LOG_FILE#
|
|
|
|
+ # Forcing to use /usr/local/bin for standard Mac OS X framework installs
|
|
|
|
+ if sys.prefix[:16] == '/System/Library/':
|
|
|
|
+ bin_py = '/usr/local/bin'
|
|
|
|
else:
|
|
|
|
bin_py = os.path.join(sys.prefix, 'bin')
|
|
|
|
default_storage_dir = os.path.join(user_dir, '.pip')
|
|
|
|
default_config_file = os.path.join(default_storage_dir, 'pip.conf')
|
|
|
|
default_log_file = os.path.join(default_storage_dir, 'pip.log')
|
|
|
|
- # Forcing to use /usr/local/bin for standard Mac OS X framework installs
|
|
|
|
- if sys.platform[:6] == 'darwin' and sys.prefix[:16] == '/System/Library/':
|
|
|
|
- bin_py = '/usr/local/bin'
|