Skip to content

Commit 8a5b5cf

Browse files
committed
also try to remove broken symlinks
1 parent 3930549 commit 8a5b5cf

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/compas_rhino/uninstall.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ def uninstall(version=None, packages=None):
4545
if version not in ('5.0', '6.0', '7.0'):
4646
version = '6.0'
4747

48-
packages = _filter_installed_packages(version, packages)
49-
50-
ipylib_path = compas_rhino._get_ironpython_lib_path(version)
5148
# We install COMPAS packages in the scripts folder
5249
# instead of directly as IPy module.
5350
scripts_path = compas_rhino._get_scripts_path(version)
5451

52+
# This is for old installs
53+
ipylib_path = compas_rhino._get_ironpython_lib_path(version)
54+
55+
if not packages:
56+
packages = []
57+
for name in os.listdir(scripts_path):
58+
if name.startswith('compas') and not name.endswith('.py'):
59+
packages.append(name)
60+
61+
packages = _filter_installed_packages(version, packages)
62+
5563
print('Uninstalling COMPAS packages from Rhino {0} scripts folder: \n{1}'.format(version, scripts_path))
5664

5765
results = []
@@ -60,8 +68,7 @@ def uninstall(version=None, packages=None):
6068

6169
for package in packages:
6270
symlink_path = os.path.join(scripts_path, package)
63-
if os.path.exists(symlink_path):
64-
symlinks_to_uninstall.append(dict(name=package, link=symlink_path))
71+
symlinks_to_uninstall.append(dict(name=package, link=symlink_path))
6572

6673
# Handle legacy install location
6774
# This does not always work,

0 commit comments

Comments
 (0)