mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-17 12:39:54 +08:00
If symlink already exists, clobber it with current one
This commit is contained in:
parent
24b7085554
commit
37edc78d76
12
setupbase.py
12
setupbase.py
@ -377,15 +377,11 @@ class install_lib_symlink(Command):
|
||||
raise Exception("This doesn't work on Windows.")
|
||||
pkg = os.path.join(os.getcwd(), 'IPython')
|
||||
dest = os.path.join(self.install_dir, 'IPython')
|
||||
if os.path.islink(dest):
|
||||
print('removing existing symlink at %s' % dest)
|
||||
os.unlink(dest)
|
||||
print('symlinking %s -> %s' % (pkg, dest))
|
||||
try:
|
||||
os.symlink(pkg, dest)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST and os.path.islink(dest) \
|
||||
and os.path.realpath(dest) == pkg:
|
||||
print('Symlink already exists')
|
||||
else:
|
||||
raise
|
||||
os.symlink(pkg, dest)
|
||||
|
||||
class install_symlinked(install):
|
||||
def run(self):
|
||||
|
Loading…
Reference in New Issue
Block a user