Skip to content

Vendor shutil.get_terminal_size. - #10587

Merged
takluyver merged 2 commits into
ipython:5.xfrom
Carreau:vendor-terminal-size
May 25, 2017
Merged

takluyver merged 2 commits into
ipython:5.xfrom
Carreau:vendor-terminal-size

Conversation

@Carreau

@Carreau Carreau commented May 23, 2017

Copy link
Copy Markdown
Member

Use the vendored version only if import error.
That should fix import error for many users.

Closes #9815.

This is only against the 5.x branch as this is in the stdlib on Python 3

Comment thread IPython/utils/terminal.py Outdated
try:
from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
except ImportError:
from _get_terminal_size import _get_terminal_size

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put the . in for an explicit relative import. It's clearer, and if someone adds from __future__ import absolute_import, it won't break.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point.

Use the vendored version only if import error.
That should fix import error for many users.

Closes ipython#9815.

This is only against the 5.x branch as this is in the stdlib on Python 3
@Carreau
Carreau force-pushed the vendor-terminal-size branch from db7d187 to e50d811 Compare May 24, 2017 21:01
Comment thread IPython/utils/_get_terminal_size.py Outdated
@@ -0,0 +1,103 @@
# vendored version of backports.get_terminal_size as nemesapece package are a
# mess and break, especially on ubuntu. This file is under MIT Licence.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should therefore include the copyright notice attributing the original file. And, technically, the permissions part of the MIT license as well, although I'm not going to complain if we just say 'MIT licence'.

The relevant bit of the MIT licence says:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

include commit hash, last commit, github URL
@Carreau

Carreau commented May 25, 2017

Copy link
Copy Markdown
Member Author

Licence added, link to repo, commit sha and date, updated to master version

@takluyver takluyver added this to the 5.4 milestone May 25, 2017
@takluyver
takluyver merged commit b8b3943 into ipython:5.x May 25, 2017
@Carreau
Carreau deleted the vendor-terminal-size branch May 29, 2017 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants