add py3.5 netifaces

This commit is contained in:
j 2016-03-26 17:24:51 +01:00
commit 86cc34eed3
228 changed files with 1616 additions and 65914 deletions

View file

@ -276,22 +276,40 @@ def renames(old, new):
def is_local(path):
"""
Return True if path is within sys.prefix, if we're running in a virtualenv.
Return True if this is a path pip is allowed to modify.
If we're not in a virtualenv, all paths are considered "local."
If we're in a virtualenv, sys.prefix points to the virtualenv's
prefix; only sys.prefix is considered local.
If we're not in a virtualenv, in general we can modify anything.
However, if the OS vendor has configured distutils to install
somewhere other than sys.prefix (which could be a subdirectory of
sys.prefix, e.g. /usr/local), we consider sys.prefix itself nonlocal
and the domain of the OS vendor. (In other words, everything _other
than_ sys.prefix is considered local.)
"""
if not running_under_virtualenv():
return True
return normalize_path(path).startswith(normalize_path(sys.prefix))
path = normalize_path(path)
prefix = normalize_path(sys.prefix)
if running_under_virtualenv():
return path.startswith(normalize_path(sys.prefix))
else:
from pip.locations import distutils_scheme
if path.startswith(prefix):
for local_path in distutils_scheme("").values():
if path.startswith(normalize_path(local_path)):
return True
return False
else:
return True
def dist_is_local(dist):
"""
Return True if given Distribution object is installed locally
(i.e. within current virtualenv).
Always True if we're not in a virtualenv.
Return True if given Distribution object is installed somewhere pip
is allowed to modify.
"""
return is_local(dist_location(dist))