From 74cb75e0c95f64e21dbde76bdabd51f211e8ac92 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 16 Dec 2013 15:12:39 -0800 Subject: [PATCH] Add 'unsymlink command to remove the symlink --- setup.py | 2 ++ setupbase.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/setup.py b/setup.py index 8a06aeb2c..eb270f10a 100755 --- a/setup.py +++ b/setup.py @@ -72,6 +72,7 @@ from setupbase import ( install_symlinked, install_lib_symlink, install_scripts_for_symlink, + unsymlink, ) from setupext import setupext @@ -237,6 +238,7 @@ setup_args['cmdclass'] = { 'symlink': install_symlinked, 'install_lib_symlink': install_lib_symlink, 'install_scripts_sym': install_scripts_for_symlink, + 'unsymlink': unsymlink, 'jsversion' : JavascriptVersion, } diff --git a/setupbase.py b/setupbase.py index 5a6eac620..6a6a31244 100644 --- a/setupbase.py +++ b/setupbase.py @@ -383,6 +383,15 @@ class install_lib_symlink(Command): print('symlinking %s -> %s' % (pkg, dest)) os.symlink(pkg, dest) +class unsymlink(install): + def run(self): + dest = os.path.join(self.install_lib, 'IPython') + if os.path.islink(dest): + print('removing symlink at %s' % dest) + os.unlink(dest) + else: + print('No symlink exists at %s' % dest) + class install_symlinked(install): def run(self): if sys.platform == 'win32':