Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add even more ways to populate localinterfaces #4305

Merged
merged 2 commits into from Oct 6, 2013

Conversation

minrk
Copy link
Member

@minrk minrk commented Sep 29, 2013

Parse subprocess output from ifconfig / ip addr / ipconfig.
Lower priority than netifaces, but still higher priority than socket.gethostbyname.

More elaborate alternative to #4304

also typically faster and more reliable than gethostbyname,
but lower priority than netifaces.
@ellisonbg
Copy link
Member

This branch solves my startup problems both with and without netifaces installed.

return _load_ips_ifconfig()
except (IOError, NoIPAddresses):
pass
try:
Copy link
Member

Choose a reason for hiding this comment

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

I don't see the need of if os.name == 'nt': here if what are in the 2 cases are ~ same for the first block.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's ipconfig (Windows only) and ifconfig (non-Windows), not the same.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, yes... hard to spot.
Thanks.

@Carreau
Copy link
Member

Carreau commented Oct 3, 2013

+1

@Carreau
Copy link
Member

Carreau commented Oct 4, 2013

As discussed in hangout, Min will try on other os like solaris...etc.

@minrk
Copy link
Member Author

minrk commented Oct 4, 2013

works on OpenIndiana (successor to OpenSolaris), FreeBSD, OpenSUSE, etc. Seems safe.

@Carreau
Copy link
Member

Carreau commented Oct 5, 2013

great, merging soon if no objection from anyone.

Carreau added a commit that referenced this pull request Oct 6, 2013
Add even more ways to populate localinterfaces

use netifaces for faster IPython.utils.localinterfaces when availlable, 

Parse subprocess output from ifconfig / ip addr / ipconfig.
Lower priority than netifaces, but still higher priority than socket.gethostbyname.

Fallback to gethostname otherwise.

Should be much faster in worst case scenario where machine are badly configurred and can wait up to ~30s to start ipython. Slighly slower in other cases.
@Carreau Carreau merged commit aeeb7f5 into ipython:master Oct 6, 2013
@minrk minrk deleted the even-more-ways-to-get-ifaces branch October 6, 2013 19:53
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Add even more ways to populate localinterfaces

use netifaces for faster IPython.utils.localinterfaces when availlable, 

Parse subprocess output from ifconfig / ip addr / ipconfig.
Lower priority than netifaces, but still higher priority than socket.gethostbyname.

Fallback to gethostname otherwise.

Should be much faster in worst case scenario where machine are badly configurred and can wait up to ~30s to start ipython. Slighly slower in other cases.
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.

None yet

3 participants