Repository navigation
install.sh: shell-aware PATH instructions - #2
Merged
Merged
Conversation
The PATH warning hard-coded ~/.profile, which zsh (the macOS default since Catalina, including Tahoe) does not read, so the advice silently did nothing for most Mac users. Detect the login shell and print the correct instruction: ~/.zshrc for zsh, ~/.bash_profile (macOS) / ~/.bashrc (Linux) for bash, fish_add_path for fish, with a generic fallback otherwise. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
CED's macOS sonpy is x86_64-only and linked against the python.org framework build, so it fails to load under uv/Homebrew Python or when run as arm64. The installer now handles this end-to-end on Apple Silicon: - Prefer the python.org framework Python (/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14) when no --python is given on macOS. - Detect Apple Silicon and build + install the venv as x86_64 via `arch -x86_64` (Rosetta); error early with a clear pointer to python.org if the chosen interpreter can't run x86_64. - Install the `sonpipe` command as an `arch -x86_64` wrapper (not a symlink) so it runs x86_64 even when invoked from a native-arm64 host such as MATLAB. - Give a macOS-specific message (pointing at the python.org installer) if sonpy still can't be imported, and verify via load_sonpy() so the check matches how the tool actually resolves sonpy. Document the python.org requirement in the README's Apple Silicon note. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
Callers such as MATLAB pass paths like '~/Desktop/x.smrx' through literally, and neither the shell (the arg is quoted) nor Python expands the tilde, so the file was reported missing. SmrxFile now runs os.path.expanduser on the path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
Re-running install.sh now reuses an existing environment and upgrades the sonpipe package in place (fast; no venv rebuild, no sonpy re-download) instead of failing or rebuilding. The update path skips base-Python discovery entirely (the venv already has its interpreter), so `./install.sh` with no args works as the updater. Add --recreate for a clean rebuild and --update as an explicit alias, and a thin update.sh wrapper for discoverability. Also fix a set -u crash: PYVER was unset on the reuse path (used in the sonpy-import-failed message); it is now derived from the venv's Python and always defined. Document updating in the README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
os.path.expanduser('~/ex.smrx') returns a path with a forward slash in the
tail on Windows, so the exact string compare against str(tmp_path/'ex.smrx')
(backslash) failed there. Compare with os.path.normpath so the assertion is
separator-agnostic. Product behaviour was already correct.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When
~/.local/binisn't already on the user'sPATH,install.shprinted an instruction that hard-coded~/.profile. zsh — the default macOS shell since Catalina (and on Tahoe) — does not read~/.profile, so that advice silently did nothing for most Mac users.This makes the PATH hint shell-aware, based on the login shell (
$SHELL):export PATH=...to~/.zshrc(+source)~/.bash_profileon macOS,~/.bashrcon Linuxfish_add_path <dir>export PATH=...fallbackWhy
The installer creates an isolated venv and symlinks the
sonpipecommand into~/.local/bin; if that directory isn't onPATH, the printed fix needs to target a file the user's shell actually sources — otherwise the command appears "not found" even after a successful install.Testing
bash -n install.sh(syntax) passes.SHELL=/bin/zshand a--bin-dirnot onPATH; confirmed it now prints:echo 'export PATH="…/bin:$PATH"' >> ~/.zshrc && source ~/.zshrcNo functional change to the install itself — only the PATH guidance text.
🤖 Generated with Claude Code
Generated by Claude Code