Skip to content

Commit cb67412

Browse files
committed
Venv exec command optimization
1 parent 4782a9b commit cb67412

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Python + Virtualenv.sublime-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"target": "run_on_virtualenv",
2+
"target": "virtualenv_exec",
33
"shell_cmd": "python -u \"$file\"",
44
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
55
"selector": "source.python"

Virtualenv.sublime-settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"virtualenv_executable": "virtualenv",
2+
"executable": "virtualenv",
33
"virtualenv_directories": [
44
"~/.virtualenvs",
55
]

virtualenv.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import sublime
55
import sublime_plugin
6+
import Default as sublime_default
67

78
from .core import Virtualenv, find_virtualenvs
89

@@ -15,7 +16,7 @@ class VirtualenvCommand:
1516

1617
@property
1718
def virtualenv_exec(self):
18-
return settings().get('virtualenv_executable')
19+
return settings().get('executable')
1920

2021
@property
2122
def virtualenv_directories(self):
@@ -42,12 +43,12 @@ def set_virtualenv(self, virtualenv):
4243
self.window.set_project_data(project_data)
4344

4445

45-
class RunOnVirtualenvCommand(sublime_plugin.WindowCommand, VirtualenvCommand):
46+
class VirtualenvExecCommand(sublime_default.exec.ExecCommand, VirtualenvCommand):
4647
def run(self, **kwargs):
4748
virtualenv = self.get_virtualenv(**kwargs)
4849
kwargs['path'] = virtualenv.activated_path
4950
kwargs['env'] = dict(kwargs.get('env', {}), **virtualenv.activated_env)
50-
self.window.run_command('exec', kwargs) # built-in build command
51+
super(VirtualenvExecCommand, self).run(**kwargs)
5152

5253

5354
class ChooseVirtualenvCommand(sublime_plugin.WindowCommand, VirtualenvCommand):

0 commit comments

Comments
 (0)