Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7f5096f

Browse files
committed
Fix virtualenv.
1 parent33ef6c6 commit7f5096f

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
importos
44
importsys
@@ -9,7 +9,7 @@
99

1010
@env.catch_exceptions
1111
defenable_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
returnenv.stop()
2727

28-
activate_this=os.path.join(os.path.join(path,'bin'),'activate_this.py')
29-
30-
# Fix for windows
31-
ifnotos.path.exists(activate_this):
32-
activate_this=os.path.join(
33-
os.path.join(path,'Scripts'),'activate_this.py')
34-
35-
try:
36-
withopen(activate_this)asf:
37-
source=f.read()
38-
exec(compile(# noqa
39-
source,activate_this,'exec'),dict(__file__=activate_this))
40-
exceptIOError:
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
returnTrue
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+
defactivate_env_from_path(env_path):
35+
"""Activate given virtualenv."""
5436
prev_sys_path=list(sys.path)
5537

5638
ifsys.platform=='win32':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp