Skip to content

Commit 9deb17f

Browse files
committed
BUG: Fix update notice when idc-index-data has a new version
idc-index-data would be marked as out of date, however it would not be upgraded, making it impossible to get rid of the update required message. Fixed by calling --upgrade on idx-index-data to trigger the update. Also reload the idc-index library after updating so that the new library is used.
1 parent a3fbf83 commit 9deb17f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

IDCBrowser/IDCBrowser.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ def onPythonRequirementsCheckTimeout(self):
476476
self.pythonRequirementsCheckTimer.stop()
477477

478478
requiredLibraries = [
479-
"idc-index"
479+
"idc-index",
480+
"idc-index-data"
480481
]
481482

482483
outdatedLibraries = []
@@ -1521,8 +1522,22 @@ def setupPythonRequirements(self, update=False):
15211522
userMessage = "The module requires idc-index python package, which will now be installed."
15221523
logging.info(userMessage)
15231524
with slicer.util.displayPythonShell() as shell, slicer.util.tryWithErrorDisplay(message=errorMessage, waitCursor=True) as errorDisplay:
1524-
slicer.util.pip_install(f"{'--upgrade ' if update else ''}idc-index>=0.7.0")
1525+
if update:
1526+
slicer.util.pip_install("--no-cache-dir --upgrade idc-index>=0.7.0")
1527+
slicer.util.pip_install("--no-cache-dir --upgrade idc-index-data")
1528+
else:
1529+
slicer.util.pip_install("idc-index>=0.7.0 idc-index-data")
15251530
installed = True
1531+
1532+
import importlib
1533+
# Force reload of the module to pick up the new version
1534+
if 'idc_index' in sys.modules:
1535+
import idc_index
1536+
importlib.reload(idc_index)
1537+
if 'idc_index.index' in sys.modules:
1538+
from idc_index import index
1539+
importlib.reload(index)
1540+
15261541
else:
15271542
installed = True
15281543

0 commit comments

Comments
 (0)