comparison planemo/lib/python3.7/site-packages/pip/_internal/utils/virtualenv.py @ 1:56ad4e20f292 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:32:28 -0400
parents
children
comparison
equal deleted inserted replaced
0:d30785e31577 1:56ad4e20f292
1 import os.path
2 import site
3 import sys
4
5
6 def running_under_virtualenv():
7 # type: () -> bool
8 """
9 Return True if we're running inside a virtualenv, False otherwise.
10
11 """
12 if hasattr(sys, 'real_prefix'):
13 # pypa/virtualenv case
14 return True
15 elif sys.prefix != getattr(sys, "base_prefix", sys.prefix):
16 # PEP 405 venv
17 return True
18
19 return False
20
21
22 def virtualenv_no_global():
23 # type: () -> bool
24 """
25 Return True if in a venv and no system site packages.
26 """
27 # this mirrors the logic in virtualenv.py for locating the
28 # no-global-site-packages.txt file
29 site_mod_dir = os.path.dirname(os.path.abspath(site.__file__))
30 no_global_file = os.path.join(site_mod_dir, 'no-global-site-packages.txt')
31 if running_under_virtualenv() and os.path.isfile(no_global_file):
32 return True
33 else:
34 return False