Hugo Lopes Tavares avatar Hugo Lopes Tavares committed c389429

removed _running_under_virtualenv defined in locations.py, and renamed pip.util.in_venv to pip.util.running_under_virtualenv

Comments (0)

Files changed (3)

 import sys
 import os
 from distutils import sysconfig
+from pip.util import running_under_virtualenv
 
 
-def _running_under_virtualenv():
-    return hasattr(sys, 'real_prefix')
-
-
-if _running_under_virtualenv():
+if running_under_virtualenv():
     ## FIXME: is build/ a good name?
     build_prefix = os.path.join(sys.prefix, 'build')
     src_prefix = os.path.join(sys.prefix, 'src')
 from pip.util import make_path_relative, is_svn_page, file_contents
 from pip.util import has_leading_dir, split_leading_dir
 from pip.util import get_file_content
-from pip.util import in_venv, geturl
+from pip.util import running_under_virtualenv, geturl
 from pip import call_subprocess
 from pip.backwardcompat import any, md5, copytree
 from pip.index import Link
                 '--single-version-externally-managed',
                 '--record', record_filename]
 
-            if in_venv():
+            if running_under_virtualenv():
                 ## FIXME: I'm not sure if this is a reasonable location; probably not
                 ## but we can't put it in the default location, as that is a virtualenv symlink that isn't writable
                 install_args += ['--install-headers',
             pass
 
 
-def in_venv():
+def running_under_virtualenv():
     """
     Return True if we're running inside a virtualenv, False otherwise.
 
     If we're not in a virtualenv, all paths are considered "local."
 
     """
-    if not in_venv():
+    if not running_under_virtualenv():
         return True
     return normalize_path(path).startswith(normalize_path(sys.prefix))
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.