tests/hghave.py
changeset 46097 1b5e0d0bdb05
parent 45987 d42809b6b10f
child 46163 ebcc52046096
equal deleted inserted replaced
46096:4d5e2fd53707 46097:1b5e0d0bdb05
   884         return True
   884         return True
   885     except ImportError:
   885     except ImportError:
   886         return False
   886         return False
   887 
   887 
   888 
   888 
   889 @check("py2virtualenv", "Python2 virtualenv support")
   889 @check("virtualenv", "virtualenv support")
   890 def has_py2virtualenv():
   890 def has_virtualenv():
   891     if sys.version_info[0] != 2:
       
   892         return False
       
   893 
       
   894     try:
   891     try:
   895         import virtualenv
   892         import virtualenv
   896 
   893 
   897         virtualenv.ACTIVATE_SH
   894         # --no-site-package became the default in 1.7 (Nov 2011), and the
   898         return True
   895         # argument was removed in 20.0 (Feb 2020).  Rather than make the
   899     except ImportError:
   896         # script complicated, just ignore ancient versions.
       
   897         return int(virtualenv.__version__.split('.')[0]) > 1
       
   898     except (AttributeError, ImportError, IndexError):
   900         return False
   899         return False
   901 
   900 
   902 
   901 
   903 @check("fsmonitor", "running tests with fsmonitor")
   902 @check("fsmonitor", "running tests with fsmonitor")
   904 def has_fsmonitor():
   903 def has_fsmonitor():