Aleš Erjavec avatar Aleš Erjavec committed 268717f

Changed the way virtualenv is detected.

Comments (0)

Files changed (1)

Orange/utils/addons.py

                             "packed.")
 
         switches = []
-        if site.USER_SITE in sys.path:   # we're not in a virtualenv
+        if not hasattr(sys, "real_prefix"):
+            # we're not in a virtualenv
             switches.append('--user')
         run_setup(setup_py, ['install'] + switches)
     finally:
 def easy_install_process(args, bufsize=-1):
     from setuptools.command import easy_install
     # Check if easy_install supports '--user' switch
-    if "user" in [opt[0] for opt in easy_install.easy_install.user_options]:
-        has_user_site = True
-    else:
-        has_user_site = False
+    options = [opt[0] for opt in easy_install.easy_install.user_options]
+    has_user_site = "user" in options
 
-    if has_user_site and site.USER_SITE in sys.path:
+    if has_user_site and not hasattr(sys, "real_prefix"):
+        # we're not in a virtualenv
+        # (why are we assuming we have write permissions in the
+        # virtualenv's site dir?)
         args = ["--user"] + args
 
     # properly quote arguments if necessary
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.