Skip to content

Commit e74451f

Browse files
committed
Get virtualenv from project or build settings
1 parent c3188ce commit e74451f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sublime_virtualenv.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ def get_build_kwargs(self):
3939

4040
class RunOnVirtualenvCommand(sublime_plugin.WindowCommand):
4141
def run(self, **kwargs):
42-
virtualenv = Virtualenv("/home/adrian/.virtualenvs/sublime_virtualenv")
42+
venv_location = kwargs.pop('virtualenv', "")
43+
virtualenv = self.get_virtualenv(venv_location)
4344
deep_update(kwargs, virtualenv.get_build_kwargs())
44-
self.window.run_command('exec', kwargs)
45+
self.window.run_command('exec', kwargs) # call built-in build command
46+
47+
def get_virtualenv(self, location=""):
48+
if not location:
49+
project_settings = self.window.project_data() or {}
50+
location = project_settings.get('virtualenv')
51+
return Virtualenv(location)

0 commit comments

Comments
 (0)