Skip to content

Commit 4406396

Browse files
committed
fix: compas_rhino.uninstall updated for ipy rhino8
1 parent 82af17e commit 4406396

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/compas_rhino/install.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@ def install(version=None, packages=None, clean=False):
4343
"""
4444
version = compas_rhino._check_rhino_version(version)
4545

46-
# We install COMPAS packages in the scripts folder
47-
# instead of directly as IPy module.
48-
# scripts_path = compas_rhino._get_rhino_scripts_path(version)
49-
50-
# In Rhino 8 there is no scripts folder
5146
if version == "8.0":
47+
# In Rhino 8 there is no scripts folder
5248
installation_path = compas_rhino._get_default_rhino_ironpython_sitepackages_path(version)
5349
else:
50+
# We install COMPAS packages in the scripts folder
51+
# instead of directly as IPy module.
5452
installation_path = compas_rhino._get_rhino_scripts_path(version)
5553

5654
# This is for old installs

src/compas_rhino/uninstall.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ def uninstall(version=None, packages=None):
4040
"""
4141
version = compas_rhino._check_rhino_version(version)
4242

43-
# We install COMPAS packages in the scripts folder
44-
# instead of directly as IPy module.
45-
scripts_path = compas_rhino._get_rhino_scripts_path(version)
43+
if version == "8.0":
44+
# In Rhino 8 there is no scripts folder
45+
installation_path = compas_rhino._get_default_rhino_ironpython_sitepackages_path(version)
46+
else:
47+
# We install COMPAS packages in the scripts folder
48+
# instead of directly as IPy module.
49+
installation_path = compas_rhino._get_rhino_scripts_path(version)
4650

4751
# This is for old installs
4852
ipylib_path = compas_rhino._get_rhino_ironpython_lib_path(version)
@@ -54,8 +58,8 @@ def uninstall(version=None, packages=None):
5458

5559
# Also remove all broken symlinks
5660
# because ... they're broken!
57-
for name in os.listdir(scripts_path):
58-
path = os.path.join(scripts_path, name)
61+
for name in os.listdir(installation_path):
62+
path = os.path.join(installation_path, name)
5963
if os.path.islink(path):
6064
if not os.path.exists(path):
6165
if name not in packages:
@@ -65,7 +69,7 @@ def uninstall(version=None, packages=None):
6569
symlinks_to_uninstall = []
6670

6771
for package in packages:
68-
symlink_path = os.path.join(scripts_path, package)
72+
symlink_path = os.path.join(installation_path, package)
6973
symlinks_to_uninstall.append(dict(name=package, link=symlink_path))
7074

7175
# Handle legacy install location
@@ -78,7 +82,7 @@ def uninstall(version=None, packages=None):
7882

7983
# There is nothing to uninstall
8084
if not symlinks_to_uninstall:
81-
print("\nNo packages to uninstall from Rhino {0} scripts folder: \n{1}.".format(version, scripts_path))
85+
print("\nNo packages to uninstall from Rhino {0} scripts folder: \n{1}.".format(version, installation_path))
8286
return
8387

8488
# -------------------------
@@ -113,7 +117,7 @@ def uninstall(version=None, packages=None):
113117
)
114118

115119
else:
116-
if compas_rhino._try_remove_bootstrapper(scripts_path):
120+
if compas_rhino._try_remove_bootstrapper(installation_path):
117121
results.append(("compas_bootstrapper", "OK"))
118122
else:
119123
results.append(
@@ -138,7 +142,7 @@ def uninstall(version=None, packages=None):
138142
# Output results
139143
# -------------------------
140144

141-
print("Uninstalling COMPAS packages from Rhino {0} scripts folder: \n{1}".format(version, scripts_path))
145+
print("Uninstalling COMPAS packages from Rhino {0} scripts folder: \n{1}".format(version, installation_path))
142146
print("\nThe following packages have been detected and will be uninstalled:\n")
143147

144148
for package, status in results:

0 commit comments

Comments
 (0)