From 23f45ce788df8bdab9500e3eb6beff329c8e077c Mon Sep 17 00:00:00 2001 From: phernandez Date: Thu, 13 Feb 2025 14:51:52 -0600 Subject: [PATCH] add installer for mac/windows --- Makefile | 10 +++++++--- installer/README.md | 18 ------------------ installer/installer.py | 15 ++++++++++++--- installer/setup.py | 32 +++++++++++++++++++++++++++++--- 4 files changed, 48 insertions(+), 27 deletions(-) delete mode 100644 installer/README.md diff --git a/Makefile b/Makefile index fc099fab..06b4920d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install test lint clean format type-check installer +.PHONY: install test lint clean format type-check installer-mac installer-win install: pip install -e ".[dev]" @@ -21,7 +21,7 @@ clean: rm -rf dist rm -rf installer/build rm -rf installer/dist - rm .coverage.* + rm -f .coverage.* format: uv run ruff format . @@ -31,8 +31,12 @@ run-dev: uv run mcp dev src/basic_memory/mcp/main.py # Build app installer -installer: +installer-mac: cd installer && uv run python setup.py bdist_mac +installer-win: + cd installer && uv run python setup.py bdist_win32 + + update-deps: uv lock f--upgrade diff --git a/installer/README.md b/installer/README.md deleted file mode 100644 index f5fcb65e..00000000 --- a/installer/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Basic Memory Installer - -This directory contains the macOS installer for Basic Memory. - -## Building the Installer - -Build the installer: -```bash -cd installer -python setup.py build -``` - -The installer app will be created in `installer/build/Basic Memory Installer` - -## Development - -- `installer.py` - Main installation script -- `setup.py` - py2app configuration for building the macOS app diff --git a/installer/installer.py b/installer/installer.py index d798ea0c..cfe2c9af 100644 --- a/installer/installer.py +++ b/installer/installer.py @@ -11,10 +11,19 @@ def ensure_uv_installed(): print("Installing uv package manager...") subprocess.run(['curl', '-LsSf', 'https://github.com/astral-sh/uv/releases/download/0.1.23/uv-installer.sh', '|', 'sh'], shell=True) +def get_config_path(): +"""Get Claude Desktop config path for current platform.""" +if sys.platform == "darwin": +return Path.home() / 'Library/Application Support/Claude/claude_desktop_config.json' +elif sys.platform == "win32": +return Path.home() / 'AppData/Roaming/Claude/claude_desktop_config.json' +else: +raise RuntimeError(f"Unsupported platform: {sys.platform}") + def update_claude_config(): - """Update Claude Desktop config to include basic-memory.""" - config_path = Path.home() / 'Library/Application Support/Claude/claude_desktop_config.json' - config_path.parent.mkdir(parents=True, exist_ok=True) +"""Update Claude Desktop config to include basic-memory.""" +config_path = get_config_path() +config_path.parent.mkdir(parents=True, exist_ok=True) # Load existing config or create new if config_path.exists(): diff --git a/installer/setup.py b/installer/setup.py index 02f0639b..78e0c12a 100644 --- a/installer/setup.py +++ b/installer/setup.py @@ -1,16 +1,42 @@ from cx_Freeze import setup, Executable +import sys + +# Build options for all platforms +build_exe_options = { + "packages": ["json", "pathlib"], + "excludes": [], +} + +# Platform-specific options +if sys.platform == "win32": + base = "Win32GUI" + build_exe_options.update( + { + "include_msvcr": True, # Include Visual C++ runtime + } + ) + target_name = "Basic Memory Installer.exe" +else: # darwin + base = "gui" + target_name = "Basic Memory Installer" executables = [ Executable( - "installer.py", + script="installer.py", target_name="Basic Memory Installer", - base="gui" + base=base, ) ] setup( name="basic-memory", version=open("../pyproject.toml").read().split('version = "', 1)[1].split('"', 1)[0], - description="Basic Memory", + description="Basic Memory - Local-first knowledge management", + options={ + "build_exe": build_exe_options, + "bdist_mac": { + "bundle_name": "Basic Memory Installer", + }, + }, executables=executables, )