Skip to content

Commit 181ca78

Browse files
committed
remove packages not available in the current env and reinstall others
1 parent c801cc0 commit 181ca78

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/compas_rhino/install.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ def install(version=None, packages=None):
5454
# This is for old installs
5555
ipylib_path = compas_rhino._get_ironpython_lib_path(version)
5656

57-
# If no specific packages are provided for installation
58-
# everything should be removed first,
59-
# and not just the default packages
60-
# or the packages that the bootstrapper is aware of.
61-
if not packages:
62-
packages = []
63-
for name in os.listdir(scripts_path):
64-
if name.startswith('compas') and not name.endswith('.py'):
65-
packages.append(name)
66-
6757
packages = _filter_installable_packages(version, packages)
6858

6959
print('Installing COMPAS packages to Rhino {0} scripts folder:'.format(version))
@@ -74,6 +64,17 @@ def install(version=None, packages=None):
7464
symlinks_to_uninstall = []
7565
exit_code = 0
7666

67+
for name in os.listdir(scripts_path):
68+
if name.startswith('compas') and not name.endswith('.py'):
69+
try:
70+
importlib.import_module(name)
71+
except ImportError:
72+
symlink_path = os.path.join(scripts_path, name)
73+
symlinks_to_uninstall.append(dict(name=name, link=symlink_path))
74+
else:
75+
if name not in packages:
76+
packages.append(name)
77+
7778
for package in packages:
7879
symlink_path = os.path.join(scripts_path, package)
7980
symlinks_to_uninstall.append(dict(name=package, link=symlink_path))

0 commit comments

Comments
 (0)