Skip to content

Commit a81b97f

Browse files
committed
Fixed ignored list of uninstallable .ghuser objects
1 parent 51ae8ca commit a81b97f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/compas_ghpython/components/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@ def install_userobjects(source):
7676
return list(zip(symlinks_to_add, created))
7777

7878

79-
def uninstall_userobjects(userobjects):
79+
def uninstall_userobjects(userobjects=None):
8080
"""
8181
Uninstalls Grasshopper user objects.
8282
8383
Parameters
8484
----------
85-
userobjects : list of str
85+
userobjects : list of str, optional
8686
List of user object names to uninstall, eg. ``['Compas_Info.ghuser']``
87+
Defaults to ``None``, in which case the uninstaller will search for user objects
88+
whose name starts with the string 'compas'.
8789
8890
Returns
8991
-------
@@ -93,10 +95,11 @@ def uninstall_userobjects(userobjects):
9395
version = get_version_from_args()
9496
dstdir = get_grasshopper_userobjects_path(version)
9597

96-
userobjects = []
97-
for name in os.listdir(dstdir):
98-
if name.lower().startswith('compas'):
99-
userobjects.append(name)
98+
if not userobjects:
99+
userobjects = []
100+
for name in os.listdir(dstdir):
101+
if name.lower().startswith('compas'):
102+
userobjects.append(name)
100103

101104
symlinks = []
102105
for obj in userobjects:
@@ -108,7 +111,4 @@ def uninstall_userobjects(userobjects):
108111
return list(zip(symlinks, removed))
109112

110113

111-
__all__ = [
112-
'install_userobjects',
113-
'uninstall_userobjects'
114-
]
114+
__all__ = ['install_userobjects', 'uninstall_userobjects']

0 commit comments

Comments
 (0)