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

login
register
mail settings
Submitter Augie Fackler
Date June 6, 2017, 6:24 p.m.
Message ID <8d69b4886e678a7bc372.1496773490@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/21222/
State Superseded
Headers show

Comments

Augie Fackler - June 6, 2017, 6:24 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1496762170 14400
#      Tue Jun 06 11:16:10 2017 -0400
# Node ID 8d69b4886e678a7bc372097eeb33950592c53d43
# Parent  9f6d1425a632291c63ef09220336d0833c22ffcb
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