From fa8056d38e8a5ccddfb29829e56a7b97af3d890a Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Wed, 29 Mar 2023 10:18:34 -0700 Subject: [PATCH] python: purge packages on update --- server/python/plugin_remote.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/python/plugin_remote.py b/server/python/plugin_remote.py index b770675e6..47e7bc70c 100644 --- a/server/python/plugin_remote.py +++ b/server/python/plugin_remote.py @@ -423,7 +423,18 @@ class PluginRemote: pass if need_pip: - shutil.rmtree(python_prefix) + try: + for de in os.listdir(plugin_volume): + if de.startswith('linux') or de.startswith('darwin') or de.startswith('win32') or de.startswith('python') or de.startswith('node'): + filePath = os.path.join(plugin_volume, de) + print('Removing old dependencies: %s' % filePath) + try: + shutil.rmtree(filePath) + except: + pass + except: + pass + os.makedirs(python_prefix) print('requirements.txt (outdated)')