| Conditions | 4 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 4.074 |
| Changes | 0 | ||
| 1 | """Gives useful information about the current virtualenv, files locations if |
||
| 9 | 1 | def get_venv_basedir(): |
|
| 10 | """Returns the base directory of the virtualenv, useful to read configuration and plugins""" |
||
| 11 | |||
| 12 | 1 | exec_prefix = get_config_vars()['exec_prefix'] |
|
| 13 | 1 | has_real_prefix = hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix) |
|
| 14 | 1 | if has_real_prefix is False or (hasattr(sys, 'real_prefix') and exec_prefix.startswith(sys.real_prefix)): |
|
| 15 | raise EnvironmentError('You must be in a virtual environment') |
||
| 16 | |||
| 17 | 1 | return os.path.abspath(get_config_vars()['exec_prefix'] + '/../') |
|
| 18 | |||
| 34 |