From 765d6c6b4249e9a1504a23897e3636f1aa4ffe5d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 27 Nov 2017 06:53:30 -0600 Subject: [PATCH 01/12] Add support for terminals on Windows --- appveyor.yml | 7 ++++++- notebook/terminal/__init__.py | 4 ++++ setup.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 68bf1bc94f..c1d8cba5ad 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,4 +23,9 @@ install: - cmd: pip install .[test] test_script: - - nosetests --exclude-dir notebook\terminal -v notebook + - ps: | + If ($CONDA_PY -eq 27) { + nosetests --exclude-dir notebook\terminal -v notebook + } Else { + nosetests -v notebook + } diff --git a/notebook/terminal/__init__.py b/notebook/terminal/__init__.py index 90df830731..60adc34805 100644 --- a/notebook/terminal/__init__.py +++ b/notebook/terminal/__init__.py @@ -6,6 +6,7 @@ if not check_version(terminado.__version__, '0.3.3'): raise ImportError("terminado >= 0.3.3 required, found %s" % terminado.__version__) +from ipython_genutils.py3compat import which from terminado import NamedTermManager from tornado.log import app_log from notebook.utils import url_path_join as ujoin @@ -13,6 +14,9 @@ from . import api_handlers def initialize(webapp, notebook_dir, connection_url, settings): + default_shell = which('sh') + if not default_shell and os.name == 'nt': + default_shell = 'cmd.exe' shell = settings.get('shell_command', [os.environ.get('SHELL') or 'sh']) terminal_manager = webapp.settings['terminal_manager'] = NamedTermManager( shell_command=shell, diff --git a/setup.py b/setup.py index c90c95314c..4201c7d13c 100755 --- a/setup.py +++ b/setup.py @@ -153,9 +153,9 @@ 'nbconvert', 'ipykernel', # bless IPython kernel for now 'Send2Trash', + 'terminado>0.3.3; os.name=="posix" or (os_name=="nt" and python_version>="3.5")' ] extras_require = { - ':sys_platform != "win32"': ['terminado>=0.3.3'], 'test:python_version == "2.7"': ['mock'], 'test': ['nose', 'coverage', 'requests', 'nose_warnings_filters', 'nbval'], 'test:sys_platform == "win32"': ['nose-exclude'], From 02eba7a7d1ed068be304c6746c39de7b9f81fe97 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 27 Nov 2017 06:54:35 -0600 Subject: [PATCH 02/12] Bump terminado requirement --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4201c7d13c..8dc87bdbf8 100755 --- a/setup.py +++ b/setup.py @@ -153,7 +153,7 @@ 'nbconvert', 'ipykernel', # bless IPython kernel for now 'Send2Trash', - 'terminado>0.3.3; os.name=="posix" or (os_name=="nt" and python_version>="3.5")' + 'terminado=>0.8; os.name=="posix" or (os_name=="nt" and python_version>="3.5")' ] extras_require = { 'test:python_version == "2.7"': ['mock'], From 95c4c860807073efc7c82cc6fcd1f04152d025fb Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 27 Nov 2017 06:55:48 -0600 Subject: [PATCH 03/12] Fix handling of default shell --- notebook/terminal/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notebook/terminal/__init__.py b/notebook/terminal/__init__.py index 60adc34805..349c59c651 100644 --- a/notebook/terminal/__init__.py +++ b/notebook/terminal/__init__.py @@ -17,7 +17,9 @@ def initialize(webapp, notebook_dir, connection_url, settings): default_shell = which('sh') if not default_shell and os.name == 'nt': default_shell = 'cmd.exe' - shell = settings.get('shell_command', [os.environ.get('SHELL') or 'sh']) + shell = settings.get('shell_command', + [os.environ.get('SHELL', default_shell)] + ) terminal_manager = webapp.settings['terminal_manager'] = NamedTermManager( shell_command=shell, extra_env={'JUPYTER_SERVER_ROOT': notebook_dir, From 3a9844bf6403cf48c1c34d68f6b54b92b859260f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 27 Nov 2017 07:02:07 -0600 Subject: [PATCH 04/12] Fix appveyor syntax --- appveyor.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c1d8cba5ad..7307329f17 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,8 +24,9 @@ install: test_script: - ps: | - If ($CONDA_PY -eq 27) { - nosetests --exclude-dir notebook\terminal -v notebook - } Else { - nosetests -v notebook - } + $CONDA_PY = $env:CONDA_PY + If ($CONDA_PY -eq 32) { + nosetests --exclude-dir notebook\terminal -v notebook + } Else { + nosetests -v notebook + } From e2c13a12315b46daa02c34e893c8100d077c808c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 27 Nov 2017 07:48:34 -0600 Subject: [PATCH 05/12] Fix requires syntax --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8dc87bdbf8..a8a818fc67 100755 --- a/setup.py +++ b/setup.py @@ -153,7 +153,7 @@ 'nbconvert', 'ipykernel', # bless IPython kernel for now 'Send2Trash', - 'terminado=>0.8; os.name=="posix" or (os_name=="nt" and python_version>="3.5")' + 'terminado>=0.8.0; os.name=="posix" or (os_name=="nt" and python_version>="3.5")' ] extras_require = { 'test:python_version == "2.7"': ['mock'], From 4966b28e663ea6064fdf5b3a64a0cd8625cd173d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 27 Nov 2017 07:56:06 -0600 Subject: [PATCH 06/12] Fix version target --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 7307329f17..185cbfd3ea 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,7 +25,7 @@ install: test_script: - ps: | $CONDA_PY = $env:CONDA_PY - If ($CONDA_PY -eq 32) { + If ($CONDA_PY -eq 27) { nosetests --exclude-dir notebook\terminal -v notebook } Else { nosetests -v notebook From a0ba9bb2aea93b526e9dbb1d2d68485fb42d0617 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 27 Nov 2017 12:57:27 -0600 Subject: [PATCH 07/12] Clean up handling of default shell and update version check --- notebook/terminal/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notebook/terminal/__init__.py b/notebook/terminal/__init__.py index 349c59c651..8eb8dd16c9 100644 --- a/notebook/terminal/__init__.py +++ b/notebook/terminal/__init__.py @@ -3,8 +3,8 @@ import terminado from ..utils import check_version -if not check_version(terminado.__version__, '0.3.3'): - raise ImportError("terminado >= 0.3.3 required, found %s" % terminado.__version__) +if not check_version(terminado.__version__, '0.8.0'): + raise ImportError("terminado >= 0.8.0 required, found %s" % terminado.__version__) from ipython_genutils.py3compat import which from terminado import NamedTermManager @@ -18,7 +18,7 @@ def initialize(webapp, notebook_dir, connection_url, settings): if not default_shell and os.name == 'nt': default_shell = 'cmd.exe' shell = settings.get('shell_command', - [os.environ.get('SHELL', default_shell)] + [os.environ.get('SHELL') or default_shell] ) terminal_manager = webapp.settings['terminal_manager'] = NamedTermManager( shell_command=shell, From 8e9c7ecdcc1ed4e1f25aab938d4eaa59899387c4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Nov 2017 05:03:52 -0600 Subject: [PATCH 08/12] Always require terminado --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a8a818fc67..8c0bed2e0a 100755 --- a/setup.py +++ b/setup.py @@ -153,7 +153,7 @@ 'nbconvert', 'ipykernel', # bless IPython kernel for now 'Send2Trash', - 'terminado>=0.8.0; os.name=="posix" or (os_name=="nt" and python_version>="3.5")' + 'terminado>=0.8.0' ] extras_require = { 'test:python_version == "2.7"': ['mock'], From 24e40cdf0967aef00e488c2c0e46ce3be5b68fcc Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Nov 2017 05:12:08 -0600 Subject: [PATCH 09/12] Clean up appveyor test --- appveyor.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 185cbfd3ea..3b817395ae 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,10 +23,4 @@ install: - cmd: pip install .[test] test_script: - - ps: | - $CONDA_PY = $env:CONDA_PY - If ($CONDA_PY -eq 27) { - nosetests --exclude-dir notebook\terminal -v notebook - } Else { - nosetests -v notebook - } + - nosetests -v notebook From a840ea9fcb4f76ce30928fd3138827c24530d9ad Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Nov 2017 05:15:30 -0600 Subject: [PATCH 10/12] Make the terminado warning uniform --- notebook/notebookapp.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 4baf4f256a..c8e204fb97 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1328,8 +1328,7 @@ def init_terminals(self): initialize(self.web_app, self.notebook_dir, self.connection_url, self.terminado_settings) self.web_app.settings['terminals_available'] = True except ImportError as e: - log = self.log.debug if sys.platform == 'win32' else self.log.warning - log(_("Terminals not available (error was %s)"), e) + self.log.warning(_("Terminals not available (error was %s)"), e) def init_signal(self): if not sys.platform.startswith('win') and sys.stdin and sys.stdin.isatty(): From 2bd8f0375169df3ecb4e6f99945019c469038c27 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Nov 2017 05:46:56 -0600 Subject: [PATCH 11/12] Default to powershell on Windows --- notebook/terminal/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/terminal/__init__.py b/notebook/terminal/__init__.py index 8eb8dd16c9..75540df8dc 100644 --- a/notebook/terminal/__init__.py +++ b/notebook/terminal/__init__.py @@ -16,7 +16,7 @@ def initialize(webapp, notebook_dir, connection_url, settings): default_shell = which('sh') if not default_shell and os.name == 'nt': - default_shell = 'cmd.exe' + default_shell = 'powershell.exe' shell = settings.get('shell_command', [os.environ.get('SHELL') or default_shell] ) From cd809271e567344f981a3586bdb00bb1a3eccb43 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 28 Nov 2017 06:10:32 -0600 Subject: [PATCH 12/12] Clean up terminado verison --- notebook/terminal/__init__.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/notebook/terminal/__init__.py b/notebook/terminal/__init__.py index 75540df8dc..e165ef7471 100644 --- a/notebook/terminal/__init__.py +++ b/notebook/terminal/__init__.py @@ -3,8 +3,8 @@ import terminado from ..utils import check_version -if not check_version(terminado.__version__, '0.8.0'): - raise ImportError("terminado >= 0.8.0 required, found %s" % terminado.__version__) +if not check_version(terminado.__version__, '0.8.1'): + raise ImportError("terminado >= 0.8.1 required, found %s" % terminado.__version__) from ipython_genutils.py3compat import which from terminado import NamedTermManager diff --git a/setup.py b/setup.py index 8c0bed2e0a..ace0ac4f4f 100755 --- a/setup.py +++ b/setup.py @@ -153,7 +153,7 @@ 'nbconvert', 'ipykernel', # bless IPython kernel for now 'Send2Trash', - 'terminado>=0.8.0' + 'terminado>=0.8.1' ] extras_require = { 'test:python_version == "2.7"': ['mock'],