Fix Pip default locations for build, src and log
parent
00548e645b
commit
9126f68820
|
@ -7,12 +7,32 @@ class Pip <Formula
|
||||||
|
|
||||||
depends_on 'setuptools'
|
depends_on 'setuptools'
|
||||||
|
|
||||||
|
def script lib_path
|
||||||
|
<<-EOS
|
||||||
|
#!/usr/bin/env python
|
||||||
|
"""
|
||||||
|
This is the Homebrew pip wrapper
|
||||||
|
"""
|
||||||
|
import sys
|
||||||
|
sys.path.insert(0, '#{lib_path}')
|
||||||
|
from pip import main
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
|
def patches
|
||||||
|
# better default paths for build, source-cache and log locations
|
||||||
|
DATA
|
||||||
|
end
|
||||||
|
|
||||||
def install
|
def install
|
||||||
dest = prefix+"lib/pip"
|
dest = prefix+"lib/pip"
|
||||||
|
|
||||||
# make sure we use the right python (distutils rewrites the shebang)
|
# make sure we use the right python (distutils rewrites the shebang)
|
||||||
# also adds the pip lib path to the PYTHONPATH
|
# also adds the pip lib path to the PYTHONPATH
|
||||||
(bin+'pip').write(DATA.read.sub("HOMEBREW_PIP_PATH", dest))
|
(bin+'pip').write(script(dest))
|
||||||
|
|
||||||
# FIXME? If we use /usr/bin/env python in the pip script
|
# FIXME? If we use /usr/bin/env python in the pip script
|
||||||
# then should we be hardcoding this version? I dunno.
|
# then should we be hardcoding this version? I dunno.
|
||||||
|
@ -34,13 +54,45 @@ class Pip <Formula
|
||||||
end
|
end
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
#!/usr/bin/env python
|
diff --git a/pip/baseparser.py b/pip/baseparser.py
|
||||||
"""
|
index 149c52d..82ffa46 100755
|
||||||
This is the Homebrew pip wrapper
|
--- a/pip/baseparser.py
|
||||||
"""
|
+++ b/pip/baseparser.py
|
||||||
import sys
|
@@ -186,7 +186,7 @@ parser.add_option(
|
||||||
sys.path.insert(0, 'HOMEBREW_PIP_PATH')
|
'--local-log', '--log-file',
|
||||||
from pip import main
|
dest='log_file',
|
||||||
|
metavar='FILENAME',
|
||||||
if __name__ == '__main__':
|
- default='./pip-log.txt',
|
||||||
main()
|
+ default=os.getenv('HOME')+'/Library/Logs/pip.log',
|
||||||
|
help=optparse.SUPPRESS_HELP)
|
||||||
|
|
||||||
|
parser.add_option(
|
||||||
|
diff --git a/pip/locations.py b/pip/locations.py
|
||||||
|
index bd70d92..e517292 100755
|
||||||
|
--- a/pip/locations.py
|
||||||
|
+++ b/pip/locations.py
|
||||||
|
@@ -4,19 +4,20 @@ import sys
|
||||||
|
import os
|
||||||
|
from distutils import sysconfig
|
||||||
|
|
||||||
|
+user_dir = os.path.expanduser('~')
|
||||||
|
+
|
||||||
|
if getattr(sys, 'real_prefix', None):
|
||||||
|
## FIXME: is build/ a good name?
|
||||||
|
build_prefix = os.path.join(sys.prefix, 'build')
|
||||||
|
src_prefix = os.path.join(sys.prefix, 'src')
|
||||||
|
else:
|
||||||
|
- ## FIXME: this isn't a very good default
|
||||||
|
- build_prefix = os.path.join(os.getcwd(), 'build')
|
||||||
|
- src_prefix = os.path.join(os.getcwd(), 'src')
|
||||||
|
+ build_prefix = user_dir + '/.pip/build'
|
||||||
|
+ src_prefix = user_dir + '/.pip/sources'
|
||||||
|
|
||||||
|
# FIXME doesn't account for venv linked to global site-packages
|
||||||
|
|
||||||
|
site_packages = sysconfig.get_python_lib()
|
||||||
|
-user_dir = os.path.expanduser('~')
|
||||||
|
+
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
bin_py = os.path.join(sys.prefix, 'Scripts')
|
||||||
|
# buildout uses 'bin' on Windows too?
|
||||||
|
|
Loading…
Reference in New Issue