Patchwork [2,of,3,v2,pip-fix] hghave: add check for virtualenv

login
register
mail settings
Submitter Augie Fackler
Date June 8, 2017, 2:52 p.m.
Message ID <510ffdb1a28bf8acab7e.1496933529@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/21246/
State Accepted
Headers show

Comments

Augie Fackler - June 8, 2017, 2:52 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1496762170 14400
#      Tue Jun 06 11:16:10 2017 -0400
# Node ID 510ffdb1a28bf8acab7ebe9d2c79af4555ac398e
# Parent  5a87da9a24af955df877bef261557e2d63fd5e3a
hghave: add check for virtualenv

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -634,3 +634,12 @@  def has_zstd():
 @check("devfull", "/dev/full special file")
 def has_dev_full():
     return os.path.exists('/dev/full')
+
+@check("virtualenv", "Python virtualenv support")
+def has_virtualenv():
+    try:
+        import virtualenv
+        virtualenv.ACTIVATE_SH
+        return True
+    except ImportError:
+        return False