From ebf546d896936d18e1bf08be70543cf19f11790a Mon Sep 17 00:00:00 2001 From: Anand Kumria Date: Fri, 4 May 2012 13:14:26 +0100 Subject: [PATCH] Make it easier to install when the re2 library is in a virtualenv. Python virtual environments (virtualenv) can have private library and include directories. If we detect that we are inside a virtualenv (with the VIRTUAL_ENV environment variable) add it to the list of paths to search for the re2 library. Installing the re2 library in a virtualenv is basically: make make test make install prefix=$VIRTUAL_ENV --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index b4848267..f5950c77 100755 --- a/setup.py +++ b/setup.py @@ -50,6 +50,10 @@ def normalize(v): '/opt/', ] +# if we are in a virtual environment, also append its directories too +if os.getenv('VIRTUAL_ENV'): + _re2_prefixes.append(os.getenv('VIRTUAL_ENV')) + for re2_prefix in _re2_prefixes: if os.path.exists(os.path.join(re2_prefix, "include", "re2")): break