Skip to content

Commit

Permalink
Merge pull request #5 from henrypinkard/main
Browse files Browse the repository at this point in the history
expose default install path
  • Loading branch information
henrypinkard authored Jul 16, 2024
2 parents 8519696 + fc028e4 commit 35df694
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/mmpycorex/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version_info = (0, 2, 0)
version_info = (0, 3, 0)
__version__ = ".".join(map(str, version_info))
19 changes: 15 additions & 4 deletions src/mmpycorex/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ def find_existing_mm_install():
else:
raise ValueError(f"Unsupported OS: {platform}")

def get_default_install_location():
"""
Get the default path where Micro-manager gets installed by the download_and_install_mm function
"""
platform = _get_platform()
if platform == 'Windows':
return r'C:\Program Files\Micro-Manager'
elif platform == 'Mac':
return str(os.path.expanduser('~')) + '/Micro-Manager'
else:
raise ValueError(f"Unsupported OS: {platform}")

def download_and_install_mm(destination='auto', mm_install_log_path=None, ci_build=False):
"""
Download and install the latest nightly build of Micro-Manager
Expand Down Expand Up @@ -109,9 +121,10 @@ def bar(curr, total, width):
print('Downloading: ', latest_version)
wget.download(latest_version, out=installer, bar=bar)

if destination == 'auto':
destination = get_default_install_location()

if windows:
if destination == 'auto':
destination = r'C:\Program Files\Micro-Manager'
cmd = f"{installer} /SP /VERYSILENT /SUPRESSMSGBOXES /CURRENTUSER /DIR=\"{destination}\""

if mm_install_log_path:
Expand All @@ -120,8 +133,6 @@ def bar(curr, total, width):

return destination
else:
if destination == 'auto':
destination = str(os.path.expanduser('~')) + '/Micro-Manager'
try:
# unmount if already mounted
subprocess.run(['hdiutil', 'detach', '/Volumes/Micro-Manager'])
Expand Down
4 changes: 3 additions & 1 deletion src/mmpycorex/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import types
import os

from mmpycorex.install import get_default_install_location
from pymmcore import CMMCore
import pymmcore
from pyjavaz import DEFAULT_BRIDGE_PORT, server_terminated


import re

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -120,7 +122,7 @@ def terminate_core_instances(debug=False):
atexit.register(terminate_core_instances)

def create_core_instance(
mm_app_path: str, config_file: str=None, java_loc: str=None,
mm_app_path: str = get_default_install_location(), config_file: str='MMConfig_demo.cfg', java_loc: str=None,
python_backend=False, core_log_path: str='',
buffer_size_mb: int=1024, max_memory_mb: int=2000,
port: int=DEFAULT_BRIDGE_PORT, debug=False):
Expand Down

0 comments on commit 35df694

Please sign in to comment.