summaryrefslogtreecommitdiff
path: root/pip/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'pip/util.py')
-rw-r--r--pip/util.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/pip/util.py b/pip/util.py
index 5d0ed4f88..e5ad6df17 100644
--- a/pip/util.py
+++ b/pip/util.py
@@ -98,10 +98,18 @@ def find_command(cmd, paths=None, pathext=None):
def get_pathext(default_pathext=None):
"""Returns the path extensions from environment or a default"""
if default_pathext is None:
- default_pathext = os.pathsep.join([ '.COM', '.EXE', '.BAT', '.CMD' ])
+ default_pathext = os.pathsep.join(['.COM', '.EXE', '.BAT', '.CMD'])
pathext = os.environ.get('PATHEXT', default_pathext)
return pathext
+
+def ask_path_exists(message, options):
+ for action in os.environ.get('PIP_EXISTS_ACTION', ''):
+ if action in options:
+ return action
+ return ask(message, options)
+
+
def ask(message, options):
"""Ask the message interactively, with the given possible responses"""
while 1:
@@ -424,6 +432,17 @@ def untar_file(filename, location):
if member.isdir():
if not os.path.exists(path):
os.makedirs(path)
+ elif member.issym():
+ try:
+ tar._extract_member(member, path)
+ except:
+ e = sys.exc_info()[1]
+ # Some corrupt tar files seem to produce this
+ # (specifically bad symlinks)
+ logger.warn(
+ 'In the tar file %s the member %s is invalid: %s'
+ % (filename, member.name, e))
+ continue
else:
try:
fp = tar.extractfile(member)