Skip to content

Commit

Permalink
Hopefully better info when 'pip install pyKVFinfer' fails
Browse files Browse the repository at this point in the history
  • Loading branch information
e-pettersen committed Dec 20, 2024
1 parent 0e7eef9 commit bbf0a81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/bundles/kvfinder/bundle_info.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<BundleInfo name="ChimeraX-KVFinder" version="1.5"
<BundleInfo name="ChimeraX-KVFinder" version="1.5.1"
package="chimerax.kvfinder"
minSessionVersion="1" maxSessionVersion="1">

Expand Down
16 changes: 7 additions & 9 deletions src/bundles/kvfinder/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ def get_class(class_name):

@staticmethod
def register_command(command_name, logger):
if not check_pyKVFinder(logger):
return
check_pyKVFinder(logger)
from . import cmd
cmd.register_command(command_name, logger)

@staticmethod
def start_tool(session, tool_name):
if not check_pyKVFinder(session.logger):
return
check_pyKVFinder(session.logger)
from .tool import LaunchKVFinderTool
return LaunchKVFinderTool(session, tool_name)

Expand All @@ -52,11 +50,11 @@ def check_pyKVFinder(logger):
from chimerax.core.commands import run
logger.status("pyKVFinder module not installed; fetching from PyPi repository...", log=True)
try:
run(logger.session, "pip install pyKVFinder", log=False)
except Exception:
logger.report_exception(preface="Could not install pyKVFinder module from PyPi repository")
return False
pip_cmd = "pip install pyKVFinder"
run(logger.session, pip_cmd, log=False)
except (PermissionError, RuntimeError) as e:
logger.info("'%s' failed. Error from pip: %s" % (pip_cmd, str(e)))
raise
logger.status("pyKVFinder module installed from PyPi repository.", log=True)
return True

bundle_api = _KVFinderBundle()

0 comments on commit bbf0a81

Please sign in to comment.