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

Commita3a3b6a

Browse files
committed
Merge branch 'mattdodge-virtualenv_absolute' into develop
2 parents95a285c +05a0e85 commita3a3b6a

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

‎autoload/pymode/virtualenv.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fun! pymode#virtualenv#init() "{{{
1111

1212
endfunction"}}}
1313

14-
fun!pymode#virtualenv#activate(relpath)"{{{
15-
letg:pymode_virtualenv_path=getcwd() .'/' .a:relpath
14+
fun!pymode#virtualenv#activate(path)"{{{
15+
letg:pymode_virtualenv_path=a:path
1616
callpymode#virtualenv#init()
1717
endfunction"}}}

‎doc/pymode.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ Bind keys to show documentation for current word (selection)
212212
*pymode-virtualenv*
213213

214214
Commands:
215-
*:PymodeVirtualenv*<path> -- Activate virtualenv (pathis related to
216-
current working directory)
215+
*:PymodeVirtualenv*<path> -- Activate virtualenv (pathcan be absolute or
216+
relative tocurrent working directory)
217217

218218
Enable automatic virtualenv detection*'g:pymode_virtualenv'*
219219
>

‎pymode/virtualenv.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ def enable_virtualenv():
1515
1616
"""
1717
path=env.var('g:pymode_virtualenv_path')
18+
# Normalize path to be an absolute path
19+
# If an absolute path is provided, that path will be returned, otherwise
20+
# the returned path will be an absolute path but computed relative
21+
# to the current working directory
22+
path=os.path.abspath(path)
1823
enabled=env.var('g:pymode_virtualenv_enabled')
1924
ifpath==enabled:
2025
env.message('Virtualenv %s already enabled.'%path)

‎t/virtualenv.vim

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
describe'pymode-virtualenv'
2+
3+
before
4+
sourceplugin/pymode.vim
5+
setfiletype=python
6+
end
7+
8+
after
9+
bd!
10+
end
11+
12+
" TODO: How can we mock the virtualenv activation to check that the
13+
" proper path is set to pymode_virtualenv_enabled? Right now, the
14+
" python function enable_virtualenv gets called but fails when trying
15+
" to actually activate so the env.let never gets called
16+
17+
it'accepts relative paths'
18+
callpymode#virtualenv#activate("sample/relative/path")
19+
" Our path variable is the path argument
20+
Expectg:pymode_virtualenv_path=="sample/relative/path"
21+
end
22+
23+
it'accepts absolute paths'
24+
callpymode#virtualenv#activate("/sample/absolute/path")
25+
" Our path variable is the path argument
26+
Expectg:pymode_virtualenv_path=="/sample/absolute/path"
27+
end
28+
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp