From 9f649a892a65fa2830f01beb4f1600cec73f3a4a Mon Sep 17 00:00:00 2001 From: ttimasdf Date: Sun, 23 Apr 2017 14:04:43 +0800 Subject: [PATCH 1/3] Launch virtualenv directly --- lang_integration.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lang_integration.py b/lang_integration.py index 62b92c2b..051f10b6 100644 --- a/lang_integration.py +++ b/lang_integration.py @@ -93,8 +93,13 @@ def run_virtualenv(self, choices, index): return (name, directory) = choices[index] activate_file = os.path.join(directory, "activate_this.py") - python_executable = os.path.join(directory, "python") + ipy = any(os.path.exists(python_executable[:-6]+ipy) for ipy in ["ipython", "ipython.exe"]) + python_executable = os.path.join(directory, "ipython" if ipy else "python") path_separator = ":" + if ipy: + python_cmdline = [python_executable, "-i"] + else: + python_cmdline = [python_executable, "-i", "-u"] if os.name == "nt": python_executable += ".exe" # ;-) path_separator = ";" @@ -103,13 +108,11 @@ def run_virtualenv(self, choices, index): { "encoding":"utf8", "type": "subprocess", - "autocomplete_server": True, "extend_env": { "PATH": directory + path_separator + "{PATH}", - "SUBLIMEREPL_ACTIVATE_THIS": activate_file, "PYTHONIOENCODING": "utf-8" }, - "cmd": [python_executable, "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"], + "cmd": python_cmdline, "cwd": "$file_path", "encoding": "utf8", "syntax": "Packages/Python/Python.tmLanguage", From de6e29cf4eaa36df6ceeb0a3bf9b93de302f286b Mon Sep 17 00:00:00 2001 From: ttimasdf Date: Sun, 23 Apr 2017 14:18:13 +0800 Subject: [PATCH 2/3] Add exe prefix correctly --- lang_integration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lang_integration.py b/lang_integration.py index 051f10b6..904475ac 100644 --- a/lang_integration.py +++ b/lang_integration.py @@ -96,13 +96,13 @@ def run_virtualenv(self, choices, index): ipy = any(os.path.exists(python_executable[:-6]+ipy) for ipy in ["ipython", "ipython.exe"]) python_executable = os.path.join(directory, "ipython" if ipy else "python") path_separator = ":" + if os.name == "nt": + python_executable += ".exe" # ;-) + path_separator = ";" if ipy: python_cmdline = [python_executable, "-i"] else: python_cmdline = [python_executable, "-i", "-u"] - if os.name == "nt": - python_executable += ".exe" # ;-) - path_separator = ";" self.window.run_command("repl_open", { From d12ef6a71344bcdd2c1c48a435c0635e6b3c3654 Mon Sep 17 00:00:00 2001 From: ttimasdf Date: Mon, 24 Apr 2017 17:00:39 +0800 Subject: [PATCH 3/3] Fix a stuuuupid mistake --- lang_integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang_integration.py b/lang_integration.py index 904475ac..672ac48c 100644 --- a/lang_integration.py +++ b/lang_integration.py @@ -93,7 +93,7 @@ def run_virtualenv(self, choices, index): return (name, directory) = choices[index] activate_file = os.path.join(directory, "activate_this.py") - ipy = any(os.path.exists(python_executable[:-6]+ipy) for ipy in ["ipython", "ipython.exe"]) + ipy = any(os.path.exists(os.path.join(directory, ipy)) for ipy in ["ipython", "ipython.exe"]) python_executable = os.path.join(directory, "ipython" if ipy else "python") path_separator = ":" if os.name == "nt":