factor out any()

This commit is contained in:
Ian Bicking 2009-11-20 01:10:46 -06:00
parent 98358cde0c
commit 493407a758
2 changed files with 13 additions and 9 deletions

View File

@ -37,6 +37,7 @@ import ConfigParser
from distutils.util import strtobool
from distutils import sysconfig
from pip.log import logger
from pip.backwardcompat import any
class InstallationError(Exception):
"""General exception during installation"""
@ -50,15 +51,6 @@ class DistributionNotFound(InstallationError):
class BadCommand(Exception):
"""Raised when virtualenv or a command is not found"""
try:
any
except NameError:
def any(seq):
for item in seq:
if item:
return True
return False
if getattr(sys, 'real_prefix', None):
## FIXME: is build/ a good name?
build_prefix = os.path.join(sys.prefix, 'build')

12
pip/backwardcompat.py Normal file
View File

@ -0,0 +1,12 @@
"""Stuff that isn't in some old versions of Python"""
__all__ = ['any']
try:
any
except NameError:
def any(seq):
for item in seq:
if item:
return True
return False