Skip to content

Commit 7f5096f

Browse files
committed
Fix virtualenv.
1 parent 33ef6c6 commit 7f5096f

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

pymode/virtualenv.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Support virtualenv in pymode. """
1+
"""Support virtualenv in pymode."""
22

33
import os
44
import sys
@@ -9,7 +9,7 @@
99

1010
@env.catch_exceptions
1111
def enable_virtualenv():
12-
""" Enable virtualenv for vim.
12+
"""Enable virtualenv for vim.
1313
1414
:return bool:
1515
@@ -25,32 +25,14 @@ def enable_virtualenv():
2525
env.message('Virtualenv %s already enabled.' % path)
2626
return env.stop()
2727

28-
activate_this = os.path.join(os.path.join(path, 'bin'), 'activate_this.py')
29-
30-
# Fix for windows
31-
if not os.path.exists(activate_this):
32-
activate_this = os.path.join(
33-
os.path.join(path, 'Scripts'), 'activate_this.py')
34-
35-
try:
36-
with open(activate_this) as f:
37-
source = f.read()
38-
exec(compile( # noqa
39-
source, activate_this, 'exec'), dict(__file__=activate_this))
40-
except IOError:
41-
_activate_env_from_path(path)
42-
28+
activate_env_from_path(path)
4329
env.message('Activate virtualenv: ' + path)
4430
env.let('g:pymode_virtualenv_enabled', path)
4531
return True
4632

4733

48-
def _activate_env_from_path(env_path):
49-
""" Fix when `activate_this.py` does not exist.
50-
51-
For Python 3.3 and newer, a new command-line tool `pyvenv` create venv
52-
will not provide 'activate_this.py'.
53-
"""
34+
def activate_env_from_path(env_path):
35+
"""Activate given virtualenv."""
5436
prev_sys_path = list(sys.path)
5537

5638
if sys.platform == 'win32':

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy