Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

otool should not be unconditionally called on osx #524

Closed
fperez opened this Issue · 2 comments

2 participants

@fperez
Owner

On OSX systems without XCode installed, IPython won't run, crashing with:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.2/bin/ipython3", line 10, in 
    launch_new_instance()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/frontend/terminal/ipapp.py", line 662, in launch_new_instance
    app.start()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/core/application.py", line 219, in start
    self.initialize()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/core/application.py", line 211, in initialize
    self.construct()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/frontend/terminal/ipapp.py", line 478, in construct
    self.shell = TerminalInteractiveShell.instance(config=self.master_config)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/config/configurable.py", line 203, in instance
    inst = cls(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/frontend/terminal/interactiveshell.py", line 86, in __init__
    user_global_ns=user_global_ns, custom_exceptions=custom_exceptions
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/core/interactiveshell.py", line 400, in __init__
    self.init_readline()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/core/interactiveshell.py", line 1542, in init_readline
    import IPython.utils.rlineimpl as readline
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/IPython/utils/rlineimpl.py", line 59, in 
    p = Popen(['otool', '-L', _rl.__file__], stdout=PIPE, stderr=PIPE)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/subprocess.py", line 736, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/subprocess.py", line 1330, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 2] No such file or directory: 'otool'

We need to make the otool call conditional, since XCode is a fairly large dependency that we don't want to require of all our users.

@minrk
Owner

I can detect libedt with lsof, which isn't part of xcode:

'lsof -p %i'%os.getpid()
and check for libedit.*.dylib

Note that this doesn't check the readline.so object directly, so if another module has linked to libedit and is imported prior to IPython, there will be a false positive.

@minrk
Owner

fix issued: #525

@minrk minrk closed this issue from a commit
@minrk minrk fallback on lsof if otool not found in libedit detection
This is necessary for Macs without XCode.
It also prevents a crash in the unlikely event that neither is found.
lsof detection is vulnerable to false positives if other (non-readline)
modules are linked against libedit, but this is also unlikely.

closes gh-524
f1278cb
@minrk minrk closed this in f1278cb
@ellisonbg ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
@minrk minrk fallback on lsof if otool not found in libedit detection
This is necessary for Macs without XCode.
It also prevents a crash in the unlikely event that neither is found.
lsof detection is vulnerable to false positives if other (non-readline)
modules are linked against libedit, but this is also unlikely.

closes gh-524
81adc6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.