##// END OF EJS Templates
fix symlinked /home issue for FreeBSD...
fix symlinked /home issue for FreeBSD this is a one-line fix for ipython's pushd and friends on systems which symlink /home directories to /usr/home. Here's the error I get on FreeBSD 9.0 without this PR: ====================================================================== FAIL: Test various directory handling operations. ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest self.test(*self.arg) File "/usr/home/pi/code/ipython/IPython/core/tests/test_magic.py", line 280, in test_dirops nt.assert_equal(curpath(), startdir) AssertionError: u'/usr/home/pi/.ipython' != u'/usr/home/pi/code/ipython' - /usr/home/pi/.ipython ? ^ + /usr/home/pi/code/ipython ? ^^^^^ """Fail immediately, with the given message.""" >> raise self.failureException(u"u'/usr/home/pi/.ipython' != u'/usr/home/pi/code/ipython'\n- /usr/home/pi/.ipython\n? ^\n+ /usr/home/pi/code/ipython\n? ^^^^^\n") -------------------- >> begin captured stdout << --------------------- /usr/home/pi/.ipython /usr/home/pi/code/ipython /usr/home/pi/.ipython [Errno 2] No such file or directory: '/usr~/code/ipython' /usr/home/pi/.ipython popd -> /usr~/code/ipython --------------------- >> end captured stdout << ---------------------- The reason for the above is this: In [1]: pwd Out[1]: u'/usr/home/pi' In [2]: !pwd /home/pi In [3]: pushd code /usr/home/pi/code Out[3]: [u'/usr~'] with this commit: In [1]: pushd Out[1]: [u'~']

File last commit:

r4562:afb86869
r6112:542170a5
Show More
ipython.py
23 lines | 813 B | text/x-python | PythonLexer
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""IPython -- An enhanced Interactive Python
The actual ipython script to be installed with 'python setup.py install' is
in './scripts' directory. This file is here (ipython source root directory)
to facilitate non-root 'zero-installation' (just copy the source tree
somewhere and run ipython.py) and development. """
if __name__ != "__main__":
raise RuntimeError('You are trying to import the ipython.py executable. '
'Did you mean to call "import IPython" (case-sensitive) instead?')
# Ensure that the imported IPython is the local one, not a system-wide one
import os, sys
this_dir = os.path.dirname(sys.argv[0])
sys.path.insert(0, this_dir)
# Now proceed with execution
execfile(os.path.join(
this_dir, 'IPython', 'scripts', 'ipython'
))